Minimisation, equilibration and production in an MD run
An MD run has three phases. Minimisation removes clashes, equilibration brings temperature and density to target, and only production is analysed.
A molecular dynamics run is three phases, not one. Minimisation relaxes the freshly built system downhill in energy to remove clashes. Equilibration heats it to the target temperature and lets the water reach its proper density while the protein is held gently in place by restraints, which are then released. Production is the unrestrained run at constant temperature and pressure whose frames are analysed. Skipping or rushing the first two phases does not save time. It produces a trajectory whose early part is relaxation noise that must be discarded, or a run that crashes.
Minimisation removes what the builder put in
A system straight out of preparation is full of small violations. Added hydrogens point into neighbours, a docked ligand sits a tenth of an angstrom too close to a side chain, and the water placed around the protein overlaps with it in places. Each violation stores energy in the steep repulsive wall of the Lennard-Jones term. If dynamics starts there, the first forces are enormous and atoms fly apart.
Minimisation walks the structure downhill using gradient methods, L-BFGS in OpenMM's minimizeEnergy. It stops at a nearby local minimum, which is enough. The goal is not the lowest-energy structure but a structure whose forces are small enough for a 2 fs step to be stable. A few hundred to a few thousand iterations usually suffice, and a drop of potential energy followed by a plateau is the sign of completion.
Minimisation changes little that is visible. Heavy atoms move fractions of an angstrom. It is worth comparing the minimised structure to the input to confirm that nothing has drifted, since a large motion here means a severe clash or a mistake in preparation.
Heating under restraints, the NVT stage
Dynamics begins at constant volume, the NVT ensemble. Velocities are assigned from a Maxwell-Boltzmann distribution at a low temperature or at the target temperature directly, and a Langevin thermostat drives the kinetic energy to the target, typically around 300 K. The Langevin scheme adds friction and random forces to every atom, so it both controls temperature and enhances sampling slightly. A friction coefficient of about one per picosecond is a common compromise.
During this stage the protein heavy atoms, and the ligand if present, are restrained to their starting positions with harmonic springs. Water and ions are free. The restraints exist because water placed by a builder has no hydrogen-bond network yet. Letting it crash against an unrestrained protein can distort surface loops or pull a ligand before the solvent has settled.
OpenMM has no dedicated restraint keyword. A CustomExternalForce does the job.
from openmm import CustomExternalForce, unit
restraint = CustomExternalForce("k*periodicdistance(x, y, z, x0, y0, z0)^2")
restraint.addGlobalParameter("k", 1000.0 * unit.kilojoules_per_mole / unit.nanometer**2)
for name in ("x0", "y0", "z0"):
restraint.addPerParticleParameter(name)
for atom, pos in zip(model.topology.atoms(), model.positions):
if atom.residue.name != "HOH" and atom.element.symbol != "H":
restraint.addParticle(atom.index, pos.value_in_unit(unit.nanometer))
system.addForce(restraint)
# later: sim.context.setParameter("k", 0.0) releases the restraints
The global parameter k can be lowered in stages from the running context, which is how a gradual release is scripted. The thermostat and integrator are the same ones used for production.
Settling the density, the NPT stage
Water placed at a nominal density is rarely at the right density for the chosen model and temperature. Switching on a barostat, the Monte Carlo barostat in OpenMM, lets the box volume change so that pressure fluctuates around one bar. The box typically shrinks by a few percent as voids close. This is the NPT ensemble, and its signature is a box volume that drops, then levels off.
Restraints are still on at the start of NPT and are weakened in steps. A common schedule drops the spring constant over a few hundred picoseconds, with a short unrestrained stretch at the end. The whole equilibration for a protein-ligand complex is often one to a few nanoseconds, and on a given machine it costs the same per nanosecond as production. Budgeting for it is part of credits and cost control.
Signs to check before production: temperature stable at target, potential energy flat, box volume and density flat, backbone RMSD from the minimised structure levelled off. Each should be plotted, not assumed. A drifting density means the barostat has not finished. A climbing RMSD means the protein is still relaxing, or is unhappy with its force field or protonation.
Production, the only frames that count
Production is the unrestrained NPT run from which every result is derived. Nothing from the earlier phases enters the analysis, because those frames reflect the restraints and the builder's choices rather than the physics. Frames are saved at intervals, every ten picoseconds for example, which keeps the file manageable and leaves consecutive frames nearly uncorrelated for most observables.
Take imatinib bound to a kinase domain as the worked example. After minimisation, one nanosecond of restrained heating and NPT, and gradual release, production begins with the ligand still in its docked pose. The first observables to compute are ligand heavy-atom RMSD after aligning on the protein backbone, the distance from the ligand's amide or pyridine nitrogen to the hinge backbone, and the per-residue fluctuation of the activation loop. Reading those plots correctly is the subject of RMSD and RMSF, reading a trajectory, and the decision that follows is covered in using dynamics to check a docked pose.
Replicas belong in the plan from the start. Three production runs from the same equilibrated structure with different random seeds cost three times as much and tell far more than one run three times as long, because they expose how much of what you see is chance. Keeping the protocol identical across replicas, with the scripts and seeds recorded, follows the practice described in reproducible cheminformatics notebooks.
Equilibrated is not the same as converged
A system that has stopped drifting in temperature, density and RMSD has equilibrated in the local sense. It has not necessarily visited the states that matter. A loop may be stuck in its crystal conformation for the whole run, a ligand may sit in a metastable pose that would leave after a hundred nanoseconds, and a buried water may never exchange. Equilibration prepares the run to be meaningful. It does not promise that the run is long enough.
Key points
- Minimise first. It removes clashes from hydrogens, water and docking so that dynamics can start with a 2 fs step.
- Heat at constant volume with heavy-atom restraints, then switch on a barostat so water reaches its density, then release the restraints in stages.
- Check temperature, potential energy, box volume and backbone RMSD for plateaus before production. Plot them, do not assume them.
- Only unrestrained production frames enter the analysis. Replicas with different seeds reveal how much is chance.
- Equilibrated means stopped drifting locally. It does not mean the relevant states have been sampled.
Questions people ask
- What is the purpose of energy minimisation before molecular dynamics?
- Minimisation moves atoms downhill in energy to remove steric clashes and bad geometry introduced by adding hydrogens, placing water or docking a ligand. It reaches a nearby local minimum, not the global one. Without it, the first femtoseconds of dynamics generate enormous forces that can distort the structure or crash the integrator.
- What do NVT and NPT mean in molecular dynamics?
- They name the quantities held constant. NVT fixes the number of particles, the volume and the temperature, and is used to heat the system at fixed box size. NPT fixes the number of particles, the pressure and the temperature, letting the box volume change so the water reaches its correct density. Production runs for solution systems are usually NPT.
- How do I know when a system is equilibrated?
- Temperature, potential energy, box volume and density should fluctuate around stable values with no drift. Protein backbone RMSD from the starting structure should level off rather than climb. These are necessary signs, not proof. Slow motions can still be relaxing, and a plateau of a few nanoseconds does not mean the system has visited every relevant state.
- Why are positional restraints used during equilibration?
- Restraints hold protein heavy atoms, and often the ligand, near their starting positions with a harmonic penalty while water and ions relax around them. This prevents the solute from being deformed by water that has not yet adopted a sensible structure. The restraints are weakened in stages and removed before production.
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.