Date: Tue Jun 14 2005 - 03:09:48 CDT

Hi folks,

OK, it took me a couple days before I could try this out, and sure enough,
Axel was again correct. Thanks! Yes indeed, a race condition seems to
have been resulting from my omission of the "waitfor all" option -- even
though I was only writing a single frame. (I had previously thought that
this option was only important when reading/writing multiple frames.)

I still have one issue to resolve, however: at the end of the loop in my
script, I wanted to use the "animate readdel" command, in order to read
in a new set of coordinates, overwriting the old coordinates. But when
I tried this:
        animate readdel $out_name.coor beg $frame end $frame
VMD complains:
        Valid options are: reverse, rev, forward, for, prev, next, pause,
        read, write, delete, and dup.
So even though the "readdel" option is documented in the user guide, it
doesn't seem to be recognized by the VMD program! Anybody know what's going
on here? Again, I'm running VMD1.8.3 on IRIX.

Alternatively, is there some other way to do what I want? I tried simply
using the "animate read" command:
        animate read pdb $out_name.coor beg $frame end $frame waitfor all
but in this case the new coordinates do not overwrite the old ones; the
command apparently simply fails (silently!) to do anything, if I try reading
coords into a frame that already has coords. I also tried:
        animate delete beg $frame end $frame
        animate read pdb $out_name.coor beg $frame end $frame waitfor all
but in this case VMD complains:
        ERROR) molecule_dupframe: frame out of range
        ERROR) Illegal frames requested for coordinate file I/O

Assistance greatly appreciated as always...

- Erik

C. Erik Nordgren, Ph.D.
Department of Chemistry
University of Pennsylvania

Quoting Axel Kohlmeyer <>:

> On Thu, 9 Jun 2005 wrote:
> erik,
> EN> Unfortunately, I'm still having difficulty of a more subtle nature.
> Now
> EN> that I know someone is reading :) I'll elaborate a bit more.
> Basically,
> ok. great.
> EN> what I want to do is use VMD to force a rescaling of the distance
> between
> EN> certain parts of my system, and then call NAMD to do some brief energy
> EN> minimization of the coordinates, and then repeat the process in a loop
> EN> over my scaling parameter. At each step, a new coord frame is
> generated,
> EN> and at the end the entire trajectory is saved. Here is the skeleton
> of the
> EN> VMD script I'm trying to get to work (where the scaling is given by
> "L")...
> EN>
> EN>
> ---------------------------------------------------------------------------
> EN> mol load psf $start_psf pdb $start_pdb
> EN> set frame 0
> EN> # initial coords are left as-is in frame 0; begin minimizing in next
> frame
> EN> for {set L [expr $max - $del]} {$L >= $min} {set L [expr $L - $del]} {
> EN>
> EN> # add new frame to the trajectory, with coords copied from current
> frame
> EN> animate dup frame $frame 0
> EN> incr frame
> EN> animate goto $frame
> EN>
> EN> # (modify coords of new frame...)
> EN>
> EN> # call NAMD to energy-minimize the new coords
> EN> animate write pdb $temp_pdb beg $frame end $frame
> i think here could be the problem. you should add 'waitfor all'
> to the 'animate write' command, or else VMD will start writing the
> files and _immediately_ continue executing the script thus creating
> a race condition. i assume during the first loop this is not
> biting you, since the parser needs more time to evaluate the
> script, but from them on it should take advantage of the internal
> caching of preparse code and thus the writing of the pdb file may
> not be finished when your script calls NAMD the second time.
> EN> set cell_size [expr 4.0 * $L]
> EN> exec env NAMD_psf=$start_psf \
> EN> NAMD_pdb=$temp_pdb \
> EN> NAMD_outfile=$out_name \
> EN> NAMD_minsteps=$namd_minsteps \
> EN> NAMD_cell=$cell_size \
> EN> namd2 +p1 $namd_configfile
> EN>
> EN> # replace coords of current frame with new (minimized) coords
> EN> animate read pdb $out_name.coor beg $frame end $frame
> for safety and the sake of consistency you should add an
> 'waitfor all' here as well.
> EN>
> EN> }
> best regards,
> axel.
> --
> =======================================================================
> Dr. Axel Kohlmeyer e-mail:
> Lehrstuhl fuer Theoretische Chemie Phone: ++49 (0)234/32-26673
> Ruhr-Universitaet Bochum - NC 03/53 Fax: ++49 (0)234/32-14045
> D-44780 Bochum
> =======================================================================
> If you make something idiot-proof, the universe creates a better idiot.