Visualizing Molecules with VMD

VMD is a powerful tool for visualizing and analyzing complex molecules like proteins. Below are walkthroughs of some features. See also this convenient manual.

VMD basics

  • Download PDB file for the molecule you want to visualize
  • Choose File → New Molecule
  • Set Load files for: to New Molecule
  • Browse for PDB file & click Load
  • Choosing Graphics → Representations allows you to visualize the protein differently
    • To create new visual representations click 'Create Rep'
    • Filters may be applied in the Selected Atoms window.
      • Examples: all, helix, alpha, alpha and index>1000, waters and vol0>0.5, etc.

Visualizing electrostatics

  • Create a potential map
    • Convert PDB file to a PQR file which includes per atom charge information
      • The conversion can be done online here: Online PDB2PQR. Or locally from here: Local PDB2PQR.
      • Type in PDB # or upload PDB file
      • Choose PARSE for force field
      • Choose the internal naming scheme
      • Use PROPKA to assign a pH value for the environment
      • The output filetype is .pqr
      • Look at .pqr file header to check for any errors
        • PDB2PQR is very picky about what residue codes are used in the PDB files. If an error occurred the offending residues may need to be renamed in the PDB file or a .mol2 file needs to be supplied to PDB2PQR so it knows how to deal with them. Some residues can be built and have .mol2 files generated by PRODRG.
    • Run the Applied Poisson-Boltzmann Solver (APBS)
      • Method 1: run APBS as a plug in from VMD
        • In VMD choose Extensions → Analysis → Electrostatics
        • Edit calculation
          • Note: the number of grid points needs to be a dime allowable value, you can't set these to whatever value you want. Allowable values include 65+32*i where i is an integer.
        • Choose which equation to solve
          • Note: the linear Poisson-Boltzmann equation is easier to solve but maybe less accurate?
        • Run APBS
          • Note: If you get an error that says 'output file missing or unreadable' it is probably because there are spaces in the path to the output file. Choose Output → Settings and make sure there are no spaces in the path. Also make sure that there are no spaces in the .pqr filename that you're inputting.
      • Method 2: run APBS from the command line. This method is a little more flexible, and avoids bugs associated with the VMD plug in.
        • Generate an APBS input file (extension .in).
          • This can be done manually or with VMD's plug-in (even if the plug-in is misbehaving, it might still output a good APBS input file that you can run at the command line).
          • To generate the input file with VMD select EditSettings in the APBS Tool window.
          • Check the box labeled 'Setup files only, do not run APBS'
          • Edit the calculation settings as normal and run APBS from VMD
          • Locate the output .in file
          • From DOS run:
            working_directory\APBS\APBS.exe working_directory\
          • Locate the potential map file APBS made (extension .dx)
          • To visualize the potential map in VMD: select FileNew Molecule and load the .dx potential map onto the molecule for which it was created.
  • Visualize the potential map
    • Choose Graphics → Representations
    • Option 1: Isosurfaces
      • Create a representation & choose Isosurface for the Drawing Method
      • Choose isosurface value (units are kT/e (= 25 mV at room temperature))
      • Make this be a blue, positive surface (+ kT/e)
      • Repeat same procedure except making a red, negative surface (- kT/e)
    • Option 2: Surface potential map
      • Create a representation & choose Surf for the Drawing Method
      • Choose Volume for the Coloring Method
        • Make sure you select which volume map to color with in the pulldown menu to the right
      • In the Trajectory tab set the Color Scale Data Range.
        • Units are kT/e

Calculating the charge on a structure

  • When you create a pqr file from a pdb file the total charge on the protein is output in the remarks at the top of the pqr file.
  • The charge on each atom is stored in the second column from the right in the pqr file. To find the charge of an arbitrary segment of the protein simply sum up the the atom's charges that make up the segment.
  • Oftentimes the charge on each domain of a protein is interesting. Under the Sequence Details tab in a protein's page in the Protein Database the residue numbers of the protein are divided into domains.

Measuring the potential at an atom

Note: There's probably a convenient command that would simplify this but I don't know it (yet).

  • Choose an atom & record it's index number: xxxx
    • 'query' an interesting atom by pressing '0' & clicking on the atom
  • Create a new representation
    • Use Drawing Method: VDW
    • In the selected atoms box type: index=xxxx and vol0>-500 and vol0<500
    • The point will be displayed if the potential is between -500 kT/e and 500 kT/e. Close in these values until the point disappears & you'll know the potential there.

