Molecular Dynamics Lecture 2 Ben Leimkuhler the problem of the timestep in md splitting methods in Langevin dynamics constraints multiple timestepping Spring School, WIAS, Berlin 2017
fruit fly alanine dipeptide (the fruit fly of biomolecules)
Measure of diffusion: exploration rate in alanine dipeptide this means frequent recrossings of a particular free energy barrier recrossings
Harmonic Oscillator q = p Stability Threshold ṗ = 2 q leapfrog/verlet eigenvalues: i t =2 increasing t stable for t apple 2-1 0 1 -i symplectic for all but only useful for small t t
Oscillatory modes of bio-md stability threshold 3fs 6fs 12fs calibrates the stepsize in molecular dynamics
Ways to improve efficiency More accurate (less-biased) approximation in equilibrium Faster convergence to equilibrium larger timesteps (less force evaluations for the same rate of phase space exploration) Today s lecture: 1. Langevin dynamics and splitting methods for better accuracy and more rapid convergence of averages 2. constraints and multiple timestepping to increase the timestep in MD
Generalized Langevin Dynamics (Q, P ) (q i,p i ) An instance of Mori-Zwanzig reduction deterministic model for noise process friction kernel
Large Bath Limit Memory kernels in various scenarios: Typically approach delta-function in the limit of large auxiliary system Noise process typically models, in the weak sense, the effect of a Wiener process [See e.g. works of A. Stuart] dq = P dt dp = ru(q)dt P dt + dw
Fokker Planck Equation for LD For a system Forward Kolmogorov or Fokker-Planck operator: Invariant distribution: (q, p) =e H(q,p)
Geometric Ergodicity of Langevin Dynamics Geometric convergence relies on establishing: (1) minorization condition (2) stability condition Key part of (1): existence of a smooth transition density, usually shown by demonstrating that the operator is hypoelliptic by use of a parabolic Hörmander condition. (2) usually shown by obtaining a Lyapunov function
Hypoelliptic Property dx = b 0 (X)dt + kx b i (X)dW i 2 R n i=1 L is hypoelliptic in if the SDE satisfies the parabolic Hörmander condition in Span b k i=1, [b i,b j ] i=1,2,...,k,j=0,1,...,k, [b i,b j,b k ],... = R n A mixing condition for SDEs. Langevin dynamics: @ qi = e i, @ pi = e i+n [@ pi,p i @ qi ]= @ qi
Lyapunov Function A Lyapunov function for the SDE is defined as a function satisfying for some positive constants, For Langevin dynamics, as shown by [Mattingley, Higham and Stuart, 2002], we may use We can choose l to bound a sufficiently large class of observables, giving exponential convergence for that class.
Stronger assumption: bounded q, e.g. Periodic BCs Lyapunov function 1+ p 2s Decay ( geometric ergodicity ) Regularity
Splitting Methods (M=I) Time stepsize p := e t t p + q (1 e 2 t ) 1 N (0, 1) p := tf(q) q := q + tp
Splitting Methods L = A + B + O A = p T M 1 r q B = ru(q) T r p O = p T M 1 r p + 1 p Propagator: Splitting Method: P t = e tl P t e ta e tb e to Corresponds to ABO! (Vertauschungssatz) OBA OAB ABOBA OBABO
In L., Matthews & Stoltz 2015 after Talay 2002, Mattingly 2002, Bou-Rabee & Owhadi 2010, Hairer and Mattingley 2010 kp n tk apple Ke n t discrete propagator Z (P n tf)(q, p) fdµ, t apple K(1 + p 2s ) e n t kfk L 1 1+ p 2s Uniform in stepsize exponential decay i.e., geometric ergodicity of the numerical method
Invariant Measure of Numerical Method The stable equilibrium distribution can be understood as a perturbation of the Gibbs distribution, with density ˆ,, = e H The error in long-term averages is thus directly related to the quality of this approximation. How to calculate the error?
Ex: P t e ta e tb e to BCH: P t = e t[l + tl 1+ t 2 L 2 +...] Invariant density: [L + tl 1 + t2 L 2 +...]ˆ =0 For symmetric splittings: [L + t 2 L 2 +...]ˆ =0 Proposal: ˆ = (1 + t 2 d 2 +...)
Operator expansions from Baker-Campbell-Hausdorff: e.g. for BAOAB: h L 2 2 = 4 qu(q) p T U 00 (q)p + 4 p T U 00 (q)ru(q) 12 p r qp T U 00 (q)p.
Expansion of the invariant distribution (Talay-Tubaro expansion 1 in the ergodic limit) Leading order: L. & Matthews, AMRX, 2013 L., Matthews, & Stoltz, IMA J. Num. Anal. 2015 detailed treatment of all 1st and 2nd order splittings estimates for the operator inverse discrete inv. measure treatment of nonequilibrium (e.g. transport coefficients) 1 Denis Talay and Luciano Tubaro. Expansion of the global error for numerical schemes solving stochastic differential equations. Stochastic Analysis and Applications 4 (1990)
Two level expansion For each of ABOBA and BAOAB, we find the first terms of the two-level expansion " =1/
Configurational Sampling Integrate out with respect to momenta...and discover a surprise: Proposition: The marginal (configurational) distribution of the BAOAB method has an expansion of the form = e U (1 + O( t 2 " 2 )+O( t 4 )) In the high friction limit: 4th order, and with just one force evaluation per timestep.
Perturbed Quartic (1D) Langevin Configurational Accuracy vs timestep Weak Friction Strong Friction
Testing Methods for Biological Molecules Biomolecular models include many force terms complicated landscape Stiff bonds NH, OH.. dominant harmonic terms Presence of H2O alternate diffusion mechanism basins + barriers long sampling times/rare events Accuracy requirements not always transparent goals of simulation may include dynamics or sampling Methods need to balance diffusion rate vs accuracy of basin approximation
Diffusion vs Accuracy With BAOAB, we would imagine it to be better to use large friction coefficient γ 4th order (BAOAB Limit Method) But... γ strongly affects the diffusion rate Friction (1/ps) 10 2 10 0 BAOAB ABOBA SPV VGB LI BP BBK -2 10 1 1.5 2.25 3 Step size (fs) recrossings 0 600 1200 Friction (1/ps) 10 2 10 0-2 10 1 1.5 2.25 3 Step size (fs) self-diffusion (m 2 /s) 10-9 10-8 10-7
Measuring Accuracy Canonical density for solvated alanine dipeptide is a function in a 3200 dimensional space. Convergence and order of accuracy depend on how we collapse the space. Examples: hp 2 i i = 1 kinetic temperature hu(q)i DX qi ru(q i )E = 1 average potential energy a configurational temp
Solvated Systems for alanine dipeptide in flexible water Relative Error 10 0 10 1 10 2 (a) Configurational Temperature Error BBK, BP SPV, ABOBA LI VGB BAOAB Relative Error 10 1 10 2 10 3 (b) Average Total Potential Energy Error BBK, BP LI SPV, ABOBA VGB BAOAB ABOBA VGB SPV BP LI BBK EM EB 10 3 BAOAB 2 2.25 2.5 2.75 Stepsize (fs) 10 4 2 2.25 2.5 2.75 Stepsize (fs) BAOAB much better than alternatives for relevant (i.e. configurational) quantities up to the stability threshold and At moderate friction!
If we are not in the high friction limit, why is BAOAB so much better? Harmonic Oscillator: ABOBA and BAOAB are exact for average potential
Harmonic Oscillator Configurational Sampling Error in average q 2 10 1 10 0 10 1 10 2 10 3 1st order line BBK, BP VGB 2nd order line EB EM LI SPV BAOAB, ABOBA BAOAB ABOBA VGB SPV BP LI BBK EM EB 10 4 0.25 0.5 1 2 Stepsize BAOAB and ABOBA both are exact for PE But...this is only part of the story since BAOAB is much better than ABOBA for real molecules
Anharmonic model problem U(q) = q2 2 + q4 Asymptotic analysis of sampling error of hq 2 i typical, e.g. OBABO: O( t 2 ) ABOBA: BAOAB: O( t 2 ) 9 2 t 2 6 2 +8 + O( 2 t 4 )
The Timestep Problem in MD Find timestepping methods that allow t t Verlet Three possibilities: Use an implicit method Eliminate the motion of fast components constraints Isolate the stiff terms for efficient treatment multiple timestepping
Implicit Methods e.g. implicit midpoint (unconditionally stable) Requires solution of a nonlinear system of equations by some iterative procedure, e.g. fixed point iteration, z (k+1) n+1 = z n + h 2 (f(z n)+f(z (k) n+1 )) need to iterate to convergence requires multiple f-evaluations
Implicit Methods Even if stable, a method can alter model frequencies At large stepsize, high frequencies become low frequencies! Leads to nonphysical resonances of dynamical modes, e.g. bond stretch directly impacting a dihedral bend
Constraints
The Timestep Problem in MD Find timestepping methods that allow t t Verlet Three possibilities for deterministic methods Use an implicit method Eliminate the motion of fast components constraints Isolate the stiff terms for efficient treatment multiple timestepping
Pendulum stiff harmonic spring rigid rod (holonomic constraint) q = m 1 p tension ṗ = apple 0 g q grav 0=q q 1
Constrained Hamiltonian Systems d dt q = M 1 p d dt p = F X m i=1 irg i (q ) 0=g j (q ), j =1, 2,...,m 0=rg j (q ) T M 1 p, j =1, 2,...,m cotangent bundle hidden constraints T M = {(q, p) g j (q) =0, rg j (q ) T M 1 p =0,j =1, 2,...,m} symplectic: dynamics preserves [dq ^ dp] T M
SHAKE [Berendsen, Ciccotti, Ryckaert 1977] RATTLE [Andersen 1983] L. & Skeel, J.Comput. Phys, 1994 SHAKE and RATTLE are symplectic methods and are actually the same method (conjugate methods).
Microcanonical Sampling Verlet limited to about 2.7fs with stability 1fs with 1 kcal/mol energy accuracy SHAKE (RATTLE) OK up to as much as 4fs with energy accuracy (typical ~2-3fs)
No Solution Solution Not Unique Large stepsize relative to curvature large errors (or instability)
Geodesic Integrator
Geodesic Integrator B.L. and G. Patrick, J. Nonlin. Sci. 1996 (deterministic) B.L. and C. Matthews, Proc Roy Soc A 2016 (stochastic) An alternative to SHAKE discretization Idea: preserve the configuration manifold during position moves and the cotangent space during impulse. The proper analogue of the Verlet (BAB) g-verlet: B A B h,h T M h/2,ut M h,t T M h/2,u T M Combines: geodesic flow projected kicks
Constrained Langevin Dynamics d dt q = M 1 p d p dt p = F p + 2k B T M 1/2 (t) 0=g j (q ), j =1, 2,...,m mx i=1 irg i (q ) 0=rg j (q ) T M 1 p, j =1, 2,...,m T M = {(q, p) g j (q) =0, rg j (q ) T M 1 p =0,j =1, 2,...,m} Some precisions: Lelievre, Rousset and Stoltz, Math. Comp., 2010
Geodesic Integrator Numerical Analysis Constrained Hamiltonian system in coordinates Splittings BCH (nastier commutators) BAOAB 2nd order superconvergence
Implementation To implement the geodesic integrator, we use a sequence of SHAKE/RATTLE steps for the A step These steps do not require re-evaluation of the force field, so each iteration is relatively cheap. The B and O (for Langevin) steps are simple RATTLE projections, so there is no significant added cost for these. No need for Hessians/normal modes, or tuning/parameterization
Box of H2O For rigid body water, implement the geodesic integrator using SETTLE: exact geodesic steps Standard Methods Our Schemes
Self-Diffusion Coefficient of TIP3P Water Self-diffusion coeff of TIP3P water in water ~ 4.51x10^-5 Appx 2x the experimental value! 2.34±0.05cm 2 /s
Solute-Solvent Splitting The object of bio-md simulation is virtually always a protein or nucleic acid fragment + solvent (water) bath. OnceOn Once the bonds and selected (H-X-H, X-Y-H) angles of the solute and waters are constrained, the next fastest modes are due to flexible angle bonds of the solute. These would limit the stepsize to around 5fs, even with the geodesic integrator.
Solute-Solvent Splitting The obvious solution is to break the interaction forces into three pieces, denoted PP (protein-protein), PS (protein-solvent), and SS (solvent-solvent) exp SS dominates the computational cost. PP and PS determine the stepsize. Therefore, consider multiple timestepping: h 2 U SS(q) exp h 2 [T (p)+u PP(q)+U PS (q)] m=2 or m=3 iterations of a geodesic Langevin integrator using k=5 RATTLE substeps exp 1. PP+PS is viewed as a many-body, stochastic system 2. Water motion can be implemented using SETTLE. h 2 U SS(q)
Comparisons RATTLE: Standard RATTLE + Langevin TINKER: Tinker s internal scheme [OBABO with constraint projections] MEVME: Scheme of Lelievre, Rousset, Stoltz 2010 MTS-BAOAB: geodesic-mts method, using 20 steps to compute the geodesics and m=3 (PP+PS) steps per step
Alanine Dipeptide, Solvated, 300K, Tinker Code illustrative FE surface
Alanine Dipeptide Effective Free Energy Barrier Height Existing methods
Multiple timestepping
The Timestep Problem in MD Find timestepping methods that allow t t Verlet Three possibilities for deterministic methods Use an implicit method Eliminate the motion of fast components constraints [~ 8 or 9fs] Isolate the stiff terms for efficient treatment multiple timestepping
Multiple Timestepping (RESPA) Tuckerman, Martyna, Berne 90 also Grubmüller, Heller, Windemuth, Schulten 91 Some forces are fast-changing (e.g. short-ranged) but cheap to compute Some forces are slow-changing (e.g. long-ranged) and costly to compute t exp 2 L U slow apple t t exp 2r L U exp fast r L K exp t exp 2 L U slow r t 2r L U fast Many fast cheap evaluations Few slow costly ones
Linear Model Problem model problem H = p2 2 + (1 + 2 )q 2 2 1 idealized multiple timestepping (fast solve is exact) U S (q) =q 2 /2 U F (q) = 2 q 2 /2 Kick with U S Solve H F = p 2 /2 + U F (q) Kick with U S t/2 t t/2
Resonance Eigenvalues of timestep map: 1 2 = 1; 1 + 2 = 2 cos( t ) " / t / < 0 sin( t ) instabilities t
Resonance For the harmonic model, Verlet introduces a stability restriction t < 2/ Multiple timestepping, in the idealized form described here has a stability restriction of about t< / i.e., not very dramatic improvement. In practice, we are limited to around 3.5fs
Mollified Impulse Method Garcia-Archilla, Sanz-Serna and Skeel 1998 To stabilize multiple timestepping, one idea is to average out over an associated fast dynamics to ``mollify the impulse in RESPA starting from e.g (q,0), solve to produce a sequence then define: 0 = q, 1, 2,..., K Advance the step using a mollified impulse: Ũ(q) :=U s (A(q))
Pushing the limits SHAKE-MOLLY [Izaguirre, Reich, Skeel 1999] constrains the slow force evaluations to lie exactly at the bond stretch minima (multiple timestepping + constraints). This allows fully flexible MD with larger stepsizes With the very best deterministic schemes, however, we find for a biological molecule: t. 5fs Bob Skeel s license plate ca. 2000: FEMTO5
Stochastic Methods Introducing random perturbations might seem to complicate the numerical integrator. In fact, if done correctly, it is possible to gain in two ways: 1) a significant stability improvement is possible 2) substantially higher accuracy is possible by shifting emphasis to the invariant distribution We have already seen this in the behavior of Langevin vis a vis Hamiltonian dynamics. These benefits carry over to multiple timestepping and constraints.
Langevin-RESPA L. & Mathews, Molecular Dynamics, Springer 2015 It is natural to think that stochastic perturbations may have a stabilizing influence on multiple timestepping. Consider the combination of Langevin (stochastic) dynamics with RESPA,
Fast Dynamics: Combine with kicks by the slow force
Stability if (X) apple 1
sampling error noise strength Verlet stability threshold timestep Langevin can stabilize RESPA but sampling accuracy is severely compromised except at high friction
Configurational Sampling H(q, p) =p T M 1 p/2+u(q) e H = e T (p) e U(q) In MD we typically are interested in q-dependent quantities. The Hamiltonian is used to enhance exploration but ultimately we don t much care about momenta. Question: can we use this freedom, together with stochastic dynamics, to control resonance in multiple timestepping while taking advantage of a known force field decomposition?
Stochastic Isokinetic Nosé-Hoover (SIN) L., Margul and Tuckerman, Mol. Phys. 2013 q = p ṗ = F (q) p 1 = 1 1 2 2 = 2 1 kt 2 + p 2 kt (t) = 2p F 2 1 2 2K(p, 1 ) to make K(p, 1 ):=p p + 2 1 2 =kt isokinetic constraint
Questions What is the invariant measure of the SIN system? Is the dynamics ergodic? How to numerically integrate the equations? What is the performance in practice?
Compressible statistical mechanics M. E. Tuckerman, Y. Liu, G. Ciccotti, and G. J. Martyna, J. Chem. Phys. 115, 1678 (2001). ẋ = f(x) conservation laws: C j (x) =c j,j =1, 2,...,k phase space compressibility: apple(x) =divf(x) and find: apple = L f w Then, if ergodic, the partition function is: Z (N,V, 1 )= e w(x) k j=1 [C j (x) c j ]dx
q = p ṗ = F (q) f(x) p 1 = 1 1 2 OU 2 = 2 1 kt 2 + p 2 kt (t) apple(x) =divf(x) = 2 p@ /@p 1 @ /@ 1 2 = L f [U(q)+ 2 2/2] an invariant distribution is given by (x) =e U(x) e 2 2 /2 [K(p, 1 ) kt ]
(x) =e U(x) e 2 2 /2 [K(p, 1 ) kt ] Dynamics evolves on the generalized semi-cylinder defined by periodic boundary conditions (q), and the isokinetic constraint on (p, 1 ), with the restriction 1 > 0 We need to demonstrate the Hörmander condition on the manifold, and find a Lyapunov function. Lyapunov function: ( 2 )=1+ 2s 2
Hörmander Condition SDE mx ẋ = b 0 (x)+ b i (x) i (t) i=1 b j 2 T M Existence of a unique invariant measure on M is assured if the collection of iterated commutators of the vector fields spans the tangent space at ever point. span{b m i=0, [b i,b j ] m i,j=0,...,} = T M 1 constraint, 4 variables, thus 3-dimensional tangent space
Ergodicity Property of SIN Span{ } = T M Thus conclude (subject to a minorization condition, left as an exercise) that SIN is ergodic on M with a unique invariant distribution which, after marginalization reduces to: (x) =e The Alexander Davie commutator U(x)
SIN(R) Stochastic Isokinetic Nosé-Hoover (RESPA)
periodic box, 25A sides, 512 fully flexible SPC water molecules (all atom) periodic boundary conditions three level splitting U = U bond + U s.r. + U l.r. Coulombic forces: Smooth Particle Mesh Ewald Long ranged forces includes reciprocal space part + screened coulomb interactions within the simulation cell Short-ranged Regime: e.g. Lennard-Jones cutoffs to 6A, real space part of Ewald. Bond part: Intramolecular interactions, e.g. angle and length bonds.
Flexible H2O simulations @ t = 99fs t inner =0.5fs, t= 3fs mid radial distributions O-O H-O H-H
Comparisons for biomolecules/detailed H2O timestep Speedup Notes typical MD 1fs 1 fully flexible typical Langevin MD 2fs 2 fully flexible BAOAB Langevin 2.7fs 2.7 optimized for config sampling MTS (RESPA) 3.5fs ~3 resonances limit stability SHAKE MD 4fs 3.5 symmetric Newton SHAKE Langevin 4fs 3.5 MEVME, g-obabo, etc. Equilibrium-MOLLY Izaguirre, Reich &Skeel (JCP, 99) 6fs 4+ deterministic MTS-based force decomposition g-baoab-mts 8-9fs 6-7 Langevin, geodesics (RATTLE), PP+PS+SS decomposition Colored noise thermostats to control resonance in MTS Ceriotti et al LN, Langevin normal mode analysis, Barth&Schlick Stochastic-Isokinetic Nose (L., Margul, Tuckerman) 10-12fs?? 48fs 10 ~100fs >10 pre-analysis of fundamental frequencies (Hessians/normal modes) and tuning of parameters requires Hessians+ force decomposition force decomposition (Ewald) q-sampling *only*
Next Up In Lecture 3, we say goodbye to biomolecules and look at how thermostats can be extended and enhanced to address other types of problems: