Skip to content

VMD 2.0 - Visual Molecular Dynamics

Version: 2.0.0a7 (alpha release) Installation: /sw/vmd/vmd-2.0.0a7 Module: vmd/2.0 License: Free for non-commercial use


Overview

VMD (Visual Molecular Dynamics) is a molecular visualization and analysis program designed for displaying, animating, and analyzing large biomolecular systems using 3D graphics and built-in scripting. VMD is developed by the Theoretical and Computational Biophysics Group at the University of Illinois.

Key Features: - Interactive 3D molecular graphics and rendering - Molecular dynamics trajectory analysis - Support for 100+ molecular file formats - Advanced rendering (ray tracing with Tachyon/POV-Ray) - Extensible via Tcl/Python scripting - Built-in analysis tools for MD simulations - Plugin architecture for additional functionality - Publication-quality image and video generation - GPU-accelerated visualization


Quick Start

Loading the Module

module load vmd/2.0

Launching VMD

# Start VMD with GUI
vmd

# Load a structure
vmd protein.pdb

# Load structure and trajectory
vmd protein.pdb trajectory.dcd

# Load multiple files
vmd protein.pdb -dcd traj1.dcd -dcd traj2.dcd

# Text mode only (no GUI)
vmd -dispdev text -e script.tcl

# Run script on startup
vmd -e analysis.tcl

Main Components

1. Main Window - File and Molecule Management

  • Load and save molecules
  • Molecule list and management
  • Display settings
  • Rendering controls

2. OpenGL Display Window - 3D Visualization

  • Interactive molecular graphics
  • Mouse controls for rotation/zoom/translation
  • Picking atoms and molecules
  • Real-time rendering

3. Graphical Representations

# Change representation
mol representation NewCartoon
mol color Structure
mol selection "protein"
mol material Opaque
mol addrep 0

Common representations: - Lines, Bonds, DynamicBonds - CPK, VDW, Licorice - Cartoon, NewCartoon, NewRibbons - Surf, MSMS, QuickSurf - Isosurface (for volumetric data)

4. Extensions Menu

  • Analysis tools
  • Visualization plugins
  • Simulation setup tools
  • Data plotting

File Formats

VMD supports extensive file formats:

Category Formats
Structure PDB, PSF, MOL2, GRO, XYZ, CIF
Trajectory DCD, XTC, TRR, NetCDF, AMBER, CHARMM
Volume CUBE, DX, MRC, CCP4, SPIDER
Graphics PDB, STL, OBJ, VRML, POV-Ray, Tachyon

Loading Files

# Load structure
mol new protein.pdb

# Add trajectory to existing molecule
mol addfile trajectory.dcd waitfor all

# Load with specific file type
mol new data.gro type gro

# Load multiple trajectories
mol new protein.pdb
mol addfile traj1.xtc type xtc waitfor all
mol addfile traj2.xtc type xtc waitfor all

Common Workflows

Basic Visualization

# Load and visualize protein
vmd protein.pdb

# In VMD console:
mol modstyle 0 0 NewCartoon
mol modcolor 0 0 Structure
mol modmaterial 0 0 Opaque

Trajectory Analysis

# Load MD trajectory
vmd system.pdb trajectory.dcd

In VMD: 1. Graphics → Representations 2. Create representations for different selections 3. Extensions → Analysis → RMSD Trajectory Tool 4. Extensions → Analysis → Timeline

RMSD Calculation

# RMSD of protein backbone
set sel [atomselect top "protein and backbone"]
set ref [atomselect top "protein and backbone" frame 0]

set nframes [molinfo top get numframes]
set rmsd {}

for {set i 0} {$i < $nframes} {incr i} {
    $sel frame $i
    $sel move [measure fit $sel $ref]
    lappend rmsd [measure rmsd $sel $ref]
}

# Save RMSD to file
set outfile [open "rmsd.dat" w]
for {set i 0} {$i < [llength $rmsd]} {incr i} {
    puts $outfile "$i [lindex $rmsd $i]"
}
close $outfile

RMSF (Root Mean Square Fluctuation)

# Calculate RMSF per residue
set sel [atomselect top "protein and name CA"]
set rmsf [measure rmsf $sel]

# Write to file
set outfile [open "rmsf.dat" w]
set resids [$sel get resid]
foreach res $resids val $rmsf {
    puts $outfile "$res $val"
}
close $outfile

