Loading the engineShared by all simulations, so the next one opens instantly.
The physics

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 T, ξ 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 x horizontally, velocity y 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 T, ξ and x are printed in the corner. Integration uses fourth-order Runge-Kutta by default, each step of dt=0.05 split into four substeps, with four steps per frame.

Chaotic sea (T=1): the classic case, starting at (x,y,ξ)=(0,5,0), which is also the default. At T=1 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 (0,1,4) 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 (0,3,0). The orbit is regular.

On a KAM torus: T=1 again, starting at (0,3.3,0), 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

x˙=y,y˙=−x−ξy,ξ˙=y2−T.

Mass, spring constant and thermostat mass are all set to 1. The friction responds to the difference between the kinetic energy y2 and its target T, so on any orbit that stays bounded the long-time average of y2 equals T. The divergence is −ξ: phase-space volume shrinks while the thermostat brakes and grows while it drives. The Gaussian density ∝e−(x2+y2+ξ2)/2T is a stationary solution of the flow; the regular tori are why one orbit does not fill it. With T=1 and z=−ξ 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 ⟨y2⟩.

Time step dt: 0.01 to 0.1, default 0.05.