# get the correct frame
$compare frame $frame
# compute the transformation
set trans_mat [measure fit $compare $reference]
# do the alignment
$compare move $trans_mat
# compute the RMSD
set rmsd [measure rmsd $compare $reference]
# print the RMSD
puts "RMSD of $frame is $rmsd"
} }
To use this, load a molecule with an animation (for example, $VMDDIR/proteins/alanin.DCD from the VMD distribution). Then runprint rmsd through time. Example output is shown here:
vmd > print_rmsd_through_time RMSD of 0 is 0.000000
RMSD of 1 is 1.060704 RMSD of 2 is 0.977208 RMSD of 3 is 0.881330 RMSD of 4 is 0.795466 RMSD of 5 is 0.676938 RMSD of 6 is 0.563725 RMSD of 7 is 0.423108 RMSD of 8 is 0.335384 RMSD of 9 is 0.488800 RMSD of 10 is 0.675662 RMSD of 11 is 0.749352
[...]
display update off
for {set i 0} {$i < 1024} {incr i} { if {$i == 0} {
set r 1; set g 0; set b 0 }
if {$i == 511} {
set r 1; set g 1; set b 1 }
if {$i == 513} {
set r 0; set g 0; set b 1 }
color change rgb [expr $i + $color_start ] $r $g $b }
display update on }
tricolor_scale
11.5.2 Creating a set of black-and-white color definitions To map grayscale on the color ids 0-16 (0=black; 16=white):
proc make_grayscale {} { display update off
for {set i 0} {$i < 17} {incr i} { set val [expr $i / 16.0]
color change rgb $i $val $val $val }
display update on }
Note that the display updates are switched off for the time of redefinition, so that the screen would not be redrawn every time one color is changed. This way the procedure works faster. The only bad thing about this idea is that black becomes white, and white changes too, so the names of the colors (yellow, orange, etc.) become useless.
11.5.3 Revert all RGB values to defaults
After some of the color definitions have been changed and you want to restore the default definitions, the following procedure might be useful.
proc revert_colors {} { display update off
foreach color [colorinfo colors] { color change rgb $color
}
display update on }
11.5.4 Coloring Trick - Override a Coloring Category
There is currently no user-defined coloring method. This makes it hard to color residues by property
“X” if X is not already defined in VMD. It is possible to get around this limitation somewhat by overriding one of the values in the PDB or PSF. For instance, suppose you wanted to color the atoms by the distance of the atom from a given point. One way is to compute the distance and put it in either the occupancy or beta field of the PDB file. Then when the molecule is colored by occupancy it is actually coloring by distance.
You could also override, say, the segment name field or even the residue name. Don’t override the atom name unless you are really desperate as VMD uses it to determine which residues are proteins and nucleic acids, and hence which residues can be drawn as a tube or ribbon.
Chapter 12
Customizing VMD Sessions
There are a number of ways to change the behavior of VMD from the default settings, both in how the program starts up and in how the program behaves during a session. This Chapter describes the data files, command-line options, and environment variables which are used to customize a VMD session.
These files control the initial appearance and behavior of VMD at the start, and may be customized to suit each user’s particular tastes. Default versions of these files are placed in the VMD installation directory (On Unix this is usually /usr/local/lib/vmd, on Windows this defaults to C:\Program Files\University of Illinois\VMD). Each user may specify their own versions of some of these files, but unless this is done the commands and values in the default files are used. In this way, an administrator may customize the default behavior of VMD for all users, while giving each user the option to change the default behavior however they choose.
Several configurable parameters may also be set in a number of ways, including use of command- line options or environment variables. The order of precedence of these methods is as follows (highest precedence to lowest):
1. Command-line options.
2. Environment variable settings.
3. Built-in defaults, as specified by compilation configurable parameters. These are used only if no other values are specified by the other methods mentioned in this list. The Installation Guide describes how to change these default values when compiling VMD.
12.1 VMD Command-Line Options
When started, the following command-line options may be given to VMD. Note that if a command- line option does not start with a dash (-), and is not part of another option, it is assumed to be a filename, and its extension is matched to the extension registered by the proper plugin. Thus, the Unix command
vmd molecule.pdb
will start VMD and load a molecule from the file molecule.pdb, while the command vmd molecule.psf molecule.dcd
will load the corresponding structure and coordinate files into the same molecule. On the Windows platform, one must preface the VMD invocation with the Windows startcommand
start vmd molecule.pdb
• -h | --help: Print a summary a command-line options to the console.
• -e filename: After initialization, execute the text commands in filename, and then resume normal operation.
• -python : After initialization, switch to the Python interpreter before executing commands in the file specified by-e (if any), and leave the text interpreter in Python mode.
• filename : Load the specified file at startup. The file type will be determined from the filename extension; if there is no filename extension, and the filename contains 4 letters, it is assumed to be a PDB accession code and will be loaded accordingly; otherwise the format is assumed to be PDB.
• -<filetype> filename: Load the specified file using the given filetype.
• -f : Load all subsequent files into the same molecule. This is the default. A new molecule is created for each invocation of-f; thus, vmd -f 1.pdb 2.pdb -f 3.pdbloads 1.pdb and 2.pdbinto the same molecule and 3.pdbinto a different molecule.
• -m: Load all subsequent files into separate molecules. The-fand-moptions may be specified multiple times on the command line in order to load multiple molecule containing one or more files.
• -dispdev < win | text | cave | caveforms | none > : Specify the type of graphical display to use. The possible display devices include:
– win: a standard graphics display window.
– text: do not provide any graphics display window.
– cave: use the CAVE virtual environment for display, forms are disabled.
– caveforms: use the CAVE virtual environment for display and with forms enabled. This is useful with-display machine:0for remote display of the forms when the CAVE uses the local screen.
– none: same as text.
It is possible to use VMD as a filter to convert coordinate files into rendered images, by using the-dispdev textand -e options.
• -dist z : Specify the distance to the VMD image plane.
• -height y : Specify the height of the VMD image plane.
• -pos x y : Specify the position for the graphics display window. The position (x,y) is the number of pixels from the lower-left corner of the display to the lower-left corner of the graphics window.
• -size x y : Specify the size for the graphics display window, in pixels.
• -nt: Do not display the VMD title at startup.
• -eofexit: Make VMD exit when EOF on stdin is reached; for example, when a script is redi- rected to VMD. The combinationvmd -dispdev text -eofexit < input.tcl > output.log is useful for batch mode scripting.
• -startup filename : Use filename as the VMD startup command script, instead of the default.vmdrc orvmd.rc file.
• -args: Pass subsequent command line arguments to the text interpreter. The Tcl interpreter will store these arguments in the list variable argv. By default, no arguments are stored in this variable.
• -debug [level: Turn on output of debugging messages, and optionally set the current debug level (1=few messages ... 5=many verbose messages). Note this is only useful if VMD has been compiled with debugging option included.