Distance Measurements

# Distance between two atoms
set sel1 [atomselect top "resid 10 and name CA"]
set sel2 [atomselect top "resid 50 and name CA"]

set nframes [molinfo top get numframes]
set outfile [open "distance.dat" w]

for {set i 0} {$i < $nframes} {incr i} {
    $sel1 frame $i
    $sel2 frame $i
    set coord1 [lindex [$sel1 get {x y z}] 0]
    set coord2 [lindex [$sel2 get {x y z}] 0]
    set dist [vecdist $coord1 $coord2]
    puts $outfile "$i $dist"
}
close $outfile

Hydrogen Bonds Analysis

# Count hydrogen bonds over trajectory
package require hbonds

set sel1 [atomselect top "protein"]
set sel2 [atomselect top "resname LIG"]

set nframes [molinfo top get numframes]
set outfile [open "hbonds.dat" w]

for {set i 0} {$i < $nframes} {incr i} {
    molinfo top set frame $i
    set hb [measure hbonds 3.5 30 $sel1 $sel2]
    set num [llength [lindex $hb 0]]
    puts $outfile "$i $num"
}
close $outfile

Salt Bridges

# Find salt bridges
set acidic [atomselect top "resname ASP GLU and name OD1 OD2 OE1 OE2"]
set basic [atomselect top "resname LYS ARG and name NZ NH1 NH2"]

set pairs [measure contacts 3.2 $acidic $basic]
puts "Salt bridges: [llength [lindex $pairs 0]]"

Secondary Structure Analysis

# Assign secondary structure (STRIDE)
mol ssrecalc top

# Count secondary structure elements
set sel [atomselect top "protein"]
$sel frame 0
set ss [$sel get structure]

# Count helices and sheets
set helix [llength [lsearch -all $ss "H"]]
set sheet [llength [lsearch -all $ss "E"]]
puts "Helix: $helix, Sheet: $sheet"

Solvent Accessible Surface Area (SASA)

# Calculate SASA
set sel [atomselect top "protein"]
set nframes [molinfo top get numframes]
set outfile [open "sasa.dat" w]

for {set i 0} {$i < $nframes} {incr i} {
    $sel frame $i
    set sasa [measure sasa 1.4 $sel]
    puts $outfile "$i $sasa"
}
close $outfile

Selections

VMD's atom selection language is powerful:

# Basic selections
protein                    # All protein atoms
nucleic                    # DNA/RNA
water                      # Water molecules
resname LIG                # Residue named LIG
resid 10 to 50            # Residues 10-50
name CA                    # Atoms named CA

# Boolean operators
protein and backbone       # Protein backbone
protein or nucleic         # Protein or nucleic acids
not water                  # Everything except water

# Geometric selections
within 5 of resid 10      # Within 5Å of residue 10
same residue as within 5 of protein  # Residues within 5Å

# Advanced selections
protein and beta > 1.0    # High B-factor regions
occupancy < 1.0           # Partially occupied atoms
chain A and resid 1 to 100  # Chain A, residues 1-100

Rendering High-Quality Images

Tachyon Ray Tracing

# Set rendering options
display projection Orthographic
display depthcue off
axes location Off
color Display Background white

# Adjust view
scale to 0.8
rotate x by 20
rotate y by 30

# Render with Tachyon
render Tachyon output.tga

Ray tracing from command line

# Create Tcl script with desired view
vmd -dispdev text -e render_setup.tcl

# In render_setup.tcl:
# mol new protein.pdb
# mol modstyle 0 0 NewCartoon
# render Tachyon output.tga "/sw/vmd/vmd-2.0.0a7/lib/tachyon_LINUXAMD64" -aasamples 12 %s -format TARGA -res 1920 1080 -o %s.tga

Creating Movies

# Movie plugin
Extensions → Visualization → Movie Maker

# Or via script:
movie maker $filename -format mpeg -trjframe 0

Tcl Scripting

VMD uses Tcl as its scripting language:

Basic Script Structure

#!/usr/bin/env vmd -dispdev text -e

# Load molecule
mol new protein.pdb
mol addfile trajectory.dcd waitfor all

# Perform analysis
set sel [atomselect top "protein and backbone"]
set nframes [molinfo top get numframes]

for {set i 0} {$i < $nframes} {incr i} {
    $sel frame $i
    # Do analysis
}

# Exit
quit

Running Scripts

