Algorithm Search⌘K

Theoremadvanced

Shadow Hamiltonian theorem

Also called modified Hamiltonian of a symplectic integrator.

For a symplectic method with a small step h on an analytic Hamiltonian, a modified energy near H is conserved to within e^(-c/h) over times exponentially long in 1/h.

The shadow Hamiltonian theorem explains why the energy of a molecular dynamics run with the Verlet method does not drift. It has three hypotheses: the method is symplectic, the Hamiltonian HH is analytic, and the step hh is small. Then there is a modified Hamiltonian H~=H+hpHp+1+⋯\tilde H = H + h^p H_{p+1} + \cdots, close to HH, such that the numerical solution conserves H~\tilde H up to an error of size e−h0/he^{-h_0/h} in each step. As long as the solution stays in a bounded region, HH itself then oscillates in a band of width O(hp)O(h^p) for times exponentially long in 1/h1/h. The theorem is a result of backward error analysis: the method is the exact flow of a nearby system, up to that tiny error. Backward error analysis gives a modified equation for any method; the special fact for symplectic methods is that the modified equation is again Hamiltonian. The theorem is about energy, not about integrators: it says when a method such as RATTLE or RESPA keeps a good energy, and when it does not.

Statement

Setting. Let H:U→RH : U \to \mathbb{R} be a real analytic Hamiltonian on an open set U⊂R2dU \subset \mathbb{R}^{2d}, and y′=J−1∇H(y)y' = J^{-1} \nabla H(y) the Hamiltonian system. Let Φh\Phi_h be a one-step method of order pp that is symplectic, and whose map is analytic in hh and yy; the Störmer-Verlet method is an example, with p=2p = 2. Let K⊂UK \subset U be compact.

Theorem (Benettin and Giorgilli, 1994; Hairer, Lubich and Wanner, Theorem IX.8.1). There are h0>0h_0 > 0, CC and, for each h≤h0h \le h_0, an analytic function H~h=H+hpHp+1+⋯+hN−1HN\tilde H_h = H + h^p H_{p+1} + \cdots + h^{N-1} H_N, with NN of order h0/hh_0 / h, such that for y∈Ky \in K

∣H~h(Φh(y))−H~h(y)∣≤Ch e−h0/h,∣H~h(y)−H(y)∣≤Chp.|\tilde H_h(\Phi_h(y)) - \tilde H_h(y)| \le C h \, e^{-h_0/h}, \qquad |\tilde H_h(y) - H(y)| \le C h^p.

So if the numerical solution yn=Φhn(y0)y_n = \Phi_h^n(y_0) stays in KK, then

H~h(yn)=H~h(y0)+O(nh e−h0/h),H(yn)=H(y0)+O(hp)for nh≤eh0/2h.\tilde H_h(y_n) = \tilde H_h(y_0) + O(n h \, e^{-h_0/h}), \qquad H(y_n) = H(y_0) + O(h^p) \quad \text{for } nh \le e^{h_0/2h}.

Exact case. For the harmonic oscillator H=12(p2+x2)H = \frac12 (p^2 + x^2) and the velocity Verlet method with 0<h<20 < h < 2, the quadratic form E~=12p2+12(1−h2/4)x2\tilde E = \frac12 p^2 + \frac12 (1 - h^2/4) x^2 is conserved exactly by every step.

In plain words

A simulation of moving atoms makes a small error at every step, so you would expect the total energy to wander away over a long run. With the most common method it does not. The energy wobbles a little, but its average stays the same for millions of steps.

The reason is that the method follows the laws of motion of a slightly different system almost perfectly. That other system has its own energy, very close to the true one, and the simulation keeps it almost exactly. The true energy can then only move by the small difference between the two, so it wobbles but cannot drift.

This needs three things: a method of the right kind, smooth forces, and a step that is small against the fastest motion. Without any one of them, a slow drift can come back.

Proof

