VMD molecular visualization software#

This file: Introduction to VMD.

Keywords: VMD, VMD Plugins, visualization, atomistic simulations

Associated material:

VMD 1UBQ

Here, we use VMD for visualization[1]. It is one of the world’s most popular visualization and analysis software for molecular systems.

What is VMD#

VMD - Visual Molecular Dynamics - is a general purpose software for 3D molecular visualization and data analysis of molecular systems. Together the NAMD simulation software, it can also be used to run interactive MD simulations and for setting up NAMD simulations. Both VMD and NAMD are developed in Theoretical and Computational Biophysics Group at the University of Illinois at Urbana-Champaign[1].

VMD was originally designed for visualization and analysis of biological systems, but it is a general purpose software that is not limited to any particular system. It can read essentially all common molecular file formats and data produced by most common software including PDB, XYZ, NAMD, Gromacs, Amber, CPMD, and it can be used to visualize and analyze data from classical, coarse-grained and quantum simulations. VMD includes a lot of various analysis tools and it has a plugin system for developers. VMD is also able to use CUDA acceleration if an NVIDIA GPU is present.

VMD in different operating systems#

VMD is available for Linux, Windows and OSX. VMD has both a GUI and a command line interface.

VMD: Basic operation#

Here, only the basic operations of VMD are reviewed. It is impossible to provide all its details as VMD has extremely feature set for both visualization and analysis. The focus here is on visualization only. The aim of the examples below is to show some of VMD’s capabilities and the demonstrate some of the features of its user interface.

Example: Visualizing human islet amyloid polypeptide#

Let’s start with a simple example. For that, we download a molecule from the PDB database. In this case, the PDB ID 5MGQ was selected. The molecule 5MGQ is an oxidized and amidated human islet amyloid polypeptide (IAPP) and it is an important molecule in diabetes II.

The structure in that file contains 20 frames and we will use the last frame. The term frame means a snapshot of the molecule. Frames can come, for example, from repeated experiments or from different times steps of a simulation. In the case of VMD, the number of frames contained in a file is indicated in the VMD Main window as will be shown in the next section where the VMD user interface is demonstrated.

The figure below shows five different representations of the molecule 5MGQ created by VMD. The figures show the same molecule form the exact same angle; nothing else has been changed except the representation, that is, coloring method, drawing method and material. What exactly these terms mean will be come apparent shortly, at this time the important thing is to see that one can convey different information by different representations. The names of the drawing methods (VMD uses these names as do many other software) are provided under each of the images.

It is also important to notice that one can very easily (and we will see how this works) overlay representations. This is illustrated in the third image from the left where two representations, new cartoon and licorice, have been overlayed. The number of ways of selecting atoms and molecules and how they are represented is extremely versatile. We will see how that works in the second example in thee next section. As it is clear from the figure, VMD can produce high-quality publication level graphics. It can also be used to render very high quality molecular movies as will be discussed later.

../../_images/vmd-rendering-example.svg

Fig. 15 Different representations of the PDB ID 5MGQ (final structure out of 20 frames)), oxidized and amidated human islet amyloid polypeptide (IAPP). This peptide is involved in the human diabetes II. Different representations are useful different purposes. From left to right: Lines with the residues show in different color, New Cartoon with coloring using secondary structure, New Cartoon and Licorice representations superposed, van der Waals, and Bonds. These and many others are available in VMD in Graphics ->  Representations. Rendering using Tachyon. Click the image to see it in high resolution.#

VMD’s user interface#

The user interface of VMD does not depend on the operating system. Starting VMD opens three windows: The VMD Main window, the Display window and VMD console. The best way to get familiar with VMD is to use it.

When VMD is started, the screen looks like below (with the exception that your Display window will have black background as I have changed mine to white in my default settings). In the examples below, the file spc216.gro that comes with Gromacs is used. If/when you have Gromacs installed, the file is located under the Gromacs installation directory in share/gromacs/top. As the name indicates, the file is in Gromacs’ .gro format and VMD knows how to read the format (as it did with the above PDB case). The file is a small box (size of 1.86206 nm as shown on the last line of the file) of 216 SPC water molecules. I strongly encourage you to download the above PDB file (5MGQ), or any other PDB file, as well as try spc216.gro once Gromacs has been installed.