# Interactive mode
vmd -e script.tcl

# Batch mode (no GUI)
vmd -dispdev text -e script.tcl

# From command line
vmd < script.tcl > output.log

Python Interface (Optional)

VMD can be compiled with Python support:

# Example Python script for VMD
from VMD import *
from atomsel import *

# Load molecule
mol_id = molecule.load('pdb', 'protein.pdb')

# Selection
sel = atomsel('protein and backbone', molid=mol_id)

# Analysis
print(f"Number of atoms: {sel.num()}")

Plugins

  • Timeline: Visualize MD trajectory properties over time
  • RMSD/RMSF Tools: Calculate structural deviations
  • Hbonds: Hydrogen bond analysis
  • Saltbr: Salt bridge identification
  • NAMD Energy: Energy analysis for NAMD simulations
  • QwikMD: NAMD simulation setup
  • Membrane Builder: Create membrane systems
  • Solvate: Add water box
  • Autoionize: Add ions
  • Psfgen: Generate PSF files

Using Plugins

# Load plugin
package require plugin_name

# Example: Timeline
Extensions → Analysis → Timeline

# Example: QwikMD
Extensions → Simulation → QwikMD

Integration with MD Engines

GROMACS Trajectories

module load vmd/2.0
module load gromacs/2025.0

# Load GROMACS files
vmd system.gro trajectory.xtc

NAMD Analysis

# Load NAMD simulation
mol new system.psf
mol addfile output.dcd

# Extensions → Analysis → NAMD Plot
# Load NAMD log file for energy analysis

AMBER Trajectories

# Load AMBER files
vmd system.prmtop trajectory.nc

# Or in Tcl:
mol new system.prmtop
mol addfile trajectory.nc type netcdf waitfor all

CHARMM Files

mol new protein.psf
mol addfile protein.dcd

Environment Variables

Variable Purpose
VMDDIR VMD installation directory
VMD_PLUGIN_PATH Plugin directory path
VMDSCRATCHDIR Temporary file directory
VMDNOCUDADEVICES Disable CUDA (if causing issues)

Tips and Best Practices

  1. Performance: Use QuickSurf for large systems instead of MSMS
  2. Memory: Large trajectories can consume significant RAM
  3. Smooth Trajectories: Use pbc wrap for periodic boundary conditions
  4. Batch Processing: Use -dispdev text for scripts without GUI
  5. Selections: Save complex selections: atomselect macro mysel "protein and resid 10 to 50"
  6. Plugins: Explore Extensions menu for powerful analysis tools
  7. Coloring: Use ColorID for publication consistency
  8. Materials: AOShiny and AOChalky for better rendering
  9. Save State: File → Save Visualization State

Common Tasks Reference

Quick Visualization Setup

# Professional visualization
color Display Background white
axes location Off
display projection Orthographic
display depthcue off

# Protein cartoon
mol modstyle 0 0 NewCartoon
mol modcolor 0 0 Structure
mol modmaterial 0 0 AOShiny

# Add ligand
mol addrep 0
mol modselect 1 0 "resname LIG"
mol modstyle 1 0 Licorice
mol modcolor 1 0 Name
mol modmaterial 1 0 Opaque

Trajectory Alignment

# Align trajectory to first frame
set ref [atomselect top "protein and backbone" frame 0]
set sel [atomselect top "protein and backbone"]

set nframes [molinfo top get numframes]
for {set i 0} {$i < $nframes} {incr i} {
    $sel frame $i
    set trans_mat [measure fit $sel $ref]
    set all [atomselect top "all" frame $i]
    $all move $trans_mat
}

PBC Wrapping

# Wrap molecules for better visualization
package require pbctools
pbc wrap -center com -centersel "protein" -compound residue -all

Troubleshooting

Graphics Issues

# Software rendering (if OpenGL fails)
vmd -opengl

# Check OpenGL version
glxinfo | grep "OpenGL version"

# Disable CUDA
export VMDNOCUDADEVICES=1
vmd

Memory Issues

# Load only every Nth frame
mol addfile trajectory.dcd first 0 last -1 step 10 waitfor all

# Delete frames to free memory
animate delete beg 0 end 1000 skip 0 0

File Loading Problems

# Specify file type explicitly
mol new data.gro type gro

# Check if file is loaded
molinfo list

# Troubleshoot trajectory
mol addfile traj.dcd waitfor all molid 0

Plugin Issues