The exact case. One velocity Verlet step for x′′=−xx'' = -x is p1/2=p−h2xp_{1/2} = p - \frac{h}{2} x, x1=x+hp1/2x_1 = x + h p_{1/2}, p1=p1/2−h2x1p_1 = p_{1/2} - \frac{h}{2} x_1. In terms of p1/2p_{1/2}, the two points satisfy p=p1/2+h2xp = p_{1/2} + \frac{h}{2} x and p1=p1/2−h2x1p_1 = p_{1/2} - \frac{h}{2} x_1. Write c=1−h2/4c = 1 - h^2/4. Then

p2+cx2=p1/22+hp1/2x+x2,p12+cx12=p1/22−hp1/2x1+x12.p^2 + c x^2 = p_{1/2}^2 + h p_{1/2} x + x^2, \qquad p_1^2 + c x_1^2 = p_{1/2}^2 - h p_{1/2} x_1 + x_1^2.

The difference is x2−x12+hp1/2(x+x1)=(x+x1)(x−x1+hp1/2)=0x^2 - x_1^2 + h p_{1/2}(x + x_1) = (x + x_1)(x - x_1 + h p_{1/2}) = 0, since x1−x=hp1/2x_1 - x = h p_{1/2}. So E~\tilde E is conserved. For 0<h<20 < h < 2, c>0c > 0, so the level sets of E~\tilde E are ellipses and the solution is bounded.

The modified equation is Hamiltonian. Backward error analysis gives, for any method of order pp with smooth coefficients, vector fields fjf_j such that the flow φ~N,h\tilde\varphi_{N,h} of the truncated modified equation y′=f(y)+hpfp+1(y)+⋯+hN−1fN(y)y' = f(y) + h^p f_{p+1}(y) + \cdots + h^{N-1} f_N(y) satisfies Φh(y)=φ~N,h(y)+O(hN+1)\Phi_h(y) = \tilde\varphi_{N,h}(y) + O(h^{N+1}). We show by induction that each fj=J−1∇Hjf_j = J^{-1} \nabla H_j on a simply connected domain. Suppose that f1=f,…,fNf_1 = f, \ldots, f_N are Hamiltonian. Then φ~N,h\tilde\varphi_{N,h} is the flow of a Hamiltonian system, so it is symplectic. The next term is defined by Φh(y)=φ~N,h(y)+hN+1fN+1(y)+O(hN+2)\Phi_h(y) = \tilde\varphi_{N,h}(y) + h^{N+1} f_{N+1}(y) + O(h^{N+2}), so

Φh′(y)=φ~N,h′(y)+hN+1fN+1′(y)+O(hN+2).\Phi_h'(y) = \tilde\varphi_{N,h}'(y) + h^{N+1} f_{N+1}'(y) + O(h^{N+2}).

Insert this into the symplecticity conditions Φh′TJΦh′=J\Phi_h'^{\mathsf T} J \Phi_h' = J and φ~N,h′TJφ~N,h′=J\tilde\varphi_{N,h}'^{\mathsf T} J \tilde\varphi_{N,h}' = J, and use φ~N,h′=I+O(h)\tilde\varphi_{N,h}' = I + O(h). The terms of order hN+1h^{N+1} give fN+1′TJ+JfN+1′=0f_{N+1}'^{\mathsf T} J + J f_{N+1}' = 0, which says that the Jacobian of JfN+1J f_{N+1} is symmetric. By the Poincaré lemma, JfN+1=∇HN+1J f_{N+1} = \nabla H_{N+1} for a function HN+1H_{N+1} on a simply connected domain. So every truncation is a Hamiltonian system with the Hamiltonian H~=H+hpHp+1+⋯+hN−1HN\tilde H = H + h^p H_{p+1} + \cdots + h^{N-1} H_N, and its flow conserves H~\tilde H exactly.

The exponential estimate. This step is cited, not proved here. For analytic HH and an analytic method, Cauchy estimates bound the functions fjf_j on a slightly smaller domain by a constant times j!j! times a power. Choosing NN of order h0/hh_0/h, which is near the smallest term of the series, gives

