Full text
arXiv:1405.3153v1 [math.NA] 13 May 2014 Numerical integrators for the Hybrid Monte Carlo method Sergio Blanes∗ , Fernando Casas† , J.M. Sanz-Serna‡ May 14, 2014 Abstract We construct numerical integrators for Hamiltonian problems that may advantageously replace the standard Verlet time-stepper within Hybrid Monte Carlo and related simulations. Past attempts have often aimed at boosting the order of accuracy of the integrator and/or reducing the size of its error constants; order and error constant are relevant concepts in the limit of vanishing step-length. We propose an alternative methodology based on the performance of the integrator when sampling from Gaussian distributions with not necessarily small step-lengths. We construct new splitting formulae that require two, three or four force evaluations per time-step. Limited, proof-of-concept numerical experiments suggest that the new integrators may provide an improvement on the efficiency of the standard Verlet method, especially in problems with high dimensionality. AMS numbers: 65L05, 65C05, 37J05 Keywords: Hybrid Monte Carlo method, Markov Chain Monte Carlo, acceptanceprobability, Hamiltonian dynamics, reversibility, volume preservation, symplectic integrators, Verlet method, split-step integrator, stability, error constant, molecular dynamics 1 Introduction The present paper constructs numerical integrators for Hamiltonian problems that may advantageously replace the standard Verlet time-stepper within Hybrid Monte Carlo (HMC) and related simulations. HMC, introduced in the physics literature by Duane et al. [9], is a Markov Chain Monte Carlo method [24] that has the potential of combining global moves with high acceptance rates, thus improving on alternative techniques that use random walk proposals [22], [3]. It is widely used in several areas, including quantum chromodynamics [14], [29], and is becoming increasingly popular in the statistics ∗Instituto de Matem´atica Multidisciplinar, Universitat Polit`ecnica de Val`encia, E-46022 Valencia, Spain. [email protected] †Institut de Matem`atiques i Aplicacions de Castell´o and Departament de Matem`atiques, Universitat Jaume I, E-12071 Castell´on, Spain. [email protected] ‡Departamento de Matem´atica Aplicada e IMUVA, Facultad de Ciencias, Universidad de Valladolid, Valladolid, Spain. [email protected] 1
literature as a tool for Bayesian inference (see e.g. [22]). A longer list of references to various application areas may be seen in [3]. At each step of the Markov chain, HMC requires the numerical integration of a Hamiltonian system of differential equations; typically, the familiar Verlet algorithm [28] has been used to carry out such an integration. Since the bulk of the computational effort in HMC lies in the simulation of the Hamiltonian dynamics, it is of clear interest to investigate whether the simple Verlet algorithm may be replaced by more sophisticated and efficient alternatives. In particular better integrators may reduce the number of rejections, something valuable in applications such as molecular dynamics where discarding a computed trajectory may be seen as a significant ‘waste’ of computational time. Although the physics literature is not lacking in efforts to construct new integrators (see e.g. [14], [29] and their references), the fact is that Verlet remains the integrator of choice. Past attempts to build integrators to improve on Verlet have typically started from the consideration of families of split-step methods with one or several free parameters; the values of those parameters are then adjusted to boost the order of accuracy and/or to reduce the size of the error constants. We shall argue here that such a methodology, while well-established in numerical analysis, cannot be expected to be fruitful within the HMC context. In fact, order of accuracy and error constants are notions that provide information on the behavior of an integrator as the step-size happroaches 0 and in HMC simulations useful integrators operate with moderate or even large values of h. In an alternative approach, we begin by associating with each numerical integrator a quantity ρ(h)that governs its behavior in simulations of Gaussian distributions (Proposition 3 and Section 4.2). More precisely ρ(h)provides an upper bound for the energy error when integrating the standard harmonic oscillator and is relevant to all multivariate Gaussian targets. We then choose the values of the free parameters to minimize the size of ρ(h)as hranges over an interval 0< h < ¯ h, where ¯ his sufficiently large.1Nu- merical experiments show that the new approach does produce integrators that provide substantial improvements on the Verlet scheme. On the other hand, when integrators derived by optimizing error constants and Verlet are used with step-lengths that equalize work, the energy errors of the former typically improve on those of Verlet only for step-sizes so unrealistically small that the acceptance rate for Verlet is (very close to) 100%. After submitting the first versionof the present work, we have become aware of two additional references, [23] and [15], that are relevant to the issues discussed here. The paper [23] considers integrators for Hamiltonian dynamics and, just as in the present work, tunes the coefficients of the methods so as to ensure good conservation of energy properties in linear problems; furthermore [23] discusses the reasons the relevance of linear models as guides to nonlinear situations. However the optimization criterion of [23] differs from ours, as it is based on maximizing the length of the stability interval, subject to the annihilation of some error constants. In [15] the authors deal with Langevin integrators and demonstrate methods which have exact sampling for Gaussian distributions. Sections 2 and 5 provide the necessary background on HMC and splitting integrators respectively; in order to cater for readers with different backgroundsthe exposition 1This approach is somewhat reminiscent of the techniques used in [6] and [5]. 2
there is rather leisurely. Section 3 studies a number of peculiarities of the numerical integration of Hamiltonian systems specific to the HMC scenario. We point out that the average size of the energy error is actually much smaller than one would first believe. In such a scenario the optimal stability property of Verlet makes the construction of a more efficient integrator a rather demanding challenge. Our methodologyfor determining the free parameters in families of integrators is based on Gaussian model problems; such models are studied in Section 4. We show in particular that, for Gaussian targets and if the dimensionality is not extremely large, the Verlet algorithm performs well with values of the step-length hthat are moderate or large. Section 6 presents our approachto the choice of free parameters. It also contains examples of methodswith two, three or four force evaluations per time-step derived by following the new methodology. The new methods clearly outperform the Verlet integrator, particularly so if the dimensionality of the problem is high. Section 7 reports some numerical comparisons in a simple molecular example and the final Section 8 is devoted to conclusions. 2 The hybrid Monte Carlo method The aim of the HMC algorithm is to obtain a Markov chain [24] to sample from a probability distribution in Rdwith density function of the form π(q)∝exp(−V(q)).(1) The algorithm introduces an auxiliary variable p∈Rd, called momentum, and works in the phase space R2dof the variables (q, p), where one considers a Hamiltonian function H(energy) H(q, p) = 1 2pTM−1p+V(q)(2) (Mis a symmetric, positive definite matrix chosen by the user) and a probability density function Π(q, p)∝exp −H(q, p)= exp −1 2pTM−1pexp −V(q).(3) Thus qand pare stochastically independent, qis distributed according to the target (1) and phas a Gaussian N(0, M)distribution. The algorithmuses transitionsin phase space (q(n), p(n))→(q∗, p∗) = Ψ(q(n), p(n)) obtained through a mapping Ψ : R2d→R2dthat is volume preserving, det(Ψ′(q, p)) = 1 (4) (Ψ′is the Jacobian matrix of Ψ), and reversible (see Fig. 1), Ψ(q, p) = (q∗, p∗)⇔Ψ(q∗,−p∗) = (q, −p).(5) If Sdenotes the mapping in phase space S(q, p) = (q, −p)(momentum flip), then the reversibility requirement reads Ψ◦S◦Ψ = S 3
−2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −3 −2 −1 0 1 2 3 q p H = 2 H = −1/8 (q,p) (q,−p) (q*,p*) (q*,−p*) Figure 1: The level sets H= 2 and H=−1/8in the phase plane (q, p)when V(q) = q4−q2. The target distribution π(q)has modes at q=±√2/2. A reversible transformation Ψthat maps (q, p)into (q∗, p∗)must map (q∗,−p∗)into (q, −p). Here the move from (q, p)into (q∗, p∗)increases the value of Hand the move from (q∗,−p∗) to (q, −p)decreases Hby the same amount. Given q(0) ∈Rd,N≥1, set n= 0. 1. Draw p(n)∼N(0, M). Compute (q∗, p∗) = Ψ(q(n), p(n))(q∗is the proposal). 2. Calculate a(n)= min 1,exp(H(q(n), p(n))−H(q∗, p∗)). 3. Draw u(n)∼U(0,1). If a(n)> u(n), set q(n+1) =q∗(acceptance); otherwise set q(n+1) =q(n)(rejection). 4. Set n=n+ 1. If n=Nstop; otherwise go to step 1. Table 1: Basic HMC algorithm. Mand Ψare respectively a positive definite matrix and a volume-preserving and reversible transformation in phase space; both are chosen by the user. The function His given in (2). The algorithm generates a Markov chain q(0) 7→ q(1) 7→ ... 7→ q(N)reversible with respect to the target probability distribution (1). 4
(◦denotes composition of mappings, i.e. (S◦Ψ)(q, p) = SΨ(q, p)), or, since S−1= S, Ψ−1=S◦Ψ◦S. (6) Table 1 describes the basic HMC procedure. A proof of the fact that the algorithm generates a Markov chain reversible with respect to the target probability distribution (1) may be seen in [17] or [25] (see also Section 2.2 in [8], which contains additional references). HMC is of potential interest because by choosing Ψappropriately it is possible to have a proposal q∗far away from the current location q(n)while at the same time having a large probability a(n)of the proposal being accepted; that is not the case for the random walk proposal in the standard Metropolis algorithm. (In Fig. 1, if the circle and the star correspond to (q(n), p(n))and (q∗, p∗)respectively, then the current location is in the neighborhood of the mode at q=−√2/2and the proposal is close to the other mode.) It is in order to recall that the reversibility of a Markovchain with respect to a target distribution is not by itself sufficient to ensure the ergodic behavior that is required for the chain to yield trajectories that may be successfully used to compute averages: additional properties like irreducibility are necessary. The discussion of these issues is outside the scope of the present work and the interested reader is referred e.g. to [8] or [17]. Many variants and extension of the procedure in Table 1 have been suggested in the literature, see, among others, [1], [4], [11], [12], [22]. It is not our purpose here to compare the merit of the different variants of HMC or to compare HMC with other sampling techniques. 2.1 Using Hamiltonian dynamics A potentially interesting choice of transformation (q∗, p∗) = Ψ(q(n), p(n))would be obtained by fixing a number T > 0and setting q∗=q(T),p∗=p(T), where (q(t), p(t)) is the solution of the system of differential equations d dtq=∇pH(q, p),d dtp=−∇qH(q, p)(7) with initial condition q(0) = q(n),p(0) = p(n). In more technical words, in this choice, Ψcoincides with the T-flow ϕH Tof the Hamiltonian system (7) [2], [10], [16], [26]. By selecting Tsuitably large, one then obtains a point (q∗, p∗) = ϕH T(q(n), p(n))away from (q(n), p(n)). Furthermore, (7) implies d dtH(q(t), p(t)) = 0 (conservationof energy), so thatin step 2 of the algorithmH(q(n), p(n))−H(q∗, p∗) = 0and, accordingly, the probability of acceptance is a(n)= 1. It is important to note here that, for each choice of T,Ψ = ϕH Tsatisfies the requirements in Table 1. In fact, the preservation of volume as in (4) is a well-known result of the Hamiltonian formalism, see e.g. [2], [10], [26]. Moreover the transformation Ψ = ϕH Tis reversible as in (5); this is checked by observing that (¯q(t),¯p(t)) = 5
(q(T−t),−p(T−t)) is the solution of (7) with initial condition ¯q(0) = q∗,¯p(0) = −p∗ and that (¯q(T),¯p(T)) = (q(n),−p(n)). Unfortunately the choice Ψ = ϕH Tis unfeasible: in cases of practical interest (7) cannot be integrated in closed form and it is not possible to compute ϕH T(q(n), p(n)). HMC then resorts to transformations Ψthat approximate the true flow ϕH T; more precisely (q∗, p∗)is obtained by integrating (7) with initial condition (q(n), p(n))with a suitable numerical method. Not all methods can be considered: Ψhas to satisfy the requirements (4) and (5). The well-known Verlet method, that we describe next, is at present the method of choice. 2.2 The Verlet integrator If h > 0and I≥1denote respectively the step-size and the number of time-steps, a velocity Verlet integration starting from (q0, p0)may be represented as Ψ(q0, p0) = (qI, pI)(8) where (qI, pI)is the result of the time-stepping iteration: pi+1/2=pi−h 2∇qV(qi), qi+1 =qi+hM−1pi+1/2, pi+1 =pi+1/2−h 2∇qV(qi+1), i = 0,1,...,I −1.(9) For our purposes, the velocity Verlet algorithm is best seen as a splitting algorithm (see [20] and [7]), where the Hamiltonian (2) (total energy) is written as a sum H= A+Bof two partial Hamiltonian functions, A= (1/2)pTM−1p, B =V(q)(10) that correspond to the kinetic and potential energies respectively. The Hamiltonian systems corresponding to the Hamiltonian functions A,Bare given respectively by (cf. (7)) d dtq=∇pA(q, p) = M−1p, d dtp=−∇qA(q, p) = 0 and d dtq=∇pB(q, p) = 0,d dtp=−∇qB(q, p) = −∇qV(q), and may be integrated in closed form. Their solution flows are respectively given by (q(t), p(t)) = ϕA t(q(0), p(0)), q(t) = q(0) + tM−1p(0), p(t) = p(0), and (q(t), p(t)) = ϕB t(q(0), p(0)), q(t) = q(0), p(t) = p(0) −t∇qV(q(0)). 6
Given q(n), p(n)∈Rd,I≥1,h > 0. 1. Set q=q(n),p=p(n),i= 0. 2. Evaluate ∇qV(q)and set p=p−(h/2)∇qV(q). 3. Set q=q+hM−1p,i=i+ 1. 4. If i < I, evaluate ∇qV(q)and set p=p−h∇qV(q), go to step 3. Otherwise go to step 5. 5. Set q∗=q, evaluate ∇qV(q), set p∗=p−(h/2)∇qV(q)and stop. Table 2: Velocity Verlet algorithm to find (q∗, p∗) = Ψ(q(n), p(n))in Table 1. Thus the Verlet time-step2(qi, pi)→(qi+1, pi+1)in (9) corresponds to a transformation in phase space (qi+1, pi+1) = ψh(qi, pi)with ψh=ϕB h/2◦ϕA h◦ϕB h/2,(11) and the transformation Ψ = Ψh,I overItime-steps (see (8)) to be used in the algorithm in Table 1 is given by the composition Ψ = Ψh,I = Itimes z}| { ψh◦ψh◦···◦ψh.(12) Here ψhis volume-preserving as a composition of volume-preserving Hamiltonian flows. Furthermore ψhis reversible because ϕB h/2and ϕA hare both reversible and the right-hand side of (11) is a palindrome (see (6)): ψ−1 h=ϕB h/2−1◦ϕA h)−1◦ϕB h/2)−1 =S◦ϕB h/2◦S◦S◦ϕA h◦S◦S◦ϕB h/2◦S =S◦ψh◦S. It then follows that Ψh,I is volume-preserving and reversible. Note that Ψh,I is an approximation to the true solution flow at time Ih:Ψh,I ≈ϕH Ih. Since ϕH Ih preserves energy exactly, the transformation Ψh,I may be expected to preserve energy approximately, so that in Table 1, H(q(n), p(n))−H(q∗, p∗)≈0leading to large acceptance probabilities. Alternatively, the roles of qand pand those of the potential and kinetic energies 2In the numerical analysis literature it is customary to write ‘step’ rather than ‘time-step’. Here we use ‘step’ to refer to the Markov chain transitions and ‘time-step’ to refer to the integration. Steps are indexed by the superindex nand time-steps by the subindex i. 7
may be replaced, to obtain the position Verlet time-stepping [28] (cf. (9)): qi+1/2=qi+h 2M−1pi, pi+1 =pi−h∇qV(qi+1/2), qi+1 =qi+1/2+h 2M−1pi+1, i = 0,1,...,I−1. This is obviously a splitting integrator: ψh=ϕA h/2◦ϕB h◦ϕA h/2.(13) The bulk of the work required to implement the Verlet velocity or position algorithms comes from the evaluation of the gradient ∇qV. In this connection it should be noted that the value ∇qV(qi+1)in (9) coincides with the value to be used at the beginning of the subsequent i+ 1 →i+ 2 time-step. Thus both the velocity and position versions require essentially one evaluation of ∇qVper time-step. In fact, in the velocity or position version, it is possible to merge the last substep of the i→i+ 1 time-step, i= 1, . . . , I −1with the first substep of the subsequent time-step. This is illustrated in Table 2 for the velocity algorithm. There is a feature of the velocity or position Verlet algorithms that, while not being essential for the validity of the algorithm in Table 1 (based on preservation of volumen and reversibility), plays an important role: symplecticness [2], [10], [16], [26]. When d= 1 symplecticness is equivalent to preservationof volume (i.e. of planar area); when d > 1it is a stronger property. The symplecticness of the Verlet algorithm is a direct consequence of two facts: (i) Hamiltonian flows like ϕA tand ϕB tare automatically symplectic and (ii) the composition of symplectic transformations is symplectic. It is well known that symplectic algorithms typically lead to energy errors smaller than its non-symplectic counterparts. 3 Integrating the equations of motion: guidelines The aim of this paper is to ascertain whether there exist alternative integrators that improve on the performance of the Verlet algorithm within HMC and related simulations. We limit our attention to one-step integrators where the approximation at time (i+ 1)his recursively computed as (qi+1, pi+1) = ψh(qi, pi). Then the transformation required by the algorithm is given by performing Itime-steps as in (12). If ψhis volume-preserving (reversible), then Ψhwill also be volume-preserving (reversible). The following considerations give some guidelines for the choice of integrator: 1. In ‘general purpose’ integrations, the error after Itime-steps (global error) Ψh,I (q, p)−ϕH Ih(q, p)(14) is of paramount importance. Here we are interested in energy errors3 ∆(q, p) = H(Ψh,I(q, p)) −H(ϕH Ih(q, p)) 3While ∆depends on hand I, this dependence is not incorporated to the notation to avoid cumbersome formulae. 8
or, by conservation of energy, ∆(q, p) = H(Ψh,I(q, p)) −H(q, p),(15) as only these determine the acceptance probability. 2. The sign of the energy error matters: ∆(q(n), p(n))<0always leads to acceptance of the proposal. In connection with the second item, it is remarkable that (see Fig. 1) if Ψis a reversible transformation and (q, p)is a point in phase space with an energy increase ∆(q, p) = H(Ψ(q, p)) −H(q, p)>0, then the point (q∗,−p∗)obtained by flipping the momentum in Ψ(q, p)leads a decrease of the same magnitude ∆(q∗,−p∗) = H(Ψ(q∗,−p∗)) −H(q∗,−p∗) = −∆(q, p)<0. Applying this argument to each point of a domain D, we see that if the transformation is also volume-preserving, to each domain Dwith ∆>0there corresponds a domain S(Ψ(D)) of the same volume with ∆<0. The conclusion is that, speaking informally, for the algorithm in Table 1 the phase space will always be divided into two regions ‘of the same volume’, one with ∆>0and the other with ∆<0(and hence leading to acceptance). It would be wrong to infer from here that the acceptance rate should always be at least 50%. In fact, the standard volume (Lebesgue measure in phase space) is of little relevance and we are rather interested in the measure Πin (3), as this gives the distribution of (q(n), p(n))at stationarity of the Markov chain. Note in Fig. 1, that a domain Dwith ∆H > 0as above has lower values of Hand carries more probability under Πthan the corresponding S(Ψ(D)); therefore when averaging ∆with respect to Πthe symmetry of the roles of the domains with positive and negative ∆will not be complete. More precisely if E(∆) = ZR2d ∆(q, p) exp −H(q, p)dq dp denotes the average energy error, in Fig. 1 we may observe E(∆) = −ZR2d ∆(q, p) exp −H(Ψ(q, p))dq dp (an analytic proof is provided in [3]). Thus E(∆) = 1 2ZR2d ∆(q, p)hexp −H(q, p)−exp −H(Ψ(q, p))idq dp =1 2ZR2d ∆(q, p)h1−exp −∆(q, p)iexp −H(q, p)dq dp and from here one may prove [3] 0≤E(∆) ≤ZR2d ∆(q, p)2exp −H(q, p)dq dp. 9
0 2 4 6 8 10 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 LOGARITHM2 OF DIMENSION ACCEPTANCE PROBABILITY 0 2 4 6 8 10 10−4 10−3 10−2 10−1 100 101 LOGARITHM2 OF DIMENSION AVERAGE DELTA Figure 2: Position Verlet algorithm. The time-step length is randomized with mean h0= 1/d (stars) or h0= 1/(2d)(squares). On the left the observed fraction of accepted steps as a function of the number of variates d= 1,2,...,1024. On the right the time-average of the energy increment as a function of d. The straight line corresponds to an increase proportional to d. (half the maximum allowed by stability). The number of time-steps was chosen as I= 2dso that T=Ih ≈2, a reasonable value to uncorrelate succesive samples of the ‘slowest’ variate q(1). The results are displayed in Fig. 2. The left panel presents the observed fraction of accepted steps; as expected (energy and energy error grow with the number of degrees of freedom) the fraction decreases as dincreases and for d= 1024 is ≈20%. (Let us observe that, according to Table 1, with an energy error ∆(q(n), p(n)) = 1 the proposal q∗will be accepted with probability exp(−1) >36%.) The figure shows that choosing h0to ensure stable integrationsis not enough to achieve high rates of acceptance when the dimensionality of the problem is large. The choice h0= 1/d works very well in this example for dless than, say, 50. The right panel displays 1 N N−1 X n=0 ∆(q(n), p(n)) i.e. the observed time-average of the energy error; this is seen to grow linearly with d in agreement with the behavior of the expectation in (31): d X j=1 ρ(jh0) = d X j=1 ρ(j/d)≈dZ1 0 ρ(z)dz; 16
in the language of statistical physics, the time-average and the ensemble average coincide, i.e. the behavior of the chain is ergodic. Next we halved the time-step size to make it a quarter of the maximum allowed by stability (h0= 1/(2d),I= 4d). The Verlet integrator works well (acceptance above 70%) with as many as 1,000 variates. The right panel in the figure very clearly bears out the h4 0behavior of the average energy error. Accordingly, halving the value of h0makes it possible to multiply by 16 the number of variates. The conclusion is that, for the problem at hand and if the dimensionality is not exceptionally high, the Verlet integrator may operate well even if the scaled (nondimensional)time-steps h0ωjare not much smaller than the upper limit imposed by stability (say if the maximum over jof h0ωjis between 1/2and 1). 5 Splitting methods In this paper we try to replace the Verlet formulae (11) or (13) by more sophisticated palindromic compositions such as: ψh=ϕB b1h◦ϕA a1h◦ϕB b2h◦ϕA a2h◦ϕB b2h◦ϕA a1h◦ϕB b1h,(32) or ψh=ϕA a1h◦ϕB b1h◦ϕA a2h◦ϕB b2h◦ϕA a2h◦ϕB b1h◦ϕA a1h(33) (ajand bjare real parameters). For the reasons outlined in Section 2, the single timestep mappings ψhin (32) or (33) are volume-preserving, reversible and symplectic. In order to simplify the notation, we shall use the symbols (b1, a1, b2, a2, b2, a1, b1) and (a1, b1, a2, b2, a2, b1, a1) to refer to (32) and (33) respectively. With a similar notation, one may consider r-stage compositions, r= 1,2,...: 2r+1 letters z}| { (b1, a1, b2,...,a1, b1)(34) or 2r+1 letters z}| { (a1, b1, a2,...,b1, a1).(35) Obviously (35) requires revaluations of ∇qVat each time-step. The same is essentially true for (34), because, as discussed for the velocity Verlet algorithm, the last evaluation of ∇qVat the current time-step is re-used at the next time-step. As in the Verlet algorithms, both (34) and (35) are best implemented by combining the last substep of the current time-step with the first substep of the subsequent time-step. 17
5.1 Taylor expansion of the energy error The Lie bracket of vector fields plays an important role in the analysis of splitting integrators (see [20] and [7]). In the Hamiltonian context, the vector-valuedLie bracket may be advantageously replaced by the real-valued Poisson bracket of the Hamiltonian functions; recall that if Fand Gare smooth real-valued functions in phase space, their Poisson bracket is, by definition, the function [2], [26] {F, G}= d X j=1 ∂F ∂q(j) ∂G ∂p(j)−∂F ∂p(j) ∂G ∂q(j) (as before, q(j)and p(j)are the scalar components of the vectors qand p). The properties of (34) or (35) are encapsulated in the correspondingmodified Hamiltonian, which, for consistent methods and in the limit h→0, has an expansion ˜ Hh=H+h2k3,1{A, A, B}+h2k3,2{B, A, B} +h4k5,1{A, A, A, A, B}+h4k5,2{B, A, A, A, B} +h4k5,3{A, A, B, B, A}+h4k5,4{B, B, A, A, B}+O(h6),(36) where kℓ,m are polynomials in the coefficients aj,bjand expressions like {A, A, B} (or{A, A, A, A, B}) are abbreviationsto refer toiterated Poisson brackets{A, {A, B}} (or {A, {A, {A, {A, B}}}}).6Order ν≥4is then equivalent to the conditions k3,1= k3,2= 0, while order ν≥6would require, in addition, k5,1=k5,2=k5,3=k5,4= 0. By using the Lie formalism, the Taylor expansion of the energy after one time-step is found to be ([26], Section 12.2) H(qi+1, pi+1) = exp(−hL˜ Hh)H(qi, pi) =H(qi, pi)−hL˜ HhH(qi, pi) + 1 2h2L2 ˜ HhH(qi, pi) + ···, where L˜ Hhis the Lie operator L˜ Hh(·) = {˜ Hh,·}. A trite computation then yields ∆(qi, pi) = h3k3,1{A, A, A, B}+h3(k3,1+k3,2){A, B, A, B}+O(h4)(37) (the iterated brackets in the right-hand side are evaluated at (qi, pi)). Thus, when his small, E∗=k2 3,1+ (k3,1+k3,2)2is a measure of energy errors. The velocity Verlet integrator has a value of E∗larger than that of its position counterpart. 5.2 Optimal stability of the Verlet integrator The application of a method of the form (34) or (35) to the standard harmonicoscillator (16) results in a recursionof the form (19) (of course Ah=Dh,A2 h−BhCh= 1 due to reversibility and volume preservation). Additionally Ahis a polynomial of degree ≤r 6Here we have used that {B, B, A, B}= 0, a condition that is implied by the fact that Ais quadratic in the momentum p(see (10)). For splittings with {B, B, A, B} 6= 0 there are six O(h4)terms in the expansion of ˜ Hh. 18
in ζ=h2and, for consistent methods, Ah= 1 −h2/2 + O(h4)as h→0. By using well-known properties of the Chebyshev polynomials it is not difficult to prove that a polynomial P(ζ)of degree ≤rsubject to the requirements P(0) = 1,P′(0) = −1/2 cannot satisfy −1≤P(ζ)≤1for 0< ζ < ζmax if ζmax >4r2. This proves that there is no choice of coefficients for which the stability interval (0, hmax)of (34) or (35) has hmax >2r(see [13]).7Furthermore since the velocity Verlet algorithm has stability interval 0< h < 2, the concatenation ψh=ψVelVer h/r ◦ ··· ◦ ψVelVer h/r of rtime-steps of length h/r is a method of the form (34) that attains the optimal value hmax = 2r; similarly the r-fold concatenation ψh=ψPosVer h/r ◦···◦ψPosVer h/r is a method of the form (35) with optimal stability interval. When comparing the size of stability intervals the computational effort has to be taken into account: with a given amount of computational work, an integrator with fewer function evaluations per time-step may take shorter time-steps to span a given time interval 0≤t≤T. It is therefore a standard practice to normalize the length hmax of the stability interval of explicit integrators by dividing by the number of force evaluations per time-step. According to the preceding discussion, the (position or velocity) Verlet algorithm and its concatenations have an optimal normalized stability interval of length 2. Integratorswith short normalized stability intervals are of no interest here as they cannot compete with the Verlet scheme (see the conclusion at the end of the preceding section). In particular and as we shall see later, high-order methods proposed in the literature have stability intervals far too short and cannot compete in practice with the performance of the Verlet scheme in HMC simulations. 6 Choice of coefficients In this section we address the question of how best to choose the number of stages rand the coefficientsajand bjin (34) or (35). In the derivationof numericalintegrators, both for general and HMC use (see e.g. [29]), it is customary to first determine rto achieve a target order of accuracy νand to then use any remaining free parameters to minimize the error constants. In the Hamiltonian scenario a standard way of minimizingthe error constants is to reduce the coefficients of the modified Hamiltonian (36). For instance, for a method of second order, one would try to minimize some norm of the vector (k3,1, k3,2). However the ideas of order of accuracy and local error constants both refer to the asymptotic behavior of the integrator as h→0and we have seen in Sections 3 and 4 that the Verlet integrator is capable of performing well in HMC simulations for rather large values of the time-step h. Accordingly, we shall determine r,ajand bjby means of a different strategy based on Gaussian models. Given a family of methods, we shall express the quantity ρ(h)defined in Proposition 3 as a function of the method 7By arguing as in [27], the conclusion hmax ≤2ralso follows from the well-known Courant-Friedrichs- Lewy restriction for the integration of hyperbolic partial differential equations. Consider the familiar wave equation ∂tQ(x, t) = P(x, t),∂tP(x, t) = ∂2 xQ(x, t)with periodic boundary conditions and discretize the space variable xby standard central differences. The highest frequency is ω= 2/∆x. A consistent, explicit, one-step integrator using rforce evaluations per time-step with stability interval longer than 2r would yield a convergent approximation to the wave problem for h/∆x > r and this violates the CFL restriction. 19
coefficients and then we shall choose these coefficients to minimize kρk(¯ h)= max 0<h<¯ hρ(h), where ¯ his a suitable maximum time-step. (It is tacitly understood that ¯ his smaller than the maximum step-size allowed by stability.) More precisely, since in Section 4 we saw that, for the standard harmonic oscillator, the Verlet method is capable of performing well in HMC simulations when h≈1, an efficient r-stage method should be able to operate well with h≈r(if that were not the case, use of the Verlet method with time-step h/r would outperform the more complex integrator with time-step h). Following this rationale, we set ¯ h=rand use kρk(r)as a metric for the quality of an integrator within the HMC algorithm.8 6.1 Two-stage methods: (a1, b1, a2, b1, a1) We start by discussing in detail methods of the form (a1, b1, a2, b1, a1). Consistent integrators have to satisfy b1= 1/2,a2= 1 −2a1and this leaves the one-parameter family (a1,1/2,1−2a1,1/2, a1).(38) The choices a1= 0 and a1= 1/2are singular; for them the integrator reduces to the velocity Verlet and position Verlet algorithm respectively. Furthermore for a1= 1/4 one time-step ψhof (38) coincides with the concatenation ψPosVer h/2◦ψPosVer h/2of two time-steps of length h/2of the position Verlet integrator. A standard computation (say using the Baker-Campbell-Hausdorff9formula [26]) yields k3,1=12a2 1−12a1+ 2 24 , k3,2=−6a1+ 1 24 . Since no choice of a1leads to k3,1=k3,2= 0, no method of the family achieves order 4, see (36). The expression E=k2 3,1+k2 3,2that measures the leading error terms turns out to be a convex function of the free parameter a1and has a minimum value E≈7×10−5at a1≈0.1932, as first observed by McLachlan [18]. For comparison, a1= 1/4, which is equivalent to the standard position Verlet integrator, yields a much worse E≈9×10−3. Therefore the choice a1≈0.193 has been recommended in the HMC context10 [29] (this paper and [18] give a representation of a1in terms of surds).11 8It is clear that it is also possible to consider alternative values of ¯ hor norms different from the maximum norm. Such a fine tuning will not be undertaken here. 9The use of the BCH formula to analyze splitting algorithms may be bypassed by following the approach in [21]. 10The paper [29] does not cite McLachlan [18] and attributes the method to later papers by Omelyan and his coworkers. 11The expansion (37) may suggest to minimize E∗=k2 3,1+ (k3,1+k3,2)2. This leads to a1= 0.1956 .... We shall not be concerned with this value of a1, as the method is very similar to the one derived via minimization of E. 20
As discussed above, we here follow a different strategy, based on Gaussian models. We first find from (26) ρ(h) = h42a2 1(1/2−a1)h2+ 4a2 1−6a1+ 12 82−a1h22−(1/2−a1)h21−a1(1/2−a1)h2.(39) Stability is equivalent tothe positivity of the denominator. Note that for a1= 0 or a1= 1/2the quotient (39) reduces to (28), as it should. When a1≤0or a1≥1/2,k3,1and k3,2are too large and the stability interval too small. Therefore, useful methods have 0< a1<1/2. In this parameter range, the stability interval is 0< h < min np2/a1,p2/(1/2−a1)o,(40) provided that a16= 1/4. When a1= 1/4, the product 2−a1h22−(1/2−a1)h2 in the denominator of (39) is a factor of the numerator and a simplification takes place: the fraction reduces to (28) with hreplaced by h/2and the stability interval is 0< h < 4in lieu of the shorter interval 0< h < 2√2in (40). This corresponds to the earlier observation that for a1= 1/4, the method coincides with the concatenation ψPosVer h/2◦ψPosVer h/2. The next task is to determine a1to minimize kρk(2). This yields a1= 0.21178 ... but, to avoid cumbersome decimal expressions, we shall instead use the approximate value12 a1=3−√3 6≈0.21132 (41) which gives kρk(2) ≈5×10−4. For comparison, a1= 1/4has a substantially larger kρk(2) ≈4×10−2and the method of McLachlan with minimum error constant has kρk(2) ≈2×10−2. Thus, when using kρk(2) as a metric, the minimum error-constant method provides only a marginal improvement on Verlet. In Fig. 3, we see that, while the minimum error constant method leads to the smallest values of ρ(h)for h < 1, the choice (41) ensures a much better behavior over the target interval 0< h < 2. We have considered again the experiment in Section 4.3, this time comparing the position Verlet algorithm with h0= 1/d and I= 2d(i.e. the parameters for the run marked by stars in Fig. 2) with members of the family (38) with h0= 2/d,I=d, so as to equalize work. The results are shown in Fig. 4. In this problem the minimum errorconstant method provides an improvement on Verlet, but its performance is markedly worse than that of the method with the value (41) suggested here. While the advantage of the method (41) over Verlet in Fig. 4 occurs for all values of d, it becomes more prominent as dincreases. A comparison of Figs. 2 and 4 shows that the fraction of accepted steps is larger for the two-stage method (41) with h0= 2/d (diamonds) than for the Verlet algorithm with h0= 1/(2d)(squares) (the latter simulation is twice as costly). 12For this choice of a1,k3,1= 0, so that the literature [19] has suggested this value for cases where in (36) {A, A, B}is much larger than {B, A, B}. 21
0 0.5 1 1.5 2 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05 h RHO VERLET MIN RHO MIN ERR 0 0.5 1 1.5 2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1x 10−3 h RHO VERLET MIN RHO MIN ERR Figure 3: ρ(h)as a function of h,0< h < 2, for three members of the family (38): a1= 0.25 (equivalent to the position Verlet algorithm), a1with mimimum error coefficient E(a1≈0.1932) and a1in (41). With a1= 0.25,ρ(h)↑ ∞ as h→4; for the other two choices the vertical asymptote is located at h≈2.55 and h≈2.63 respectively. The right pannel, with an enlarged vertical scale, 0< ρ < 0.001, shows the superiority of the minimum error coefficient method for small h. 0 1 2 3 4 5 6 7 8 9 10 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 LOGARITHM2 OF DIMENSION ACCEPTANCE PROBABILITY Figure 4: Observed fraction of accepted steps as a function of the number of variates d= 1,2,...,1024. Stars: position Verlet with (average) step-size h0= 1/d. Circles: two-stage method with minimum error constant, average step-size h0= 2/d. Diamonds: suggested two-stage method (41), (average) step-size h0= 2/d. 22
6.2 Two-stage methods: (b1, a1, b2, a1, b1) Let us now turn the attention to the format (b1, a1, b2, a1, b1). By the remark at the end of Section 4.1 the function ρ(h)of such a method coincides with that of the method of the format (a1, b1, a2, b1, a1)based on the same sequence of numerical values of the coefficients. This leads to the integrator b1=3−√3 6, a1=a2= 1/2, b2= 1/2−b1, that has k3,1=6λ−1 24 , k3,1+k3,2=−12λ2+ 18λ−3 24 , λ =3−√3 6. For (38) with a1given in (41)13 k3,1= 0, k3,1+k3,2=−12λ2+ 18λ−3 24 ; we find no reason to prefer in this context the (b1, a1, b2, a1, b1)sequence, since both methods share the value of k3,1+k3,2and |k3,1|is smaller for the (a1, b1, a2, b1, a1) format. For reasons of brevity we shall not consider again in what follows formats beginning with the letter b. 6.3 Three stages For the three-stage format (a1, b1, a2, b2, a2, b1, a1), consistency requires a2= 1/2− a1,b2= 1 −2b1and therefore we have to consider the two-parameter family (a1, b1,1/2−a1,1−2b1,1/2−a1, b1, a1). The choice a1= (1/2)(2 −21/3)−1,b1= 2a1leads to a fourth-order integrator (k3,1=k3,2= 0) that goes back to Suzuki, Yoshida and others, see e.g. [26], Chapter 13. Its stability interval is very short: approximately 0< h < 1.573. In the HMC context, this fourth order integrator has been considered by the physics literature, see e.g. [14], [29]; the former reference notes the poor stability properties. According to our methodology, we choose the free parameters so as to minimize the maximum of ρ(h)over the interval 0< h < 3. The situation is somewhat delicate, as we shall explain presently. Let us first consider the choice a1= 1/6,b1= 1/3, leading to the concatenation ψPosVer h/3◦ψPosVer h/3◦ψPosVer h/3, that as discussed in Section 5.2 possesses optimal stability interval (0,6). At h= 3, this method has Ah=−1, Bh=Ch= 0. Furthermore h= 3 is a simple root of the equations Bh= 0 and Ch= 0 and a double root of the equation Ah=−1. By the implicit function theorem, 13The lack of symmetry of the (a1, b1, a2, b1, a1)and (b1, a1, b2, a1, b1)formats is due to the fact that (37) is not symmetric in Aand B, which in turn is a consequence of the fact that {B, B, A, B}= 0 while nothing can be said in general about {A, A, B, A}. 23
when the coefficients a1and b1are perturbed away from a1= 1/6,b1= 1/3, the root h= 3 of the equation Bh= 0 moves to a location hB(a1, b1)≈3. In a similar manner, the root of Ch= 0 moves to a location hC(a1, b1)≈3, that, generically, does not coincide with hB(a1, b1). Now, the relation A2 h= 1 + BhCh, that follows from conservation of volume, ensures that both hBand hCare roots of Ah=−1. In other words, perturbations generically change the double root h= 3 of Ah=−1 present in the concatenated Verlet method into two real simple roots hB,hC; in the neighborhood of such simple roots Ahcannot remain ≥ −1and we conclude that, for generic perturbations, the integrator is unstable near h≈3. In order to identify integrators (not necessarily close to the concatenated Verlet method) that do not turn unstable for h≈3due to Ahbecoming <−1we proceed as follows. We write Ah,Bh,Chin terms of the parameters a1,b1(the expressions are cumbersome and will not be reproduced here), fix a value b hand consider the system of two (nonlinear) equations Ab h=−1, Bb h+Cb h= 0,(42) for the two unknowns a1,b1. When these relations hold, from A2 h−BhCh= 1, we infer thatBb h=Cb h= 0 andb his a stable value. Furthermore, if ′denotesdifferentiation with respect to h, 2AhA′ h−B′ hCh−BhC′ h= 0 and therefore A′ b h= 0, so that Ahwill have a minimum at h=b hand thus remain ≥ −1in the neighborhood of b h. Note also that in (26), the zero of the denominator at h=b hmay be simplified with the corresponding zero of the numerator (an occurrence we already found when discussing (39) and entails an ‘enlargement’ of the stability interval). We solve the system of equations (42) and find the following family of integrators parameterized by the location b hof the double root of Ah=−1: a1=1 2−3 b h2±p9−b h2 b h2, b1=3 b h2±p9−b h2 b h2,0<b h≤3.(43) For b h= 3, the integrator is the concatenation of three Verlet substeps discussed above. For b h= 2√2and the positive value of the square root, we find a1= 0,b1= 1/4 and the integrator is ψVelVer h/2◦ψVelVer h/2, with stability interval 0< h < 4. The negative value of the square root leads to a1= 1/4,b1= 1/2(b2= 0), i.e. to ψPosVer h/2◦ψPosVer h/2, whose stability interval is again 0< h < 4.14 Finally we determine b hin (43) by minimizing kρk(3). This yields the parameter values a1= 0.11888010966548, b1= 0.29619504261126,(44) with kρk(3) = 7 ×10−5and stability interval of length ≈4.67 (the double root is located at b h≈2.98).15 14Not all members of the family of methods (43) are stable for all values of h,0< h < 3, as instability 24
1 2 3 4 5 6 7 8 9 10 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 LOGARITHM2 OF DIMENSION ACCEPTANCE PROBABILITY Figure 5: Observed fraction of accepted steps as a function of the number of variates d= 2,4,...,1024. Stars: position Verlet algorithm with (average) step-size h0= 1/d. Triangles: three-stage method (44) with h0= 3/d. An illustration of the performanceof the new integratormay be seen in Fig. 5 which refers again to the experiment in Section 4.3. The position Verlet algorithm is run with h0= 1/d (as in Figs. 2 and 4) and, in order to equalize work, the three-stage method (44) was used with h0= 3/d. The number of time-steps was taken to be (the integer closest to) 2d/3for (44) and thrice that number for Verlet, so that the (average) final time is T= 2 and both methods use the same number of force evaluations. The advantage of the three-stage method over both Verlet and the optimized 2-stage integrator is clearly felt. It is of interest to point out that with the present choice h0= 3/d the fourthorder, three-stage integrator is unstable; in fact h0would have to be halved to barely ensure stability. However, when the step-length is halved, Verlet delivers satisfactory acceptance rates as we saw in Fig. 2. We conclude that the benefits of high order only take place when h0is too small for the goals of the integration. 6.4 Four stages With four stages (a1, b1, a2, b2, a3, b2, a2, b1, a1), by using a similar procedure we find the method, with kρk(4) ≈7×10−7, a1= 0.071353913450279725904, a2= 0.268548791161230105820, b1= 0.191667800000000000000 (45) may also occur by Ahbecoming larger than 1. 15The perturbation argument presented above for the concatenated Verlet method applies to perturbations of any member of the family (43): generic perturbations turn the double root into two simple real roots, which leads to instability near b h. 25