Dallas R. Trinkle

Research Group

VMD

Obtaining VMD

VMD can be downloaded from the VMD homepage.

Introduction

VMD (Visual Molecular Dynamics) is a powerful molecular visualization program developed here at UIUC. It can display large systems of atoms as well as render beautiful 3D figures for publication. Getting VMD to do exactly what you want is sometimes a bit awkward. Rather than going though the Manuals, it may be better to learn from the guide/examples below.

How-to

Input Files

VMD reads in a variety of molecular structure data files. For our purposes, the ones that will probably be most used are the easy to edit .xyz, the VASP POSCAR, the LAMMPS trajectory file, and the .pdb (Protein Data Bank format) which contains bond information.

After “File–>New Molecule”, you can just browse for the input file and VMD should automatically select the correct file format.

Terminal Commands

The terminal window that opens with VMD is useful for quite a few things. This list is for some commands that can/should only be done in the terminal.

display resize xres yres
This is the most important command, it changes the size of the VMD display window and affects the resolution ratio for rendered images. Use it to change the display window to encompass your scene without too much whitespace.

rotate [x | y | z] by <angle>
This command rotates the scene around the x, y, or z axis by <angle> degrees. I recommend this command to setup your view. You can go to “Display–>Reset View” and then use the rotate command to get the exact view you want. A typical rotate command would go like: rotate x by 60.

Some other commands that can be useful are:

scale by f
Scale the scene by factor f.

translate by x y z
Translates the scene by the vector (x, y, z).

Graphics Settings

Graphics-->Representations

This is where you change how atoms and bonds are displayed.

Create Rep creates a new representation set, it will replicate the currently selected representation set.

Selected Atoms gives a simple selection of which atom species are used for the representation set.

Draw Style allows you to choose the:

  • “Drawing Method” should usually be “Bonds” or “CPK”.
  • “Coloring Method” should usually be ColorID to allow free choice of colors.
  • “Material” can be changed according to your needs. One of the AO materials should be alright for Ambient Occlusion. Goodsell also gives an interesting appearance.
  • The resolution for both “Bond” and “Sphere” should be at least 32 to give a smooth rounded appearance. Though I suppose maybe some cute things can be done with faceted bonds (resolution of 4 or 6).

Selection give more freedom in selecting different sets of atoms for display.

Graphics-->Colors

This allows you to change the color for various things, including the background and the axes. It also allows you to edit custom colors to use. These settings can also be changed in the .vmd state file described below.

Graphics-->Materials

This allows you to change or add new materials to use. These settings can also be changed in the .vmd state file described below.

Display Setting

The Display menu has some settings that determine how the scene looks in general. Perspective or Othographic should be picked according to what information you want to show. Depth Cueing and Culling usually don't need to be selected but may be useful for some situations. Lights determine which lights and from what direction they should be shining.

Ambient Occlusion

Turn on Ambient Occlusion in “Display–>Display Settings”, it's in the External Renderer Options. Turn both “Shadows” and “Amb. Occl.” to On. I have found that “AO Ambient”=1.00 and “AO Direct”=0.20 seem to work well with a single light.

VMD State Files

Going to “File–>Save Visualization State” allows you to save the current state of the scene into a .vmd file. This state file contains almost all the custom scene settings. After setting up how you want your scene to look, you should save the state and use the state from now on to load the scene.

Please note that the state file DOES NOT save these following settings (there may be others):

  • Which lights are turned on in the “Display” menu.
  • The axes always defaults to on, turn off in “Display–>Axes”.
  • External Renderer Options, in “Display–>Display Settings”. This is important for Ambient Occlusion and should not be forgotten.

There are also some customization settings that are easy to edit directly in the state file. You should search for these items in the state file and change accordingly.

color Display {Background} white
Changes the background color to white. Probably want to stick with black or white for the background.

color change rgb
Near the bottom of the .vmd file, change or add custom RGB colors.

material change
Near to top of the .vmd file, change or add custom Materials.

mol representation
This allows you to change the radius of bonds and spheres more finely. Can be useful if you need a way to make one type of atom display over another type but still appear to be almost the same size.

High quality 3D rendering

3D rendering can be generated by going to: “File–>Render”

The best renderer to choose is usually Tachyon (not Tachyon Internal), since it comes with VMD and—more importantly—works with Ambient Occlusion. Please check the Ambient Occlusion section for its settings.

For “Render Command”, you should change to:
“/PATH_FOR_TACHYON/” -res xres yres -fullshade -aasamples 16 %s -format TARGA -o %s.tga

“/PATH_FOR_TACHYON/“
This is the path for Tachyon. No changes needed.

-res xres yres
This determines the final dimensions of the rendered image. The two numbers following -res are for the horizontal and vertical directions. These should have the exact same ratio as the VMD display window. Otherwise the rendered image will be stretched in some direction. You should choose the render size to be about twice the size that fits your needs. The reason will be discussed in more detail below.

-fullshade
This flag is to set the best quality shading option. Though it should be the default, I like to include it. You can also use -mediumshade, -lowshade, or -lowestshade to get faster preview renders without shadows.

-aasamples 16
This is the anti-aliasing option, the number indicates the number of supersamples taken per pixel. I recommend 16 as a minimum for final renders; for previews 0 will probably be fine. Anti-aliasing (AA) smoothes out shadows and makes the scene look much nicer. However, AA in Tachyon worsens the appearance of sharp lines and outlines (possibly due to buggy implementation). This means that you need to either render at a larger size than you need and then downscale to hide the AA artifacts, or bump up to -aasamples 64.

%s
This represents the input file (default is vmdscene.dat) Tachyon generates and reads in.

-format TARGA
The file format of the rendered raster image. TARGA is the default, which you can later convert to other formats. But you can certainly also choose to change it here to: BMP, PNG, PPM, PPM48, PSD48, or RGB.

-o %s.tga
This set the output file name (default takes the input .dat filename and adds the image extension). You should change to the appropriate extension if you have changed the -format above.

Now just click “Start Rendering” to begin the wait.

Making Animations/Movies

[ADD INFORMATION ABOUT MAKING SIMPLE MOVIES]

Examples

[ADD EXAMPLE FILES]