Skip to content

Trajectory & Interactive Visualization

Visualizing a trajectory

A minimal MD run that produces a trajectory differs from a single-point input only in the nstep and orbitalswrtfrq keywords. The example below (from the tests/caffeine directory) runs 10 MD steps and writes the molecular orbitals at every step:

basis           6-31g
coordinates     caffeine.xyz
charge          0
method          blyp          # DFT-BLYP
run             md
nstep           10            # number of MD steps
orbitalswrtfrq  1             # dump orbitals every MD step
end

orbitalswrtfrq 1 ensures the molecular orbitals are written at every MD step.

The TeraChem trajectory format is compatible with VMD.1 To load it, open VMD → File → New Molecule, browse to the output coors.xyz, and confirm the file type is detected as XYZ (otherwise select XYZ in the Determine file type menu). Once loaded, adjust the representation settings as desired.

Molecular orbitals can be visualized the same way: VMD → File → New Molecule, browse to a caffeine.molden.n file, and confirm the type is Molden. To display both positive and negative isosurfaces, create two representations per orbital. Add a representation with Drawing Method → Orbital; all MOs (with their energies) appear in the Orbital dropdown, and the Isovalue slider controls the isosurface value (a.u.). The geometry and orbitals in the caffeine.molden.n files can also be viewed with the Molden program.2

Interactive molecular dynamics (IMD)

Interactive calculations are especially suited to remote jobs, where TeraChem runs on a cluster while the visualization happens on a local desktop. TeraChem can display geometry-optimization, transition-state-search, and molecular-dynamics trajectories in real time as the calculation proceeds. These interactive molecular dynamics (IMD) runs are practical for molecules of up to roughly 50 atoms on an eight-GPU machine.3

IMD is triggered by adding imdport (and the required imdtime) to an MD input. The files for the benzene example below are in tests/benzene:

basis           sto-3g
coordinates     C6H6.pdb
charge          0
method          rhf
run             md
tinit           1000          # initial temperature (K)
imdport         54321         # port VMD connects to
imdtime         100           # ms VMD assumes each MD step takes
nstep           1000
end

imdtime is the time (in milliseconds) VMD assumes each MD step takes: if a step finishes faster, TeraChem waits before providing new coordinates, ensuring smooth display even when the SCF time per step varies.

To run it, open two terminals:

  1. In the first, launch VMD and load the benzene coordinates from C6H6.pdb.
  2. In the second, launch TeraChem; it initializes the simulation and pauses, waiting for VMD to connect.

Then in VMD, select Extensions → Simulation → IMD Connect (NAMD). Enter localhost (or the IP address of the remote machine running TeraChem) in the Hostname field and 54321 (the port from imdport) in the Port field. Click Connect: TeraChem resumes in its window while the benzene molecule vibrates in the VMD display.

Future capability

Future versions are intended to allow user manipulation of the molecule (imposing external forces on atoms) during an IMD run.


  1. VMD — http://www.ks.uiuc.edu/Research/vmd ↩

  2. Molden — http://www.cmbi.ru.nl/molden ↩

  3. N. Luehr, A. G. B. Jin, T. J. Martínez, J. Chem. Theory Comput. 2015, 11, 4536–4544. ↩