From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Tue Feb 27 2007 - 17:25:16 CST

On Tue, 27 Feb 2007, Bob Johnson wrote:

RJ> Hello everyone,

hi bob,

RJ> For visualization purposes, I would like to make a volume map for each frame of
RJ> a trajectory. I do not want to combine them at the end via their average value.
RJ> How would I do this from the script level? I tried the following:
RJ>
RJ> for {set i 0} {$i < $num_frames } {incr i} {
RJ>
RJ> animate goto $i
RJ> volmap density [atomselect top "water"] -res 1.0 -radscale 1.0 -weight mass -mol
RJ> top
RJ>
RJ> }

since the volume map is derived from the selection, you have to
step the selection forward. this way, you're also 'leaking' selections,
since you don't delete them. try:

set sel [atomselect top {water}]

for {set i 0} {$i < $num_frames } {incr i} {

   $sel frame $i

   volmap density $sel -res 1.0 -radscale 1.0 -weight mass -mol top
}

$sel delete

RJ>
RJ> However, all I obtained was $num_frames volume maps of the same frame (i.e. the
RJ> frame that corresponded to the current position of the "trajectory slider" on
RJ> the VMD Main window). If I type the commands within the loop in a Console
RJ> window, everything seems to work out fine. Any suggestions on how I can do
RJ> this?

within a loop animate goto is usually 'cached', so you'd need to
do a 'display update' to force an update of the animate state.
this, however, has serious performance implications. the code
from above should be more efficient anyways.

cheers,
   axel.

RJ> Thanks,
RJ> Bob
RJ>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.