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

Initializing live version Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

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 (where is a coordinate and 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.

[more]

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 . The smaller the , the better the approximation is for the true stability of the algorithm. It can be seen how going forward in "time" and changing in the approximated solutions makes the former quantities change in an appropriate way using VV and RK, in a catastrophic case.

[less]

Contributed by: Luigi Tiburzi (April 2012)
Open content licensed under CC BY-NC-SA

## Snapshots   ## Details

The Demonstration aims to simulate a classical molecular model for bond vibrations  in which the force fields  are approximated as harmonic oscillators . Usually simulations are carried out in isolated conservative systems so it is important to have both energy and the total number of particles  conserved by the approximate solution. This is achieved by conservtion of the product . 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 are referred to as symplectic integrators . Typical molecular calculations are carried out with .

A typical real vibration has so the 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 so the following values of (in seconds) have been chosen: 0.01; 0.06; 0.1; 0.3.

Increasing increases the difference in behavior of the two algorithms up to the (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

 Wikipedia. "Molecular Vibration." (Mar 27, 2012) en.wikipedia.org/wiki/Molecular_vibration.

 Wikipedia. "Force Field." (Apr 10, 2012) en.wikipedia.org/wiki/Force_field_(chemistry).

 Wikipedia. "Harmonic Oscillator." (Apr 5, 2012) en.wikipedia.org/wiki/Harmonic_oscillator.

 Wikipedia. "Liouville's Theorem." (Mar 18, 2012) en.wikipedia.org/wiki/Liouville's_theorem _(Hamiltonian).

 Wikipedia. "Symplectic Integrator." (Oct 27, 2011) en.wikipedia.org/wiki/Symplectic_integrator.

## Permanent Citation

Luigi Tiburzi

 Feedback (field required) Email (field required) Name Occupation Organization Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback. Send