Creating publication-ready images with VMD

Rasmus Kronberg, Application Specialist
Spring School in Computational Chemistry 26–28.4.2023

VMD (Visual Molecular Dynamics)

  • VMD is a molecular visualization program for displaying, animating and analyzing large biomolecular systems using 3D graphics and built-in scripting
    • Freely available (requires registration) for Linux, MacOS & Windows
  • Developed by Theoretical & Computational Biophysics Group at the University of Illinois
  • https://www.ks.uiuc.edu/Research/vmd/
  • This will be a very brief intro, more tutorials available at http://www.ks.uiuc.edu/Training/Tutorials/

High-quality rendering using the Tachyon ray tracer

Type-along: Starting VMD

  • Assuming you’ve already installed VMD, click the VMD icon (Windows, MacOS) or launch vmd from the terminal (Linux)
    • On Dogmi workstations you need to add VMD to your $PATH:
    $ export PATH=/home/cscuser/vmd/bin:$PATH
    $ vmd
    • Now you can launch vmd without typing the full path to the binary

Tweaking the startup configuration

  • Colors and appearance can be adjusted under “Graphics” and “Display”
    • White background typically nicer for publications, remove axes
  • Configuration can be saved into a startup file .vmdrc
    • “Extensions” > “VMD Preferences”
    • Loaded upon startup (searched in current, home and install directories)

Example 1: Small protein in water

  • VMD supports tens of different file formats
  • Download a small protein structure file (wget or open URL in browser)
$ wget https://a3s.fi/CSC_training/protein.gro
  • Open in VMD: “File” > “New Molecule” > “Browse” > “Load”
  • Rotate the molecule:
    • Left click for free rotation, right click around viewing axis
    • Other possibilities (translate/scale): “Mouse”
    • Reset view with “=”
  • Atoms and bonds can be also be measured, moved and deleted
    • Deleting bonds might be handy if bonds stretch across PBC

Representations 1

  • Default representation is “Lines”, which is perhaps not that clear
  • “Graphics” > “Representations”, explore the different options
    • You can create multiple representations for different parts (selections) of your system (see “Selections” tab for hints)
    • Different materials, colors and drawing methods available

Representations 2

  • Try creating three representations, one with selection “protein” (or “not solvent”), one with “solvent and within 10 of protein”, and one with “ions”
    • “Create Rep”, type in “Selected Atoms”
  • Play with different draw styles, e.g.:
    • Protein: “Secondary Structure”, “Opaque”, “NewCartoon” (change “Display” > “Rendermode” > “Acrobat3D” if buggy)
    • Solvent: “Element”, “Transparent”, “QuickSurf” (try different resolutions)
    • Ions: “ColorID 7”, “Opaque”, “VDW”

Custom materials

  • Create a material of your own!
    • “Graphics” > “Materials” > “Create New”
  • Copy the example to the right →
    • Ambient 0.30
    • Diffuse 0.50
    • Specular 0.87
    • Shininess 0.85
    • Opacity 0.11
    • and rest 0

Rendering high-quality images 1

  • Now let’s render a nice picture of our system
    • Add another representation for the protein using the previous custom material
    • For clarity, lets toggle off the solvent
  • Go to “File" > ”Render"
    • Render using the Tachyon engine (select from dropdown menu)
    • Add -res 1000 1000 to “Render Command” to increase resolution to 1000x1000 px
    • Press “Start Rendering”

Rendering high-quality images 2

We got a nice picture, but can we make it even better?

  • Go to “Display” > “Display Settings” and toggle on “Shadows” and "Amb. Occl." under “Ray Tracing Options”
  • Change ions and protein materials to “AOShiny” for a material with good AO compatibility
  • Render the view as previously (this will now take a bit longer, decrease resolution for faster results)
  • Convert output to .png or .jpg if needed (use e.g. convert on Linux):
$ convert vmdscene.dat.tga protein.png

Example 2: Ruthenium bipyridyl complex on a TiO2 surface

  • VMD can be used to visualize .cube files as well (e.g. densities, orbitals)
  • Let’s visualize bond-induced electron density differences of a ruthenium bipyridyl complex on a TiO2 surface
  • Go to https://a3s.fi/CSC_training/surface.cube or download the structure with wget
$ wget https://a3s.fi/CSC_training/surface.cube
  • Open the file in VMD

Representations 3

  • Create separate representations for the surface and the adsorbed complex
    • Try selections “z < 20” and “z > 20”
    • CPK is a good option for the drawing style
  • Create two more representations with selection “all”
    • Use “Isosurface” drawing method with settings:
      • Isovalue: -0.003 and 0.003 with ColorIDs 0 (blue) and 1 (red)
      • Draw: Wireframe
      • Show: Isosurface
  • Explore the structure, where can you see increase/decrease in electron density?

Rendering high-quality images 3

  • Change “Wireframe” to “Solid Surface” and the material of the isosurfaces to the custom material created in the previous example
  • Turn on shadows and ambient occlusion lighting under “Display Settings” and render the view as previously
    • Again, this might take a while, decrease resolution for faster results

Your turn!

  • Continue playing around with the lysozyme or ruthenium bipyridyl structures
  • Or try something else (download with wget or browser):
$ wget https://a3s.fi/CSC_training/pcbm.xyz  # PCBM molecule
$ wget https://a3s.fi/CSC_training/dna.pdb  # DNA dodecamer

What next?

  • Animations and movies
  • Analyses and extensions
  • Scripting

Thanks for your attention!

Rasmus Kronberg

Application Specialist, D.Sc. (Tech.)
CSC – IT Center for Science Ltd.
rasmus.kronberg@csc.fi