Runge-Kutta versus Velocity-Verlet Solutions for the Classical Harmonic Oscillator

​
dt
1
2
3
4
time
10
The harmonic oscillator is an idealized system widely used in many physical applications. It consists of a mass that oscillates without friction around an equilibrium position under a conservative attractive force. The energy is therefore constant. There is another conserved quantity, often not mentioned—the phase-space two-form
dxdp
(where
x
is a coordinate and
p
the conjugate momentum). The conservation of this quantity in a Hamiltonian system is a necessary and sufficient condition for conservation of the total number of particles, relevant if the system contains a fixed number of particles.
This Demonstration aims to show the differences between Runge–Kutta 4 (RK4) and Velocity-Verlet (VV) in the approximation of the classical harmonic oscillator problem, and is often considered a good simple test to evaluate an algorithm’s reliability on more complex Hamiltonian systems. Both are fourth-order algorithms that approximate the solution by calculating the trajectory’s point separated by a fixed
dt
. The smaller the
dt
, the better the approximation is for the true stability of the algorithm. It can be seen how going forward in "time" and changing
dt
in the approximated solutions makes the former quantities change in an appropriate way using VV and RK, in a catastrophic case.

Details

The Demonstration aims to simulate a classical molecular model for bond vibrations[1] in which the force fields[2] are approximated as harmonic oscillators[3]. Usually simulations are carried out in isolated conservative systems so it is important to have both energy and the total number of particles[4] conserved by the approximate solution. This is achieved by conservtion of the product
dxdp
. In the above example you can see the best that can be achieved for the former product is a strongly oscillating value with a constant mean and not a single point constant value. This result is reached by the VV algorithm but not by the RK algorithm. Algorithms able to conserve
dxdp
are referred to as symplectic integrators[5]. Typical molecular calculations are carried out with
dt=1fs
.
A typical real vibration has
1
ν
∼1fs
so the
dt
used in molecular dynamics to approximate the equations is roughly consistent with the width of a single vibration (or at least, the shortest vibration in the system).
The harmonic oscillator in the simulation has
1
ν
∼0.3
so the following values of
dt
(in seconds) have been chosen: 0.01; 0.06; 0.1; 0.3.
Increasing
dt
increases the difference in behavior of the two algorithms up to the
dt=0.3
(at this value, molecular world and real world proportions are the same). It is clear that RK, not being a symplectic integrator, cannot be used as an algorithm to integrate the equation of motion in a molecular dynamics simulation.

References

[1] Wikipedia. "Molecular Vibration." (Mar 27, 2012) en.wikipedia.org/wiki/Molecular_vibration.
[2] Wikipedia. "Force Field." (Apr 10, 2012) en.wikipedia.org/wiki/Force_field_(chemistry).
[3] Wikipedia. "Harmonic Oscillator." (Apr 5, 2012) en.wikipedia.org/wiki/Harmonic_oscillator.
[4] Wikipedia. "Liouville's Theorem." (Mar 18, 2012) en.wikipedia.org/wiki/Liouville's_theorem _(Hamiltonian).
[5] Wikipedia. "Symplectic Integrator." (Oct 27, 2011) en.wikipedia.org/wiki/Symplectic_integrator.

External Links

Comparing Leapfrog Methods with Other Numerical Methods for Differential Equations

Permanent Citation

Luigi Tiburzi
​
​"Runge-Kutta versus Velocity-Verlet Solutions for the Classical Harmonic Oscillator"​
​http://demonstrations.wolfram.com/RungeKuttaVersusVelocityVerletSolutionsForTheClassicalHarmon/​
​Wolfram Demonstrations Project​
​Published: April 27, 2012