∣Φh(y)−φ~N,h(y)∣≤Ch e−h0/hfor y∈K.|\Phi_h(y) - \tilde\varphi_{N,h}(y)| \le C h \, e^{-h_0/h} \quad \text{for } y \in K.

This is the theorem of Benettin and Giorgilli (1994), and Section IX.7 of Hairer, Lubich and Wanner gives it in this form.

The energy statement. The flow φ~N,h\tilde\varphi_{N,h} conserves H~\tilde H, so

H~(Φh(y))−H~(y)=H~(Φh(y))−H~(φ~N,h(y)),\tilde H(\Phi_h(y)) - \tilde H(y) = \tilde H(\Phi_h(y)) - \tilde H(\tilde\varphi_{N,h}(y)),

and ∇H~\nabla \tilde H is bounded on a neighbourhood of KK, so this difference is at most C′he−h0/hC' h e^{-h_0/h}. Summing over nn steps that stay in KK gives ∣H~(yn)−H~(y0)∣≤C′nh e−h0/h|\tilde H(y_n) - \tilde H(y_0)| \le C' n h \, e^{-h_0/h}. On KK, ∣H−H~∣≤Chp|H - \tilde H| \le C h^p, because the terms HjH_j are bounded and h≤h0h \le h_0. For nh≤eh0/2hnh \le e^{h_0/2h}, the sum is at most C′e−h0/2hC' e^{-h_0/2h}, which is smaller than hph^p for small hh, and so ∣H(yn)−H(y0)∣=O(hp)|H(y_n) - H(y_0)| = O(h^p). □\square

The exact case and the Hamiltonian form of the modified equation are proved here in full. The exponential estimate is the cited part.

