Guides / Molecular dynamics

molecular-dynamicsopenmmtrajectorysimulation-basics

What molecular dynamics simulates and what it cannot show

Molecular dynamics integrates Newton's equations for every atom of a solvated system and returns a trajectory over nanoseconds, not a binding free energy.

Updated 5 min read

Molecular dynamics computes how atoms move. Given a starting structure, a force field that gives the potential energy as a function of atomic positions, and a temperature, it integrates Newton's second law in femtosecond steps and saves the positions at intervals. The result is a trajectory, a film of the system that typically covers nanoseconds. It shows motion, flexibility and whether a pose holds under thermal agitation. It does not, on its own, return a binding free energy, a folding pathway or any event slower than the run itself.

Newton's equations, one femtosecond at a time

Every atom in the system carries a position, a velocity and a mass. The force field returns the potential energy for any arrangement of atoms, and the negative gradient of that energy is the force on each atom. Dividing by mass gives the acceleration. The integrator advances positions and velocities by one small step, recomputes forces, and repeats.

The step must be shorter than the fastest motion in the system. Bonds to hydrogen vibrate with periods near ten femtoseconds, so an unconstrained system needs steps of about one femtosecond. Most production work constrains those bonds and uses a 2 fs timestep. At 2 fs, one nanosecond is half a million force evaluations, which is why hardware, not patience, sets the length of a run.

Temperature enters through a thermostat. A Langevin integrator adds a small friction and a random kick to each atom so that the average kinetic energy matches the target temperature. A barostat adjusts the box volume so that pressure stays near one atmosphere. Together they produce a constant-temperature, constant-pressure ensemble, the conditions of a test tube rather than an isolated vacuum.

What a trajectory contains and what it does not

A trajectory file holds coordinates for every atom at every saved frame. Saving every step would be wasteful, so a run of one nanosecond at 2 fs usually stores a few hundred to a few thousand frames. Alongside it, a log records temperature, potential energy, box volume and simulation speed.

Nothing in those files is a conclusion. The analyst must compute quantities from them. The most common are root-mean-square deviation, which measures how far the structure has drifted from its start, and root-mean-square fluctuation, which measures how much each residue moves around its average position. Both are covered in RMSD and RMSF, reading a trajectory. Contacts, hydrogen-bond occupancies, distances between chosen atoms and radius of gyration are other routine readouts.

Molecular dynamics with a classical force field also leaves things out. Bonds never break or form, so no reaction chemistry happens. Protonation states are fixed when the system is built, so a histidine stays in whichever state the preparation chose. Electrons are not modelled, only fixed partial charges on atoms, so polarisation is approximated at best. These are properties of the method, not bugs of any one program.

What nanosecond runs show well

Short runs are good at relaxation. A crystal structure or a docked pose carries strain from the way it was made. A few nanoseconds in water let side chains settle, let the ligand find a slightly better position and reveal clashes that a static picture hides. This is the most common reason to run dynamics after docking, and the subject of using dynamics to check a docked pose.

They are also good at local flexibility. Which loops are mobile, which residues are pinned by contacts, whether a hinge region opens slightly, whether a water molecule stays bridging two groups: these are motions on the picosecond to nanosecond scale, within reach of a routine run.

A worked example makes the scale concrete. Ibuprofen bound to the cyclooxygenase-2 channel is a complex of a small acid in a mostly hydrophobic pocket, with its carboxylate near arginine and tyrosine side chains at the channel mouth. A ten-nanosecond run at 300 K will show whether the carboxylate keeps those contacts, how much the isobutyl tail rotates, and whether water enters the channel. It will not show the ligand leaving the pocket, because residence times of drugs are milliseconds to hours, orders of magnitude beyond the run.

A minimal OpenMM run

MolForge runs molecular dynamics with OpenMM on the Advanced Modeling page. The same engine is a Python library, and a complete run fits in a short script. The example below solvates a protein in TIP3P water with ions, applies the AMBER ff14SB force field, constrains bonds to hydrogen, and runs one nanosecond at 300 K.

from openmm import unit, LangevinMiddleIntegrator, MonteCarloBarostat
from openmm.app import PDBFile, ForceField, Modeller, Simulation, PME, HBonds, DCDReporter

pdb = PDBFile("protein.pdb")
ff = ForceField("amber14-all.xml", "amber14/tip3p.xml")
model = Modeller(pdb.topology, pdb.positions)
model.addSolvent(ff, padding=1.0 * unit.nanometer, ionicStrength=0.15 * unit.molar)

system = ff.createSystem(model.topology, nonbondedMethod=PME,
                         nonbondedCutoff=1.0 * unit.nanometer, constraints=HBonds)
system.addForce(MonteCarloBarostat(1.0 * unit.bar, 300 * unit.kelvin))
integrator = LangevinMiddleIntegrator(300 * unit.kelvin, 1.0 / unit.picosecond,
                                      0.002 * unit.picoseconds)

sim = Simulation(model.topology, system, integrator)
sim.context.setPositions(model.positions)
sim.minimizeEnergy()
sim.reporters.append(DCDReporter("traj.dcd", 5000))
sim.step(500_000)  # 1 ns at 2 fs

Each line maps to a concept in this cluster. The force-field files, the padding and ions, the constraints behind the 2 fs step and the order of minimisation, heating and production each have their own guide.

Where molecular dynamics sits next to docking

Docking answers a placement question quickly, with a rigid or nearly rigid receptor and a scoring function tuned for speed. Its output is a ranked list of poses, and the reasons docking scores are not binding affinities apply in full. Dynamics starts where docking stops. It takes one pose, adds water, ions and temperature, and asks whether the pose is a stable state or an artefact of a frozen receptor.

A trajectory is a sample of what the model allows, over the time you could afford. Nothing more, and nothing less.

The honest use of a short run is therefore as a filter and a source of hypotheses. A pose that falls apart in three independent replicas deserves suspicion. A pose that holds in all three has passed a necessary test, not a sufficient one. The structural reasons for that caution, and the timescales that routine runs cannot reach, are laid out in the limits of short molecular dynamics runs.

Key points

Questions people ask

What does a molecular dynamics simulation actually compute?
It computes the positions and velocities of every atom at each femtosecond step by applying Newton's second law with forces taken from a force field. Saved at intervals, those positions form a trajectory, which is the raw output. Everything else, such as RMSD, contacts or flexibility, is derived from the trajectory afterwards.
How long does a molecular dynamics run need to be?
Long enough to sample the motion you care about, which depends on the question. Side-chain rotations and local relaxation take picoseconds to nanoseconds, loop rearrangements take nanoseconds to microseconds, and large domain motions or ligand unbinding often take far longer than a routine run. A run that is too short simply does not see the event, and reports nothing about it.
Can molecular dynamics predict binding affinity?
Not a plain simulation of the complex. A standard run shows whether a pose is stable over the time simulated, but a free energy of binding needs dedicated methods such as alchemical free-energy calculations or umbrella sampling, each with its own cost and assumptions. Treat pose stability as a qualitative check, not a number to rank compounds by.
What is the difference between docking and molecular dynamics?
Docking searches for a good placement of a rigid or semi-rigid ligand in a mostly rigid protein and scores it in seconds. Molecular dynamics starts from one placement and lets every atom move at a chosen temperature in explicit water, which takes hours. Docking proposes poses, dynamics tests whether a proposed pose survives motion.

Further reading

In practice: Advanced Modeling runs molecular dynamics with OpenMM. Nanosecond runs answer narrow questions, such as whether a pose holds; the guides say which questions they cannot answer.

← All guides