Molecular Dynamics Simulations
Simulating the motion of atoms and molecules by integrating Newton's equations. From classical force fields to enhanced sampling and QM/MM hybrid methods — the computational microscope for biomolecular systems.
1. Classical Molecular Dynamics
Molecular dynamics solves Newton's equations of motion for a system of N interacting particles. For each particle i with mass $m_i$ at position $\mathbf{r}_i$:
Velocity Verlet Integration
The velocity Verlet algorithm is the most widely used integrator due to its symplectic nature, time-reversibility, and excellent energy conservation:
Typical timesteps are 1-2 fs for atomistic simulations. The SHAKE/LINCS algorithms constrain bond lengths involving hydrogen, allowing timesteps up to 2 fs. Hydrogen mass repartitioning (HMR) can extend this to 4 fs.
Derivation: Newton's Equations and the Verlet Integration Algorithm
We derive the velocity Verlet algorithm from Taylor expansions and show why it conserves energy over long trajectories.
Step 1: Start from Newton's second law
For each atom i in the system, the force is the negative gradient of the potential energy surface:
$$m_i \ddot{\mathbf{r}}_i = \mathbf{F}_i = -\nabla_i V(\mathbf{r}_1, \ldots, \mathbf{r}_N)$$
This gives 3N coupled second-order ODEs that must be integrated numerically.
Step 2: Taylor expand positions forward and backward in time
$$\mathbf{r}(t + \Delta t) = \mathbf{r}(t) + \dot{\mathbf{r}}(t)\Delta t + \frac{1}{2}\ddot{\mathbf{r}}(t)\Delta t^2 + \frac{1}{6}\dddot{\mathbf{r}}(t)\Delta t^3 + \mathcal{O}(\Delta t^4)$$
$$\mathbf{r}(t - \Delta t) = \mathbf{r}(t) - \dot{\mathbf{r}}(t)\Delta t + \frac{1}{2}\ddot{\mathbf{r}}(t)\Delta t^2 - \frac{1}{6}\dddot{\mathbf{r}}(t)\Delta t^3 + \mathcal{O}(\Delta t^4)$$
Step 3: Add the two expansions (original Verlet)
The odd-order terms cancel, giving the position Verlet algorithm with local error $\mathcal{O}(\Delta t^4)$:
$$\mathbf{r}(t + \Delta t) = 2\mathbf{r}(t) - \mathbf{r}(t - \Delta t) + \frac{\mathbf{F}(t)}{m}\Delta t^2$$
Step 4: Reformulate as velocity Verlet
The velocity Verlet variant explicitly tracks velocities, improving numerical stability and enabling kinetic energy calculations:
$$\mathbf{r}(t+\Delta t) = \mathbf{r}(t) + \mathbf{v}(t)\Delta t + \frac{\mathbf{F}(t)}{2m}\Delta t^2$$
$$\mathbf{v}(t+\Delta t) = \mathbf{v}(t) + \frac{\Delta t}{2m}\bigl[\mathbf{F}(t) + \mathbf{F}(t+\Delta t)\bigr]$$
Step 5: Symplecticity and energy conservation
The Verlet integrator is symplectic: it preserves the phase-space volume (Liouville's theorem) and conserves a shadow Hamiltonian $\tilde{H} = H + \mathcal{O}(\Delta t^2)$. This means total energy fluctuates but does not drift over time, making it ideal for long MD trajectories spanning nanoseconds to microseconds.
Derivation: Equipartition Theorem and Temperature in MD
We derive the relationship between kinetic energy and temperature that allows MD simulations to connect microscopic velocities to macroscopic thermodynamic temperature.
Step 1: Classical equipartition theorem
In classical statistical mechanics, each quadratic degree of freedom in the Hamiltonian contributes $\frac{1}{2}k_BT$ to the average energy. For a quadratic term $ax_i^2$ in the Hamiltonian:
$$\langle ax_i^2 \rangle = \frac{\int ax_i^2 e^{-ax_i^2/k_BT} dx_i}{\int e^{-ax_i^2/k_BT} dx_i} = \frac{1}{2}k_BT$$
Step 2: Apply to the kinetic energy
Each atom has 3 translational degrees of freedom. The kinetic energy contribution from each velocity component is $\frac{1}{2}mv_x^2$, so:
$$\left\langle \frac{1}{2}mv_{ix}^2 \right\rangle = \frac{1}{2}k_BT$$
Step 3: Sum over all atoms and components
For N atoms, the total average kinetic energy sums over all 3N velocity components:
$$\langle KE \rangle = \sum_{i=1}^{N} \frac{1}{2}m_i\langle v_i^2 \rangle = \frac{3N}{2}k_BT$$
Step 4: Define the instantaneous temperature
In MD, the instantaneous temperature is computed from the kinetic energy at each timestep, accounting for constraints that remove degrees of freedom:
$$T = \frac{2\langle KE \rangle}{N_f k_B} = \frac{1}{N_f k_B}\sum_{i=1}^{N} m_i v_i^2$$
where $N_f = 3N - N_c$ is the number of degrees of freedom after removing $N_c$ constraints (e.g., 3 for center-of-mass translation, 3 for rotation, plus any bond constraints).
2. Molecular Mechanics Force Fields
The potential energy function (force field) is the sum of bonded and non-bonded interactions:
Bonded Terms
Non-bonded Terms
Derivation: Lennard-Jones Potential — Equilibrium Distance and Well Depth
The Lennard-Jones 12-6 potential models van der Waals interactions. We derive its key features from the functional form.
Step 1: Write the LJ potential
The 12-6 form combines short-range Pauli repulsion ($r^{-12}$) with long-range London dispersion attraction ($r^{-6}$):
$$V(r) = 4\varepsilon\left[\left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6}\right]$$
where $\varepsilon$ is the depth of the potential well and $\sigma$ is the distance at which $V = 0$.
Step 2: Find the equilibrium distance (potential minimum)
Set $dV/dr = 0$:
$$\frac{dV}{dr} = 4\varepsilon\left[-12\frac{\sigma^{12}}{r^{13}} + 6\frac{\sigma^{6}}{r^{7}}\right] = 0$$
$$12\sigma^{12}/r^{13} = 6\sigma^6/r^7 \implies r^6 = 2\sigma^6 \implies r_{\min} = 2^{1/6}\sigma \approx 1.122\sigma$$
Step 3: Verify the well depth
Evaluating $V(r_{\min})$ at $r = 2^{1/6}\sigma$:
$$V(r_{\min}) = 4\varepsilon\left[\frac{1}{4} - \frac{1}{2}\right] = 4\varepsilon\left(-\frac{1}{4}\right) = -\varepsilon$$
Confirming that $\varepsilon$ is indeed the well depth.
Step 4: Derive the force from the potential
The force between two particles is:
$$F(r) = -\frac{dV}{dr} = \frac{4\varepsilon}{r}\left[12\left(\frac{\sigma}{r}\right)^{12} - 6\left(\frac{\sigma}{r}\right)^{6}\right] = \frac{24\varepsilon}{r}\left[2\left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6}\right]$$
Repulsive for $r < r_{\min}$ and attractive for $r > r_{\min}$. For argon: $\sigma = 3.4$ A, $\varepsilon/k_B = 120$ K; for carbon: $\sigma = 3.55$ A, $\varepsilon/k_B = 28$ K.
AMBER/CHARMM
All-atom protein force fields with extensive parameterization for biomolecular simulations
OPLS-AA
Optimized for liquid-state thermodynamic properties and protein-ligand binding
MARTINI/SIRAH
Coarse-grained models enabling microsecond timescales for large biomolecular assemblies
3. Enhanced Sampling Methods
Standard MD is limited by the timescale problem — many biologically relevant processes occur on microsecond to second timescales, far beyond typical MD reach. Enhanced sampling methods overcome energy barriers to accelerate conformational exploration.
Umbrella Sampling
Applies biasing potentials along a reaction coordinate to sample high-energy regions. The free energy (PMF) is recovered via the Weighted Histogram Analysis Method (WHAM):
Metadynamics
Deposits Gaussian hills along collective variables to discourage revisiting sampled states. The bias potential builds up to fill free energy basins:
Well-tempered metadynamics ensures convergence
Replica Exchange (REMD)
Runs multiple replicas at different temperatures. Periodic exchange attempts between adjacent temperatures follow the Metropolis criterion:
Accelerated MD (aMD)
Flattens the energy landscape by adding a boost potential when the potential falls below a threshold:
GaMD provides Gaussian-shaped boost for reweighting
Derivation: Langevin Dynamics from the Fluctuation-Dissipation Theorem
Langevin dynamics adds stochastic and frictional forces to Newton's equations, implicitly modeling solvent effects. We derive the noise amplitude from the fluctuation-dissipation theorem.
Step 1: Write the Langevin equation of motion
Add friction (proportional to velocity) and a random force to Newton's equation:
$$m\ddot{x} = F(x) - \gamma\dot{x} + \eta(t)$$
where $\gamma$ is the friction coefficient and $\eta(t)$ is a stochastic (random) force representing thermal kicks from solvent molecules.
Step 2: Specify the statistical properties of the noise
The random force is Gaussian white noise with zero mean and delta-correlated in time:
$$\langle \eta(t) \rangle = 0, \quad \langle \eta(t)\eta(t') \rangle = 2A\,\delta(t - t')$$
where A is the noise amplitude we need to determine.
Step 3: Apply the fluctuation-dissipation theorem
At thermal equilibrium, the energy dissipated by friction must equal the energy input from the random force. The equipartition theorem requires $\langle \frac{1}{2}m\dot{x}^2 \rangle = \frac{1}{2}k_BT$. For a free particle (F = 0), solving the Langevin equation in the long-time limit gives:
$$\langle \dot{x}^2 \rangle = \frac{A}{m\gamma}$$
Step 4: Determine the noise amplitude
Equating with equipartition: $\frac{A}{m\gamma} = \frac{k_BT}{m}$, giving the Einstein relation:
$$A = \gamma k_BT \implies \langle \eta(t)\eta(t') \rangle = 2\gamma k_BT\,\delta(t - t')$$
Step 5: Write the final Langevin equation
Substituting $\eta(t) = \sqrt{2\gamma k_BT}\,\xi(t)$ where $\xi(t)$ is unit white noise:
$$m\ddot{x} = F(x) - \gamma\dot{x} + \sqrt{2\gamma k_BT}\,\xi(t)$$
This is the standard form used in biomolecular simulations. The friction coefficient $\gamma$ controls the coupling to the implicit solvent: low $\gamma$ recovers Newtonian dynamics; high $\gamma$ gives Brownian (overdamped) dynamics where inertia is negligible.
4. QM/MM Methods & Free Energy Calculations
Quantum Mechanics/Molecular Mechanics (QM/MM) methods treat a small chemically important region quantum mechanically while the remainder uses classical force fields. The total energy is:
Free energy perturbation (FEP) calculates free energy differences between states by alchemically transforming one system into another:
Thermodynamic integration (TI) provides an alternative by integrating over a coupling parameter$\lambda$ that smoothly transforms the Hamiltonian:
Derivation: Free Energy Perturbation (Zwanzig Equation)
We derive the FEP formula from the fundamental thermodynamic identity relating free energy to the partition function.
Step 1: Express free energies in terms of partition functions
The Helmholtz free energy of states A and B is related to their configurational partition functions:
$$G_A = -k_BT\ln Z_A, \quad G_B = -k_BT\ln Z_B$$
where $Z_A = \int e^{-U_A(\mathbf{r})/k_BT}d\mathbf{r}$ integrates over all configurations.
Step 2: Write the free energy difference
$$\Delta G = G_B - G_A = -k_BT\ln\frac{Z_B}{Z_A}$$
Step 3: Express the ratio as an ensemble average over state A
Multiply and divide $Z_B$ by $e^{-U_A/k_BT}$:
$$\frac{Z_B}{Z_A} = \frac{\int e^{-U_B/k_BT}d\mathbf{r}}{Z_A} = \frac{\int e^{-(U_B - U_A)/k_BT}\cdot e^{-U_A/k_BT}d\mathbf{r}}{Z_A}$$
The right side is the canonical ensemble average over state A of $e^{-\Delta U/k_BT}$:
$$\frac{Z_B}{Z_A} = \left\langle e^{-(U_B - U_A)/k_BT}\right\rangle_A$$
Step 4: Arrive at the Zwanzig (FEP) equation
Substituting back:
$$\Delta G_{A\to B} = -k_BT\ln\left\langle \exp\left(-\frac{U_B - U_A}{k_BT}\right)\right\rangle_A$$
Step 5: Practical considerations — convergence and staging
FEP converges poorly when states A and B differ significantly (the exponential average is dominated by rare low-energy configurations). In practice, the transformation is broken into small steps using $\lambda$-windows: $U(\lambda) = (1-\lambda)U_A + \lambda U_B$, and the total $\Delta G$ is accumulated over many small perturbation steps. This is the basis of alchemical free energy calculations used in drug design (binding affinity prediction).
Python Simulation: 2D Lennard-Jones MD
This simulation performs a 2D molecular dynamics simulation of Lennard-Jones particles using the velocity Verlet integrator with periodic boundary conditions, a Berendsen thermostat, and computes the radial distribution function g(r) to characterize the liquid structure.
2D Lennard-Jones Molecular Dynamics
PythonVelocity Verlet MD with periodic boundaries, Berendsen thermostat, and radial distribution function
Click Run to execute the Python code
Code will be executed with Python 3 on the server
Fortran Computation: LJ Force Calculator
This Fortran program computes all pairwise Lennard-Jones forces for a system of N particles using minimum image convention. It verifies Newton's third law and calculates thermodynamic properties including the virial pressure.
Lennard-Jones Force Computation
FortranPairwise force calculation with minimum image convention and thermodynamic analysis
Click Run to execute the Fortran code
Code will be compiled with gfortran and executed on the server
Video Lectures
Introduction to Molecular Dynamics
Comprehensive introduction to molecular dynamics simulation methodology, including force fields, integrators, thermostats, and barostats.
Enhanced Sampling Methods
Overview of enhanced sampling techniques including metadynamics, replica exchange, umbrella sampling, and their applications in biomolecular simulations.
Key Concepts Summary
Velocity Verlet
Symplectic, time-reversible integrator with excellent long-term energy conservation for MD
Force Fields
AMBER, CHARMM, OPLS parameterize bonded and non-bonded interactions for biomolecular systems
Enhanced Sampling
Metadynamics, REMD, and umbrella sampling overcome energy barriers to access rare events
QM/MM & Free Energy
Hybrid quantum/classical methods and FEP/TI for accurate thermodynamic calculations