Verlet integration

[1] It is frequently used to calculate trajectories of particles in molecular dynamics simulations and computer graphics.

The algorithm was first used in 1791 by Jean Baptiste Delambre and has been rediscovered many times since then, most recently by Loup Verlet in the 1960s for use in molecular dynamics.

[2] The Verlet integrator provides good numerical stability, as well as other properties that are important in physical systems such as time reversibility and preservation of the symplectic form on phase space, at no significant additional computational cost over the simple Euler method.

, can be used to describe the evolution of diverse physical systems, from the motion of interacting molecules to the orbit of the planets.

After a transformation to bring the mass to the right side and forgetting the structure of multiple particles, the equation may be simplified to with some suitable vector-valued function

To discretize and numerically solve this initial value problem, a time step

Where Euler's method uses the forward difference approximation to the first derivative in differential equations of order one, Verlet integration can be seen as using the central difference approximation to the second derivative: Verlet integration in the form used as the Størmer method[3] uses this equation to obtain the next position vector from the previous two without using the velocity as The time symmetry inherent in the method reduces the level of local errors introduced into the integration by the discretization by removing all odd-degree terms, here the terms in

Caution should be applied to the fact that the acceleration here is computed from the exact solution,

The Størmer method applied to this differential equation leads to a linear recurrence relation or It can be solved by finding the roots of its characteristic polynomial

To compare them with the exact solutions, Taylor expansions are computed: The quotient of this series with the one of the exponential

so that the iteration formula becomes The velocities are not explicitly given in the basic Størmer equation, but often they are necessary for the calculation of certain physical quantities like the kinetic energy.

This can create technical challenges in molecular dynamics simulations, because kinetic energy and instantaneous temperatures at time

at the cost of accuracy: A related, and more commonly used algorithm is the velocity Verlet algorithm,[5] similar to the leapfrog method, except that the velocity and position are calculated at the same value of the time variable (leapfrog does not, as the name suggests).

One might note that the long-term results of velocity Verlet, and similarly of leapfrog are one order better than the semi-implicit Euler method.

The algorithms are almost identical up to a shift by half a time step in the velocity.

Additionally, if the acceleration indeed results from the forces in a conservative mechanical or Hamiltonian system, the energy of the approximation essentially oscillates around the constant energy of the exactly solved system, with a global error bound again of order one for semi-explicit Euler and order two for Verlet-leapfrog.

Since velocity Verlet is a generally useful algorithm in 3D applications, a solution written in C++ could look like below.

This type of position integration will significantly increase accuracy in 3D simulations and games when compared with the regular Euler method.The global truncation error of the Verlet method is

The difference is due to the accumulation of the local truncation error over all of the iterations.

, it is clear that[citation needed] and therefore, the global (cumulative) error over a constant interval of time is given by Because the velocity is determined in a non-cumulative way from the positions in the Verlet integrator, the global error in velocity is also

Systems of multiple particles with constraints are simpler to solve with Verlet integration than with Euler methods.

Constraints between points may be, for example, potentials constraining them to a specific distance or attractive forces.

, can be found with the algorithm Verlet integration is useful because it directly relates the force to the position, rather than solving the problem using velocities.

The matrix code can be reused: The dependency of the forces on the positions can be approximated locally to first order, and the Verlet integration can be made more implicit.

Sophisticated software, such as SuperLU[7] exists to solve complex problems using sparse matrices.

One way of reacting to collisions is to use a penalty-based system, which basically applies a set force to a point upon contact.

The Verlet integration would automatically handle the velocity imparted by the collision in the latter case; however, note that this is not guaranteed to do so in a way that is consistent with collision physics (that is, changes in momentum are not guaranteed to be realistic).

Instead of implicitly changing the velocity term, one would need to explicitly control the final velocities of the objects colliding (by changing the recorded position from the previous time step).

The two simplest methods for deciding on a new velocity are perfectly elastic and inelastic collisions.

A slightly more complicated strategy that offers more control would involve using the coefficient of restitution.