From: Thomas Evangelidis (
Date: Wed May 20 2009 - 23:20:38 CDT

I would appreciate if someone could help me resolve my problem with
bigdcd. The conventional bibdcd script yields errors (moves to the
next frame too early) when doing long calculations for each frame like
in my script, therefore had to adapt it a bit. The problem occurs
whenever I load a new molecule with "mol new". I have enclosed my
adapted version at the end of this message, with a simple RunMethod to
comprehend what I'm talking about. The last time I received advice was
from John whose message I quote below:

   If you are loading frames within the SaveFrame method, you'll need
to temporarily disable the frame loading trace/callback, to prevent it
from going into an infinite loop of sorts.


This doesn't help either (see lines 77 and 79). In fact only the first
frame is saved although the trajectory seems to be loaded.

For the first time in my career I must admit that I cannot fix this
problem alone. This is not because I haven't spent enough time (in
fact I've spent several weeks trying to figure out what's happening)
but rather due to the changes in VMD source code which I'm unable to
predict. My plugin, for which I have spent significant amount of
effort, works normally in version 1.8.6 where it was developed. I
would love to see it included in version 1.8.7 and meanwhile receive
feedback from users to improve it.


set log_adapted [open "adapted.log" "w"]
set itest 0

proc adaptedBigdcd { script args } {
   global bigdcd_frame bigdcd_proc bigdcd_firstframe vmd_frame

   set ::bigdcd_is_done 0

   set bigdcd_frame 0
   set bigdcd_firstframe [molinfo top get numframes]
   set bigdcd_proc $script

   uplevel #0 trace variable vmd_frame w bigdcd_callback
   foreach dcd $args {
     animate read dcd $dcd waitfor 0

proc bigdcd_callback { tracedvar mol op } {
   global bigdcd_frame bigdcd_proc bigdcd_firstframe vmd_frame

   # If we're out of frames, we're also done
   set thisframe $vmd_frame($mol)
   puts $::log_adapted "DEBUG: bigdcd_callback thisframe = $thisframe
bigdcd_firstframe = $bigdcd_firstframe mol = $mol vmd_frame(mol) =
   if { $thisframe < $bigdcd_firstframe } {

   incr bigdcd_frame
   if { [catch {uplevel #0 $bigdcd_proc $bigdcd_frame} msg] } {
     puts stderr "bigdcd aborting at frame $bigdcd_frame\n$msg"
   animate delete beg $thisframe end $thisframe
   return $msg

proc bigdcd_done { } {
   set ::bigdcd_is_done 1
   puts "bigdcd_done"
   uplevel #0 trace vdelete vmd_frame w bigdcd_callback

proc bigdcd_disable { } {
   uplevel #0 trace vdelete vmd_frame w bigdcd_callback

proc bigdcd_enable { } {
   global vmd_frame
   uplevel #0 trace variable vmd_frame w bigdcd_callback

proc adaptedBigdcd_wait_till_done {} {
   while {! $::bigdcd_is_done} {
     puts "::bigdcd_is_done = $::bigdcd_is_done"
     display update

proc SaveFrame { frm } {
     puts "frame = $frm"
     incr itest
     animate write pdb
"/home/thomas/Documents/Molecular_Dynamics/wholeframe_$frm.pdb" beg 0
end 0 waitfor all top
     mol new "/home/thomas/Documents/Molecular_Dynamics/wholeframe_$frm.pdb"

proc RunMethod {} {
      mol delete all
      mol load psf DCD_with_cell.psf
      adaptedBigdcd SaveFrame sample_DCD_with_cell.dcd