9474

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

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.
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.

THINGS TO TRY

SNAPSHOTS

  • [Snapshot]
  • [Snapshot]
  • [Snapshot]

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 . 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 [5]. 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
[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.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.









 
RELATED RESOURCES
Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Powered by Wolfram Mathematica © 2014 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+