One of the more frequently requested options is the ability to save the current state of VMD to a file so it can be recovered. It is possible to log the core commands to a file and play them back later, and reconstruct everything that way. However, that is quite cumbersome and slow, so a better way is needed.
Because we are making much of the VMD data accessible at the Tcl script level, we decided to implement the save/restore option as a Tcl command. This is actually a rather complicated process and some of the things to watch out for are:
Ivo Hofacker has graciously struggled through all the above caveats to write a set of Tcl commands which will save nearly all of the current VMD state to a file, and restore it back again. The commands are
# save the color definitions in a file # argument: file name proc savcol {file} { save_colors [open $file w] close $filedesc }This procedure takes the file name as a parameter (as opposed to file descriptor in save_colors).
If you plan to write scripts which interact with VMD itself (not just the analysis commands), you are highly advised to look at the commands, which are defined in $VMDDIR/scripts/vmd/save_state.tcl (The code is too long to be included in this section.)