Below are an example of a .gro file and a picture of the VMD opening screens.

Example of the .gro format

The output below has been extracted (5 water molecules out of 216 were selected) from the file spc216.gro that comes with Gromacs. The .gro format but during a simulation binary formats are used since they take much less space to store. If you don’t have Gromacs installed yet and hence no access to spc216.gro, you can copy and save the example below and visualize it in VMD (example is shown below). Notice that to save the date, you must use an ASCII text editor such as vi or comparable.

  • The 1st line has comments. Arbitrary information can be included and this line is ignored by analysis software. In this case is says: 5 water molecules, SPC model, temperature of 300K and box size of 1.86206.

  • The 2nd line: The total number of atoms. This information is required by the .gro format.

  • The lines starting with number and SOL: 1SOL is the 1st solvent molecule. 2SOL: second solvent molecule and so on. Each solvent/water molecule consist of three atoms: OW, HW1, HW2.

    • OW: Water oxygen

    • HW1 and HW2: Water hydrogens 1 and 2.

  • The 3rd column: Numbering of individual atoms. Each atom must have a unique identifier.

  • Columns 4-6: x, y and z coordinates in nanometers.

  • The last line: the size of the simulation box in nanometers.

For example, VMD understand this format and can read and visualize the data. Notice also that formatting is strict (column position do matter)…

5H2O,SPC-MODEL,300K,BOX(M)=1.86206
  15
    1SOL     OW    1    .230    .628    .113
    1SOL    HW1    2    .137    .626    .150
    1SOL    HW2    3    .231    .589    .021
    2SOL     OW    4    .225    .275   -.866
    2SOL    HW1    5    .260    .258   -.774
    2SOL    HW2    6    .137    .230   -.878
    3SOL     OW    7    .019    .368    .647
    3SOL    HW1    8   -.063    .411    .686
    3SOL    HW2    9   -.009    .295    .584
    4SOL     OW   10    .569   -.587   -.697
    4SOL    HW1   11    .476   -.594   -.734
    4SOL    HW2   12    .580   -.498   -.653
    5SOL     OW   13   -.307   -.351    .703
    5SOL    HW1   14   -.364   -.367    .784
    5SOL    HW2   15   -.366   -.341    .623
     1.86206   1.86206   1.86206

The output, when visualized using VMD, looks like this:

5spc
../../_images/vmd-start-annot.svg

Fig. 16 Upon opening VMD, three windows are displayed. The option Save Visualization State... is very useful as it allows one to save the visualization project and read it with Load Visualization State when restarting. Another great feature is that saved state can be used cross-platform, that is, it doesn’t matter if it was saved on a Mac, it can be used on Windows or Linux as well (file path may need to adjusted, however). The console allows one to execute commands directly. The downside with the console is that one cannot use the arrow keys to move back and forth or recall previous commands. There is, however, a remedy: Under Extensions there is the option Tk Console that has all those features.#

Load a molecule#

As the next step, the file spc216.gro was loaded (File -> New Molecule). The Display window (not shown here) first shows the molecules using Line representation; the default representation can be changed but lines are very quick to render so there is no need to change that setting.

Let’s first focus on VMD Main window and Graphical Representations. The figure below shows some of the key feature including the molecule name, the number of frames (the file spc216.gro has only one frame), the number of atoms and so on. The window Graphical Representations is opened through VMD Main -> Graphics -> Representations. That windows shows the selected molecule; here we have only one molecules but it is possible to have more although the most typical situation is to work with a single molecule. Graphical Representations.

Some of the other important features Graphical Representations include the Representations panel. Here, it shows that the Drawing Method (red circle) or Style (in the Representations panel) is Lines, Coloring Method or Color is Name and the all atoms have been selected. The buttons Create Rep and Delete Rep allows creation deletion of representations. This is also how different representations can be overlayed: Simply by creating new representations. The Material selector has the material/texture for representation. In addition there are the tabs Draw style (the currently selected one) , Selections (it has the keywords and keys for selecting atoms and molecules by different criteria), Trajectory (when one has multiple frames especially for movies and analysis, this tab has update options for the frames)) and Periodic (allows selection of periodic images of the system).

