VMD

From Docswiki
Jump to navigation Jump to search

VMD is a molecular visualization program installed on all workstations and clusters. The official documentation can be found here with some tutorials here. Like gnuplot however, the wealth of options means that often it takes a long time to find the one command you need to use so below you will find some useful basic settings/info for using VMD. For producing graphics for publication, Pymol is probably a better option as it has a built in ray-tracing routine but for general visualization, VMD is much quicker.

It is possible to load most files using command line flags, making loading many frames into different topology files easy. The -f flag indicates that all subsequent files (until the next -f flag or the end) should be loaded into a single molecule. There are also flags for selecting different file types (default is .pdb), most commonly parm7 for topology files generated by Amber and rst7 for restart files generated by Amber. mdcrd files are denoted -crd and periodic mdcrd files -crdbox.

e.g.

       vmd -f first_mol.pdb \
           -f -parm7 second_mol.prmtop -rst7 second_mol.rst \
           -f -parm7 third_mol.prmtop -crdbox third_mol_1st_frames.crd -crdbox third_mol_2nd_frames

Rendering Molecules with a Transparent Background

Dumping selected frames from a movie or a single image can be achieved using the render option in the vmd gui. Choosing the povray option should produce a vmdscene.pov file. This pov file can be converted to a png with a transparent background using povray if you must have a white background in vmd:

povray +W829 +H771 -Ivmdscene.pov -Ovmdscene.pov.tga -Otest +Q11 +J +A +FN +UA

The +W and +H values must be taken from the vmdscene.pov file; they should be given in a comment statement at the top.


Movie Making Tips

To load all frames in one go, select the file type in the "Determine file type" box, and then the button "load all at once" will not be greyed out, so you can select it.


vmd movie making seems not work properly with step sizes different from one. The last frame is repeated many times. Instead, the frames can be selected using sed:

Try extracting frames first with sed:

sed -e '1~66087,+62939d' path.xyz > temp

1,+62939d deletes lines 1 to 62940, deleting 20 frames

The ~66087 repeats the action every 21 frames. The counter operates on the original line numbers.

This example is for a system with 3145 atoms, so each frame is 3147 lines with the xyz header.

sed -e '1~Y,+Xd' path.xyz > temp

1,+Xd deletes lines 1 to X+1, so to select every nth frame for frames of length m you need

X=n*m-1

and Y=(n+1)*m

m is the number of atoms plus two.

To make the movie pause at the start and finish, just duplicate these end points sufficiently. If there are slow portions around local minima try adjusting the energy difference parameter on the PATH line in the OPTIM odata file for intial generation of path.xyz.


Tutorials