Aligning a section of two molecules

  • Give the molecule to be moved a new name in the vmd console window
    • set newname [atomselect n “all”]
      • Where n is the molecule ID number (found in the VMD Main window)
  • The protein backbone alpha-carbons probably don't move a lot between the two molecules. So select them using the two commands
    • set alpha1 [atomselect n “alpha”]
    • set alpha2 [atomselect m “alpha”]
      • Where m is the second molecule's ID number
      • If the backbones DO move a lot between the two molecules modify the part of the command in parenthesis to specify the part that you want to align. i.e. “ alpha and index>1054
  • Both groups of atoms must have the same number of atoms. Verify this using
    • $alpha1 num
    • $alpha2 num
  • Calculate a best fit transformation matrix & call it M
    • set M [measure fit $alpha1 $alpha2]
  • Use M to move your molecule
    • $newname move $M

Other movements of molecules

  • To move arbitrarily you can follow the general directions in the above 'Aligning a section of two molecules' section, except use a different transformation matrix M . For example, to rotate 90 degrees around the z-axis:
    • set newname [atomselect n “all”]
    • set M [transaxis z -90]
    • $newname move $M

Loading/saving coordinates and volume maps into a molecule

The x,y,z coordinates & orientation of a molecule may be saved:

  • Select File → Save Coordinates…
  • Save the file
    • Choose the file extension you want

Volume maps created by APBS can be saved so the calculation doesn't need to be redone every time you need it

  • Find the .dx file APBS creates in /usr/tmp/ & copy it to a safe place.
  • To find the the file sort the folders according to modification date & look for a recent one starting with APBS

To load saved coordinates & orientation or a volume map (an old APBS calculation say) into a molecule:

  • Load a molecule into VMD
  • Select File → New Molecule
  • Next to Load files for: choose your molecule
  • Browse for the volume map you want loaded
  • Click Load

Creating a potential difference volume map

  • Find PDB numbers for two conformations of the same molecule
  • Create PQR files from both PDB files
  • Load both PQR files into VMD
  • Align a section of both molecules
    • It would be worthwhile to save this alignment
  • Run APBS for both molecules
    • Important: make sure both volume map options are identical with regards to origin, fine grid options, number of gridpoints, etc. Verify this by clicking Edit in the APBS Tool window.
  • Copy the .dx volume map files APBS just created into home folder
    • Default location: /usr/tmp/ . Organize files by modification date & look for folders starting with APBS
  • Subtract one volume map from the other using the program volumer (Volumer is an in-house program for doing 3D potential map subtractions. If you stumbled on this wiki from the abyss of the internet and are interested in obtaining a free copy we'd be happy to share. Contact Landon Prisbrey (
    • In a terminal window run the program by typing /home/landon/volumer
    • The program will ask for both filenames, preform the subtraction, & output a file: filename1-filename2.dx
    • The footer of the new .dx file might be missing. If so, just copy-paste the footer from one of the .dx files used to create it
  • Load the new volume map into VMD.

Creating aesthetically pleasing PR images

  • Good colors:
    • violet: red 52 green 53 blue 50
    • green: red 64 green 82 blue 71
    • tan: red 82 green 71 blue 55
  • Good Representation combo (backbone=violet, sidechain=green, Oxygens=tan spheres):
    • Licorice violet backbone
    • Licorice green sidechain
    • VDW tan name “O.*”^J
  • Good representation combo (random):
    • Licorice violet backbone
    • Licorice green sidechain or name “CA”
    • VDW tan sphere scale=0.9
    • Licorice green sheet
    • Licorice green coil
  • Load everything up and choose 'diffuse' for the material type
  • Render image as a tachyon filename.dat file
  • In a terminal window add ambient occlusion lighting with the command
    • LINUX: /usr/local/lib/vmd/tachyon_LINUXAMD64 -rescale_lights 0.4 -add_skylight 0.7 filename.dat -o newfilename.tga -aasamples 8
    • Windows 7: “C:\Program Files (x86)\University of Illinois\VMD\tachyon_WIN32” -rescale_lights 0.4 -add_skylight 0.7 c:/inputfilename.dat -o c:/outputfilename.tga -aasamples 8
  • It will take a long time to render. To do test renders add -res xxx yyy before -rescale_lights to specify a smaller xxx by yyy resolution. This can also be used to make extra large resolution images!
  • see VMD's Tachyon tutorial for information on this command and how to modify it

QR Code
QR Code vmd (generated for current page)