../../_images/vmd-representations-annot.svg

Fig. 17 The VMD Main window and Graphical Representations (under Graphics). Some of key features are indicated. The Drawing Method selector has been opened to demonstrate the different methods for representing molecules. In the above figure showing 5MGQ, lines, new cartoon, licorice, van der Walls (VDW) and bonds were used. Coloring allows to emphasize, for example, atoms, groups or structures. In the 5MGQ, the second image from the left used New Cartoon as the Drawing Method and Secondary Structure as the Coloring Method. The Selections tab shows the different standard selections.#

Representations and rendering#

Now that we have a better understanding of how to load a molecules/molecules and the interface, let’s take a more detailed look into representations and discuss rendering (=how save images on the disk). The figure below shows the VMD Main window, Graphical Representations, File Render Controls (accessible under VMD Main -> File -> Render) and the system in the Display window.

Here, we have overlayed representations. The different representations are listed in Representations panel. Two different arbitrary residues have been selected and they are represented using different styles and coloring methods. The rest of the molecules are show using CPK representation; the name CPK comes from the creators of this model, Robert Corey, Linus Pauling and Walter Koltun.

To save the figure, one has to render it. VMD has different methods for rendering. The most basic one is the one that is open in the File Render Controls window: The snapshot method. This method does exactly what the name suggests: It takes an exact snapshot of the Display window. There are no controls for resolution - it is determined by the window size. This method offers a quick way to create figures, but the quality is not good enough for publications.

High-quality figures require a different rendering method, such as Tachyon that is available from the selector.

More on the topic:

../../_images/vmd-render-annot.svg

Fig. 18 Main, rendering, graphics and display window with some of the important issues indicated. In particular, pay attention to the Selection panel and how the selections are shown in the Display window. The axes have been turned off from Display -> Axes and the background has been changed from black to white from Graphics -> Colors -> Display -> Background -> Colors.#

Image rendering practicals#

VMD supports a large number of high-quality rendering methods including Tachyon (comes with VMD) and povray (installation of PovRay is required for that).

One important point with the different rendering methods is that they use ray tracing and thus the basic rendering on screen may (and typically does) look different than the final high-resolution picture saved into a file. This simply means that one has to find the proper settings for a given system, simply by trying out the different options. High resolution rendering may also take significant amount of time as the process is computationally intensive.

Summary of the above and some additional practical points:

  • The screen capture mode for rending gives exactly what is on the screen including the screen size. That is, the screen size determines the resolution. Thus, for high quality publication level images, other methods have to be used.

  • Graphics -> Representations -> Material: The choice of material has a significant effect on rendering in the high quality rendering modes (=other than screen capture). Importantly, the ray tracing methods like Tachyon and PovRay produce significantly different output as compared to the screen display.

  • Pay attention to the resolution for objects such as bonds and spheres when rendering. The settings are in Graphics -> Representations

  • Lights can be adjusted under Display -> Lights: There are 4 options

  • For the high quality rendering options using ray tracing methods (such as Tachyon and PovRay), the options under Display setting -> Ray tracing options should be adjusted as necessary.

  • Under Display, there are several important options such as using Perspective and Orthographic view. The latter is often the most suitable.

Rendering with Tachyon#

Below are quick instructions for high quality images when using Tachyon rendering. As discussed above, the end result will be different from what one sees on the screen so it is good to try different options for Materials, lights and shadows and one should always ensure that the resolution of the objects is high enough (the default setting is not). The following options work in many cases:

Display -> Rendermode -> GLSL
Display --> Display Setting --> Shadow ON, Ambient Occl. ON

For materials, the following seems to work quite well with Tachyon:

EdgyShiny, Glass2, AOSHiny, AOEdgy