Consequences

  • The exact case by hand. With h=0.5h = 0.5 and the start (x,p)=(1,0)(x, p) = (1, 0), one step gives x1=0.875x_1 = 0.875 and p1=−0.46875p_1 = -0.46875. Then E~=0.46875\tilde E = 0.46875 before and after, while HH falls from 0.50.5 to 0.49267580.4926758. In general H−12=h28(x2−1)H - \frac12 = \frac{h^2}{8}(x^2 - 1), so HH moves in the band [12−h28,12][\frac12 - \frac{h^2}{8}, \frac12] for all time.
  • The second-order term. For velocity Verlet and H=12p2+V(q)H = \frac12 p^2 + V(q) in one dimension, the first correction is h2(112V′′(q)p2−124V′(q)2)h^2 \bigl(\frac{1}{12} V''(q) p^2 - \frac{1}{24} V'(q)^2\bigr). For the pendulum V=−cos⁡qV = -\cos q from q=1q = 1, p=0p = 0, run to the time 200, the largest error in HH is 4.25×10−34.25 \times 10^{-3}, 1.06×10−31.06 \times 10^{-3} and 2.65×10−42.65 \times 10^{-4} for h=0.2,0.1,0.05h = 0.2, 0.1, 0.05, which is order 2. The error in H+h2H3H + h^2 H_3 is 2.9×10−52.9 \times 10^{-5}, 1.8×10−61.8 \times 10^{-6} and 1.1×10−71.1 \times 10^{-7}, which is order 4 (a measurement).
  • No drift in practice. The same pendulum with h=0.1h = 0.1 for 10610^6 steps has the largest energy error 1.0612×10−31.0612 \times 10^{-3} in the first 10410^4 steps and the same value in the last 10410^4. The explicit midpoint method, of the same order but not symplectic, has the error 0.0870.087 in the first 10410^4 steps, and by the end the pendulum has gained so much energy that it turns over the top, with the error 879879 (a measurement).
  • Constrained and split methods. RATTLE is symplectic on the constraint manifold, and RESPA is a composition of exact Hamiltonian flows, so both have a modified Hamiltonian when hh is small against every time scale of the system.
  • Forces must be gradients. Smooth particle mesh Ewald gives forces that are the gradient of an energy, so the theorem can apply. Plain particle mesh Ewald does not, and its runs can drift.
  • Monitoring. A computed approximation of H~\tilde H moves much less than HH, so its drift shows errors such as a loose constraint tolerance that the noise of HH would hide (Engle, Skeel and Drees, 2005).
  • Hamiltonian Monte Carlo. In HMC, the acceptance rate depends on the change of HH along a Verlet trajectory. Because the change is O(h2)O(h^2) and does not grow with the length of the trajectory, long trajectories keep a good acceptance rate.

Tightness

  • The step must be small. For the harmonic oscillator, E~\tilde E degenerates as h→2h \to 2, and for h>2h > 2 velocity Verlet is unstable. In molecular dynamics, the fastest motion sets the limit, and RESPA with an outer step near half a fast period shows resonant growth, even though each step is symplectic.
  • Analyticity. A force with a cutoff, a switch that is only a few times differentiable, or a table with linear interpolation is not analytic. Then only a finite number of terms of the modified Hamiltonian exist, and the available estimates hold only over times that grow like a power of 1/h1/h. A force that jumps at the cutoff gives energy errors at each crossing, and these add up to a drift.
  • Rounding. In floating point, every step adds rounding errors of size about the unit roundoff times HH. If they behave like independent random errors, H~\tilde H performs a random walk whose spread grows like the square root of the number of steps, a heuristic estimate.
  • The method must be symplectic and the step fixed. Changing hh from step to step, or using a method that is only accurate, breaks the argument, and the energy then drifts as in the midpoint example. Thermostats and stochastic methods change the dynamics, and the theorem is not about them.
  • The error term cannot be removed. The series for H~\tilde H diverges in general, so no method other than an exact solver conserves a modified energy exactly, except in special cases such as linear systems.
  • The region. The constants depend on the compact set KK. A trajectory that leaves every compact set, or comes close to a singularity of HH, such as two atoms that overlap, is not covered.

History

Toxvaerd (1994) showed in a molecular dynamics setting that the discrete Verlet dynamics has a conserved Hamiltonian close to the true one. In the same year, Benettin and Giorgilli (1994) proved that a symplectic map close to the identity is the time-hh map of a Hamiltonian flow up to an exponentially small error, and applied this to symplectic integrators. Reich (1999) and Hairer, Lubich and Wanner developed backward error analysis for structure-preserving methods, and their book gives the long-time energy result as Theorem IX.8.1. Skeel and Hardy (2001) and Engle, Skeel and Drees (2005) gave practical ways to compute shadow Hamiltonians and to use them to measure drift in simulations.

References

  1. Giancarlo Benettin and Antonio Giorgilli, On the Hamiltonian interpolation of near-to-the-identity symplectic mappings with application to symplectic integration algorithms, Journal of Statistical Physics 74(5-6), 1994, 1117-1143, the exponentially small error of the interpolating Hamiltonian
  2. Sebastian Reich, Backward error analysis for numerical integrators, SIAM Journal on Numerical Analysis 36(5), 1999, 1549-1570, modified equations that keep the geometric structure, with exponential estimates
  3. Ernst Hairer, Christian Lubich and Gerhard Wanner, Geometric Numerical Integration, second edition, Springer, 2006, Section IX.3 (modified equations of symplectic methods), Section IX.7 (exponentially small error estimates) and Theorem IX.8.1 (long-time energy conservation)
  4. Ernst Hairer, Christian Lubich and Gerhard Wanner, Geometric numerical integration illustrated by the Störmer-Verlet method, Acta Numerica 12, 2003, 399-450, the modified Hamiltonian of the Störmer-Verlet method and its long-time energy behaviour
  5. Søren Toxvaerd, Hamiltonians for discrete dynamics, Physical Review E 50(3), 1994, 2271-2274, the conserved Hamiltonian of the discrete Verlet dynamics in molecular dynamics
  6. Robert D. Engle, Robert D. Skeel and Matthew Drees, Monitoring energy drift with shadow Hamiltonians, Journal of Computational Physics 206(2), 2005, 432-452, the use of computed shadow Hamiltonians to measure drift in molecular dynamics

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/VGNNE7/text.yaml