1 CE 530 Molecular Simulation Lecture 23 Symmetric MD Integrators David A. Kofke Department of Chemical Engineering SUNY Buffalo kofke@eng.buffalo.edu 2 Molecular Dynamics Integration Equations of motion in cartesian coordinates dr j dt dp j dt pj r (rx , ry ) m p ( px , p y ) Fj 2-dimensional space (for example) N F j Fij pairwise additive forces i 1 i j Previously, we examined basic MD integrators F • Verlet family Verlet; Leap-frog; Velocity Verlet • Popular because of their simplicity and effectiveness Today we will consider • Symmetry features that make the Verlet methods work so well • Multiple-timestep extensions of the Verlet algorithms 3 Integration Algorithms Features of a good integrator • • • • minimal need to compute forces (a very expensive calculation) good stability for large time steps good accuracy conserves energy and momentum noise less important than drift The true (continuum) equations of motions display certain symmetries • time-reversible • area-preserving (symplectic) Good integrators can be constructed by paying attention to these features 4 Symmetry An object displays symmetry if some transformation leaves it (or something about it) unaltered Original shape 90º rotation Horizontal reflection 5 Time Symmetry Path traced by a mechanical system is unchanged upon reversal of momenta or time • e.g., motion in a constant gravitational field x(t ) x0 v0t 12 gt 2 v(t ) v0 gt Another view dr j • Substitution dt dp j p p t t dt leaves equations of motion unchanged pj m Fj An Irreversible Integrator Forward Euler • well known to be quite bad r (t d t ) r (t ) p(t )d t 12 F(t )d t 2 unit mass p(t d t ) p(t ) F(t )d t Examine time reversibility • Assume we have progressed forward in time an increment dt; positions and momenta are now r f (t ), p f (t ) 6 An Irreversible Integrator Forward Euler • well known to be quite bad r (t d t ) r (t ) p(t )d t 12 F(t )d t 2 unit mass p(t d t ) p(t ) F(t )d t Examine time reversibility • Assume we have progressed forward in time an increment dt; positions and momenta are now r f (t ), p f (t ) • Reverse time, and step back to original condition rr (to d t d t ) r f (to d t ) p f (to d t )(d t ) 12 F(to d t )(d t ) 2 p r (to d t d t ) p f (to d t ) F(to d t )(d t ) 7 An Irreversible Integrator 8 Forward Euler • well known to be quite bad r (t d t ) r (t ) p(t )d t 12 F(t )d t 2 unit mass p(t d t ) p(t ) F(t )d t Examine time reversibility • Assume we have progressed forward in time an increment dt; positions and momenta are now r f (t ), p f (t ) • Reverse time, and step back to original condition rr (to d t d t ) r f (to d t ) p f (to d t )(d t ) 12 F(to d t )(d t ) 2 p r (to d t d t ) p f (to d t ) F(to d t )(d t ) • Insert from above for r f (to d t ), p f (to d t ) rr (to ) r f (to ) p(to )d t 12 F(to )d t 2 p(to ) F(to )d t (d t ) 12 F(to d t )( d t ) 2 p r (to ) p f (to ) F(to )d t F(to d t )(d t ) An Irreversible Integrator 9 Forward Euler • well known to be quite bad r (t d t ) r (t ) p(t )d t 12 F(t )d t 2 unit mass p(t d t ) p(t ) F(t )d t Examine time reversibility • Assume we have progressed forward in time an increment dt; positions and momenta are now r f (t ), p f (t ) • Reverse time, and step back to original condition rr (to d t d t ) r f (to d t ) p f (to d t )(d t ) 12 F(to d t )(d t ) 2 p r (to d t d t ) p f (to d t ) F(to d t )(d t ) • Insert from above for r f (to d t ), p f (to d t ); Cancel rr (to ) r f (to ) p(to )d t 12 F(to )d t 2 p(to ) 12F(to )d t (d t ) 12 F(to d t )( d t ) 2 p r (to ) p f (to ) F(to )d t F(to d t )(d t ) 10 An Irreversible Integrator Forward Euler • well known to be quite bad r (t d t ) r (t ) p(t )d t 12 F(t )d t 2 unit mass p(t d t ) p(t ) F(t )d t Examine time reversibility • Assume we have progressed forward in time an increment dt; positions and momenta are now r f (t ), p f (t ) • Reverse time, and step back to original condition rr (to d t d t ) r f (to d t ) p f (to d t )(d t ) 12 F(to d t )(d t ) 2 p r (to d t d t ) p f (to d t ) F(to d t )(d t ) • Insert from above for r f (to d t ), p f (to d t ); Simplify rr (to ) r f (to ) 12 F(to d t ) F(to ) d t 2 p r (to ) p f (to ) F(to d t ) F(to ) d t dt • Equal only in limit of zero time step Inequality indicates lack of time reversibility Verlet integrators are time reversible F(t ) F(t d t ) 11 Symplectic Symmetry 1. Consider motion of a single particle in 1D • Described using a 2D phase space (x,p) • Hamiltonian H ( p, x) 12 p 2 V ( x) • Equations of motion dx H dp dt • Phase space p p dt unit mass H F ( x) x p {p(t),x(t)} trajectory x • Forthcoming result are easily generalized to higher dimensional phase space, but hard to visualize 12 Symplectic Symmetry 2. Consider motion of a differential element through phase space • Shape of element is distorted by motion • Area of the element is preserved p p x p p x p x x p x x This is a manifestation of the symplectic symmetry of the equations of motion 13 Classical Harmonic Oscillator Exactly solvable example dx p dt dp x dt H ( p, x) 12 p 2 12 x 2 x(0) x0 p(0) p0 Solution 2 1 x x0 cos t p0 sin t p x0 sin t p0 cos t H (t ) 12 p02 12 x02 constant 0 -1 -2 -2 -1 0 1 2 14 Liouville Formulation 1. Operator-based view of mechanics Very useful for deriving symplectic, time-reversible integration schemes Consider an arbitrary function of phase-space coordinates • and thereby a function of time f x(t ), p (t ) f f • time derivative is f x x p p Define the Liouville operator iL x So p x p f iLf 15 Liouville Formulation 2. Operator form f iLf t This has the solution f (t ) eiLt f (0) • in principle this gives f at any time t • in practice it is not directly useful Let f be the phase-space vector f Γ(t ) x(t ), p(t ) T • then the solution gives the trajectory through phase space Harmonic oscillator x cos t sin t xo p sin t cos t p o cos t sin t eiLt sin t cos t 16 Separation of Liouville Operator 1. Position and momentum parts p x p iLx iL p iL x Propagator of either part can be solved analytically by itself iLx Γ x x x x p 0 x(t ) x0 p0t p(t ) p 0 x 0 p p p x (t ) x0 p (t ) p p t 0 0 iL p Γ p 1 t eiLx t 0 1 17 Separation of Liouville Operator 2. Liouville components do not commute • result differs depending on order in which they are applied iLx iL p iL p iLx Otherwise we could write iLxt iL p t eiLt e iL p t eiLxt e This is incorrect We could then apply each propagator in sequence to move the system ahead in time eiLt Γ eiLxt eiLpt Γ Advance momentum Advance position 18 Trotter Expansion The following relation does hold e A B lim e A / 2 P e B / P e A / 2 P P P • for example, if P = 2 e A / 4e B / 2e A / 4e A / 4e B / 2e A / 4 e A / 4e B / 2e A / 2e B / 2e A / 4 e A B e A / 4e B / 2e A / 4 e A / 4e B / 2e A / 4 We cannot work with infinite P • but for large P e A B e 2 A / 2P B / P A / 2P P O P e e e …plus a correction 19 Formulating an Integrator Using the large-P approximation e A B e A / 2 P e B / P e A / 2 P P To advance the system over the time interval T • break Liouville operator into displacement parts iLx + iLp iL T iL T • write eiLT e x p • apply the Trotter expansion, and interpret T/P as a discretized time dt iLT e iL pd t / 2 iLxd t iL pd t / 2 P e e e • application of eiLpd t / 2eiLxd t eiLpd t / 2 P times advances the system (approximately) through T An integrator formulated this way will be both timereversible and symplectic 20 Examination of Integrator 1. Consider effect of one time step on positions and momenta e iL pd t / 2 iLxd t iL pd t / 2 e x p e First apply exp(iLpdt/2) x(0) x(0) p(0) p(0) p(0) d t 2 iL pd t / 2 e Then apply exp(iLxdt) e x(0) p d2t d t d t d t p (0) p (0) 2 p (0) p (0) 2 iLxd t x(0) Finally apply exp(iLpdt/2) again e iL pd t / 2 x(0) p d t d t x(0) p d2t d t 2 p (0) p (0) d t p (0) p (0) d t p d t 2 2 2 dt 2 21 Examination of Integrator 2. One time step e x(0) p d2t d t x p dt p dt p (0) p (0) 2 2 iL pd t / 2 iLxd t iL pd t / 2 e e dt 2 Examine effect on coordinate and momentum p (0) p (0) d2t F (0) F x(0) x(0) d2t x d2t d2t x(0) x(0)d t 12 F (0) d t 2 It’s the Velocity Verlet integrator! Higher-order algorithms can be derived systematically by including higher orders in the Trotter factorization • Not appealing because introduces derivatives of forces 22 A Deep Truth Verlet integrator replaces the true Liouville propagator by an approximate one iLpd t / 2 iLxd t iL pd t / 2 eiLd t e e e We can make these equal by saying the approximate propagator is obtained as the propagator of an approximate Liouville operator eiLd t e iLpseudot or iLpd t / 2 iLxd t iLpd t / 2 e e e iLpseudo iL / d t This corresponds to some unknown Hamiltonian • and this Hamiltonian is conserved by the Verlet propagator • the Verlet algorithm will not likely give rise to drift in the true Hamiltonian, since this “shadow” Hamiltonian is conserved 23 Other Decompositions Other choices for the decomposition of the Liouville operator can be worthwhile Some choices: • Separation of short- and long-ranged forces • Separation of fast and slow time-scale motions Approach involves defining a reference system that is solved more precisely (more frequently) Difference between real and reference is updated over a longer time scale RESPA • (Reversible) REference System Propagator Algorithm • Uses numerical solution of reference NAPA • Numerical Analytical Propagator Algorithm • Uses a reference that can be solved analytically Martyna, Tuckerman, Berne 24 RESPA: Force Decomposition 1. Decompose force into short (Fs) and long (Fl) range contributions F ( x) S ( x) F ( x) 1 S ( x) F ( x) Fs ( x) Fl ( x) • S(x) is a switching function that turns off the force at some distance Liouville operator Fs ( x ) Fl ( x ) x p p iLs Fl ( x ) p iL x 25 RESPA: Force Decomposition 2. Liouville operator iL iLs Fl ( x) p Trotter factorization of propagator e iLt e t F ( x ) 2 l p e iLs t e t F ( x ) 2 l p Decompose term treating short-range forces e iLs t e iLs , p d2t e iLs , xd t e iLs , p d2t n t dt n Long-range forces are computed n times less frequently than short-range ones • Long-range forces vary more slowly • They are more expensive to calculate, because more pairs 26 RESPA: Force Decomposition 3. Full RESPA propagator e iLt e t F ( x ) 2 l p n d2t Fs ( x ) p d tx x d2t Fs ( x ) p 2t Fl ( x ) p e e e e Procedure • Repeat for n steps update short-range force, evaluate new momenta evaluate new positions • Evaluate long-range forces, update momenta • Repeat t dt n 27 RESPA: Time-Scale Decomposition Many systems display disparate time scales of motion • Massive particles interacting with light ones helium in argon • Stiff and loose potentials intramolecular and intermolecular forces Approach works as before • Integrate fast motions (degrees of freedom) using short time step • Integrate slow motions using long time step