When selecting the rendering method: The following options after the render command work well. Adjust the resolution appropriately, the lines below are examples that produce large (1024 x 1024 px) high quality pictures. Increasing the value of -aasamples and using -auto_skylight add to rendering time.

-aasamples 2 %s -add_skylight 0.7 -format TARGA -res 1024 1024 -o %s.tga
-aasamples 2 -fullshade %s -format TARGA -o %s.tga

Currently, Tachyon rendering can produce the following three formats: TARGA, PSD48 (photoshop) and BMP. The common JPEG and PNG do not work.

More on selections#

In addition to using the readily available options from the Selections tab, VMD has also other very powerful methods for selections. One can use, distance from a given atom (or other unit), coordinates, masses, charges and so on. The figure shows and example of distance based selection. Note also that one can activate and deactivate representations but double-clicking them - in the figure, the selection indicated in red has been deactivated.

Important: When making movies using distances or coordinates for selections, it is imperative to select

Graphical Representations -> Trajectory -> Update Selection Every Frame

If not selected, the selection criterion/criteria will use the starting frame as the reference with no updates. This applies to movies (both on screen and rendered) only and has no effect on static images.

../../_images/vmd-selections-annot.svg

Fig. 19 The figure shows the use distance based selection. Note that VMD uses Ångströms for distances (Gromacs uses nanometers). The central molecules and the ones within 8 Å are shown with different materials and colors.#

Properties of a selected atom#

Choosing

VMD Main -> Mouse -> Query

allows one the query the properties of any atom by clicking on them. The properties as shown in the VMD console window. Several other useful options are available under the Mouse menu.

../../_images/vmd-query-annot.svg

The VMD console window show the properties of the selected atom. The properties use the same keywords as the selection menu and Graphical Representations.

Data analysis#

The above focused on visualization. VMD has a wide range of built-in tools for data analysis and a plugin framework that allows users to develop their own analysis tools. We won’t cover data analysis here. One matter is, however, worth pointing out: VMD has no preset limit for the length of a trajectory. The only limitation is available memory.

Scripting and extensions#

VMD also offers a very powerful scripting interface using Tcl/Tk and this is the method for developing analysis tools. VMD It has also an interface to PLUMED collective variable analysis (requires separate installation of PLUMED). Besides reading all the major file formats, VMD has plugins for experimental data. These include MDFF for Cryo-EM data and others.

More features#

  • VMD has some NAMD-specific tools for setting up molecular simulations.

  • VMD has an interface for reading PDB entries by accession number directly from the PDB database. Read more background information about the PDB database.

  • VMD also has an interface to APBS (Adaptive Poisson Boltzmann Solver) for calculations of continuum electrostatics.

  • VMD has a toolkit for force field parameterization called Force Field Toolkit plugin (ffTK)

Note that many of the plugins require installation of additional software or/and libraries.

PDB database downloads#

VMD has the capability to download PDB files directly from the PDB database. Note, however, that version 1.9.3 appears to have a problem with this feature. The ability to download has been fixed in the 1.9.4-alpha41 versions (at this time there is no stable release of 1.9.4; the alpha51 works on MacOS Catalina and Linux, but crashes on Windows 10).

This feature is available under

Extensions -> Data -> PDB Database Query

The PDB database is available at

Movies with VMD#

This topic will covered when we have trajectory data from simulations.

Customizing VMD#

Initial settings can be easily changed from

Extensions -> VMD Preferences

Change to according to your preference if needed and save the by clicking Write Settings to VMDRC. For example, my preferences are white background and orthographic viewing.

The Tcl/Tk command shell#

VMD uses the Tcl/Tk language and shell for scripting. Scripting allows automatization of tasks and more detailed analysis of properties but we won’t cover the topic here. Tcl stands for Tool Command Language and Tk is the graphical user interface toolkit for Tcl. Tcl/Tk is supported across the different operating systems (Windows, Linux, OSX).

Bibliography#

1(1,2)

William Humphrey, Andrew Dalke, and Klaus Schulten. VMD: visual molecular dynamics. J. Mol. Graph., 14(1):33–8, 27–8, February 1996. doi:10.1016/0263-7855(96)00018-5.