This simulation needs WebAssembly, and it could not start in this browser.
The image is a frame from a real run. Check that JavaScript is on, or try another browser.
Molecular dynamics conserves energy, but many questions are about a system held at a fixed temperature. In 1984 Shūichi Nosé showed how to get canonical, constant-temperature sampling from deterministic equations by adding one extra degree of freedom, and in 1985 William Hoover recast the method in the form used today: a friction coefficient that has its own equation of motion. When the system runs hotter than the target temperature , grows and brakes it; when it runs colder, turns negative and pumps energy in. Applied to a single harmonic oscillator, the scheme fails in an instructive way. Posch, Hoover and Vesely showed in 1986 that its phase space splits into regular tori and a chaotic sea, so a single orbit does not sample the canonical distribution.
What you see
The canvas shows the oscillator’s phase plane: position horizontally, velocity vertically, in a view that follows the trajectory with the same scale on both axes. The trail’s color shows the friction , from blue (low) to yellow (high), scaled to the range the trail covers, the white dot is the current state, and the current , and are printed in the corner. Integration uses fourth-order Runge-Kutta by default, each step of split into four substeps, with four steps per frame.
Chaotic sea (T=1): the classic case, starting at , which is also the default. At regular tori and a chaotic sea coexist, and this starting point lies in the sea: the orbit wanders irregularly over the phase plane, with a largest Lyapunov exponent of about 0.02.
More chaotic (T=2): a higher target temperature, starting at with a large initial friction. This orbit is chaotic and wanders irregularly over a much larger region.
Mostly regular (T=0.5): a lower target temperature, starting at . The orbit is regular.
On a KAM torus: again, starting at , which lies on one of the regular tori: the orbit keeps returning to the same band in the phase plane, and nearby orbits do not separate exponentially.
Governing equation
Mass, spring constant and thermostat mass are all set to 1. The friction responds to the difference between the kinetic energy and its target , so on any orbit that stays bounded the long-time average of equals . The divergence is : phase-space volume shrinks while the thermostat brakes and grows while it drives. The Gaussian density is a stationary solution of the flow; the regular tori are why one orbit does not fill it. With and these are exactly the equations of case A in Sprott’s 1994 list of simple chaotic flows.
Parameters
Thermostat temperature T: 0.1 to 4, default 1. The target value of the average kinetic energy .
Time step dt: 0.01 to 0.1, default 0.05.