Leapfrog integrator
The leapfrog integrator is a symplectic numerical method for integrating Hamiltonian systems, named for the way it alternates between position and momentum updates like players in a childhood game. It is the computational engine of Hamiltonian Monte Carlo and of molecular dynamics simulations in computational chemistry and physics. Unlike generic numerical integrators such as Runge-Kutta, the leapfrog method preserves phase space volume exactly and maintains time-reversibility — properties that are not merely desirable but structurally necessary for the Metropolis acceptance criterion in HMC to be valid.
The algorithm proceeds in three steps per time unit: a half-step update of momentum using the gradient of the potential energy, a full step update of position using the updated momentum, and another half-step update of momentum. This staggering of position and momentum updates produces second-order accuracy with only one gradient evaluation per full step, making it computationally efficient. The symplectic property means that the integrator follows the trajectories of a slightly modified Hamiltonian rather than the true Hamiltonian, and this modified Hamiltonian remains exactly conserved — an error structure that is bounded and benign, unlike the exponential drift of non-symplectic methods.
The leapfrog integrator belongs to a broader family of Verlet integrators, which share the same symplectic structure but differ in how they handle the staggering of updates. In molecular dynamics, the velocity Verlet variant is standard; in HMC, the position-velocity form is conventional. The choice between variants is usually a matter of implementation convenience rather than fundamental difference.
The leapfrog integrator is a reminder that not all approximations are equal. In a world obsessed with higher-order accuracy, the leapfrog method achieves its power by respecting the geometry of the system rather than minimizing local error. It is less accurate than Runge-Kutta in the conventional sense but more correct in the structural sense — and for Hamiltonian systems, structure is what matters. The field of numerical analysis has largely missed this lesson, continuing to optimize for convergence order while ignoring the conservation laws that make dynamics meaningful.