From: David Poger (d.poger_at_uq.edu.au)
Date: Mon Jul 21 2008 - 20:19:01 CDT

Hello

I wrote a Tcl script to do a really basic thing: loading a trajectory
and taking a snapshot of each frame. However, it doesn't work. It seems
the number of frames isn't correct. There are excatly 740 frames (and my
file is not corrupted) and VMD invariably finds 4 frames (but, if after
the trajectory is loaded, VMD finds the correct number of frames if I
type 'molinfo top get numframes' in the VMD console window).
Also, if I run VMD interactively (by typing 'vmd -e myscript.tcl'), the
first 4 frames are effectively rendered but if I run VMD in batch ('vmd
-dispdev text -e myscript.tcl'), the 4 files corresponding to the
rendering are created but they are empty...

Could anyone help me, please?

Thanks,

David

Here is the script that I use:

#################
# command: vmd -dispdev text -e myscript.tcl

# Axes off
axes location off
display antialias on
display projection Orthographic

# Load the gro file
mol new firstframe.gro
mol delrep 0 top

# water: blue lines
mol selection water
mol representation Lines
mol color ColorID 22
mol addrep 0
# other: white licorice
mol selection {not water}
# Licorice a n m, a=bond radius, n,m=sphere/bond resolutions
mol representation Licorice 0.2 50 50
mol color ColorID 8
mol addrep 0
# P: yellow vdw
mol selection {name P}
mol representation VDW 1.0 50
mol color ColorID 4
mol addrep 0

# Periodic images
mol showperiodic top 0 xzX
mol numperiodic top 0 3
mol showperiodic top 1 xzX
mol numperiodic top 1 3
mol showperiodic top 2 xzX
mol numperiodic top 2 3

# Center
rotate x by 90
scale by 1.5
translate by 1 1.4 0

display resize 834 834

# Load the trajectory
animate style once
mol addfile ./XTC/trajectory.xtc top

set nframes [molinfo top get numframes]

set frame 0

# Loop over the trajectory
for {set i 0} {$i < $nframes} {incr i } {
                # go to the given frame
                animate goto $i
                # force display update
                display update
                puts "frame $i of $nframes"
                # filename
                set filename ./MOVIE/anim_[format "%04d" $frame].ppm
                # take the picture
                render snapshot $filename

                incr frame
}

exit

-- 
_________________________________________________
David POGER, Ph.D.
Postdoctoral Research Fellow
Molecular Dynamics Group
School of Molecular and Microbial Sciences (SMMS)
Chemistry Building (#68)
The University of Queensland
Brisbane, QLD 4067
Australia
Email: d.poger_at_uq.edu.au
Tel: +61 7 3365 7562
Fax: +61 7 3365 3872
** Notice: Unless stated otherwise, this e-mail represents only the views of the Sender and not the views of The University of Queensland.