# Check plugin path
echo $VMD_PLUGIN_PATH

# Manually set plugin path
export VMD_PLUGIN_PATH=/sw/vmd/vmd-2.0.0a7/plugins/LINUXAMD64/molfile

Cluster Usage

Interactive Visualization on Cluster

# SSH with X11 forwarding
ssh -X user@xlence

# Load module and start VMD
module load vmd/2.0
vmd protein.pdb

Batch Analysis Jobs

Example Slurm script:

#!/bin/bash
#SBATCH --job-name=vmd_analysis
#SBATCH --cpus-per-task=1
#SBATCH --mem=8G
#SBATCH --time=2:00:00

module load vmd/2.0

# Run VMD in text mode
vmd -dispdev text -e analysis.tcl > analysis.log 2>&1

Large Trajectory Processing

#!/bin/bash
#SBATCH --job-name=vmd_rmsd
#SBATCH --cpus-per-task=1
#SBATCH --mem=32G
#SBATCH --time=12:00:00

module load vmd/2.0
module load gromacs/2025.0

# Analysis script
vmd -dispdev text << EOF
mol new system.gro
mol addfile trajectory.xtc waitfor all

# RMSD calculation
source rmsd_calc.tcl

quit
EOF

Documentation and Resources

  • Local Documentation: $VMDDIR/doc/
  • Official Website: https://www.ks.uiuc.edu/Research/vmd/
  • User's Guide: https://www.ks.uiuc.edu/Research/vmd/current/ug/
  • Tutorials: https://www.ks.uiuc.edu/Training/Tutorials/
  • Mailing List: https://www.ks.uiuc.edu/Research/vmd/mailing_list/
  • Script Library: https://www.ks.uiuc.edu/Research/vmd/script_library/

Quick Access

# View documentation
firefox $VMDDIR/doc/ug.pdf &

# Example scripts
ls $VMDDIR/scripts/

# Plugin documentation
ls $VMDDIR/plugins/

Common Visualization Examples

Protein-Ligand Complex

# Protein as cartoon
mol modstyle 0 0 NewCartoon
mol modcolor 0 0 Structure
mol modselect 0 0 "protein"

# Ligand as sticks
mol addrep 0
mol modstyle 1 0 Licorice
mol modcolor 1 0 Name
mol modselect 1 0 "resname LIG"

# Binding site residues
mol addrep 0
mol modstyle 2 0 Licorice
mol modcolor 2 0 ResType
mol modselect 2 0 "protein within 4 of resname LIG"

# Hydrogen bonds
mol addrep 0
mol modstyle 3 0 HBonds
mol modcolor 3 0 Name
mol modselect 3 0 "protein within 4 of resname LIG or resname LIG"

Membrane-Protein System

# Protein
mol modstyle 0 0 NewCartoon
mol modselect 0 0 "protein"
mol modcolor 0 0 Structure

# Membrane
mol addrep 0
mol modstyle 1 0 Lines
mol modselect 1 0 "resname POPC POPE"
mol modcolor 1 0 Name

# Water (transparent)
mol addrep 0
mol modstyle 2 0 QuickSurf
mol modselect 2 0 "water"
mol modcolor 2 0 ColorID 23
mol modmaterial 2 0 Transparent

Sample Data

VMD includes sample data for testing:

# Sample proteins
ls $VMDDIR/proteins/

# Example structures
ls $VMDDIR/examples/

Support

For technical support and questions: - VMD Mailing List: https://www.ks.uiuc.edu/Research/vmd/mailing_list/ - VMD Documentation: https://www.ks.uiuc.edu/Research/vmd/current/docs.html - Cluster Admin: Contact cluster administrators for module-specific issues


  • schrodinger/2025-3 - Molecular modeling with Maestro visualization
  • moe/2024 - Molecular Operating Environment
  • gromacs/2025.0 - Molecular dynamics (trajectory generation)
  • namd/3.0 - NAMD molecular dynamics
  • amber/24 - AMBER molecular dynamics

Version Notes

This is VMD 2.0.0a7 (alpha release) with: - Improved QuickSurf rendering - Better support for large systems - Enhanced plugin architecture - Python 3 support - New color scales and materials - Improved trajectory handling

Note: As an alpha release, some features may be experimental. For production work, verify critical analyses with the stable 1.9.x series if needed.


Last Updated: October 2025 Module Maintainer: XLence Cluster Administration