From: John Stone (johns_at_ks.uiuc.edu)
Date: Mon Oct 05 2009 - 22:22:10 CDT

Hi Maria,
  Sorry for the slow reply, I just got back from travelling and
I'm still way behind on emails... Change the line
"draw delete ll" to "draw delete all" and the script should work fine.

It turns out that if there's any runtime error in the callback
procedure that's registered for a Tcl trace routine, it will exit
out. Since you don't get return codes for callback procedures, it
can seem like nothing is happening at all. In this case, the
single character typo in the script I sent was preventing the
rest of the callback procedure from running.

I've attached the corrected script text to this email for your convenience.

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Mon, Sep 28, 2009 at 05:53:04PM +0200, maria goranovic wrote:
> Hi John
>
> I tried using the script as is. Loaded my trajectory, sourced the script,
> enabletrace, and played the movie in the GUI. nothing appeared as text. If
> I just type the contents of the drawcounter procedure, I do get text (of
> course, for a single frame). Am i doing something wrong in the "do your
> thing" section?
>
> thanks a lot
>
> -maria
>
> On Mon, Sep 28, 2009 at 5:07 PM, John Stone <johns_at_ks.uiuc.edu> wrote:
>
> Hi,
> If you use a Tcl trajectory frame callback, it should work regardless
> how you make the movie and you should be able to use it interactively
> as well as during movie rendering. Here's a crude example script.
>
> ##
> ## Example script showing a way to add user-drawn geometry that updates
> ## as a trajectory is animated.
> ##
> ## To use this script:
> ## 1) load your trajectory
> ## 2) source frameupdate.vmd
> ## 3) enabletrace
> ## 4) do your thing :-)
> ## 5) disabletrace
>
> proc enabletrace {} {
> global vmd_frame;
> trace variable vmd_frame([molinfo top]) w drawcounter
> }
>
> proc disabletrace {} {
> global vmd_frame;
> trace vdelete vmd_frame([molinfo top]) w drawcounter
> }
>
> proc drawcounter { name element op } {
> global vmd_frame;
>
> draw delete ll
> # puts "callback!"
> draw color white
> set psperframe 1.03
> set time [format "%8.3f ps" [expr $vmd_frame([molinfo top]) *
> $psperframe]]
> draw text {10 10 0} "$time"
> }
>
> Cheers,
> John Stone
> vmd_at_ks.uiuc.edu
> On Mon, Sep 28, 2009 at 04:55:02PM +0200, maria goranovic wrote:
> > What if I make a movie out of the trajectory using default options
> > (snapshot as renderer). Will the time show in that case?
> >
> > Thank you for helping
> >
> > On Mon, Sep 28, 2009 at 4:30 PM, Axel Kohlmeyer
> <akohlmey_at_gmail.com>
> > wrote:
> >
> > On Mon, Sep 28, 2009 at 5:57 AM, maria goranovic
> > <mariagoranovic_at_gmail.com> wrote:
> > > Hi
> > >
> > > Is it possible to get a timer in vmd animations ? The earlier
> > reference in
> > > the list is to a dial, which might be too big to accommodate.
> >
> > yes, it is possible. you have to use the same mechanism as it is
> used
> > by other graphical options, i.e. put a trace on the vmd_frame
> variable.
> >
> > there are a number of examples around, all you have to do is to
> replace
> > the script code that draws the graphics with script code that
> draws the
> > text you would like to see. please note, that text output is
> currently
> > not
> > exported to external renderes, for technical reasons.
> >
> > cheers,
> > axel.
> > > Thanking you
> > >
> > > -maria
> > >
> > > --
> > > Maria G.
> > > Technical University of Denmark
> > > Copenhagen
> > >
> >
> > --
> > Dr. Axel Kohlmeyer akohlmey_at_gmail.com
> > Institute for Computational Molecular Science
> > College of Science and Technology
> > Temple University, Philadelphia PA, USA.
> >
> > --
> > Maria G.
> > Technical University of Denmark
> > Copenhagen
>
> --
> NIH Resource for Macromolecular Modeling and Bioinformatics
> Beckman Institute for Advanced Science and Technology
> University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> Email: johns_at_ks.uiuc.edu Phone: 217-244-3349
> WWW: http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078
>
> --
> Maria G.
> Technical University of Denmark
> Copenhagen

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078