Cemistry 380.37 Fall 2015 Dr. Jean M. Standard November 9, 2015 Te Verlet Algoritm for Molecular Dynamics Simulations Equations of motion For a many-body system consisting of N particles, Newton's classical equations of motion are! F i = m i! a i, i = 1,2,,N. (1)! In tis equation, F i denotes te force on te it particle, m i is te mass of te particle, and a! i is te acceleration. Te arrows over te force and acceleration denote te x, y, and z components of te vectors. In te rest of tis andout, te vector notation will be dropped for convenience. Taylor Series Approximation Te solution of Newton's equations using te Verlet algoritm is based on a Taylor series expansion. Expanding te position of te it particle r i at time t+ and t in Taylor series yields, r i (t + ) = r i (t) + r i ' (t) + 2 2! r i'' (t) + 2 3! r i''' (t) + O( 4 ) (2) r i (t ) = r i (t) r i ' (t) + 2 Adding tese two equations leads to te result 2! r i '' (t) 3 3! r i ''' (t) + O( 4 ). r i (t + ) + r i (t ) = 2 r i (t) + 2 r i '' (t) + O( 4 ). (3) Note tat r i ' (t) is equivalent to te velocity of te particle, v i (t), and r i '' (t) is te acceleration of te particle, a i (t). Making tese substitutions in Eq. (3), we ave r i (t + ) + r i (t ) = 2 r i (t) + 2 a i (t) + O( 4 ). (4) Solving for r i (t + ) and using Newton's equations for te acceleration ( a i = F i /m i ) leads to r i (t + ) = 2 r i (t) r i (t ) + 2 m i F i (t) + O( 4 ). (5) Discretization of Time Te time is a continuous variable, but to implement Eq. (5) on a computer requires te solution to be generated for discrete time steps suc tat t n +1 t n =, (6) were is te step size for te time variable.
2 Discretizing time in Eq. (5) leads to te Verlet algoritm (1967), r i (t n +1 ) = 2 r i (t n ) r i (t n 1 ) + 2 m i F i (t n ) + O( 4 ). (7) Note tat te Verlet Algoritm relies on two previous time steps, t n and t n 1, to advance te solution forward in time, and it is a fourt-order metod. Tere are sometimes problems associated wit te Verlet algoritm due to potential loss of accuracy wen Eq. (7) is implemented. Te final term in te equation tends to be small compared to te oters, and tis term may as a result get lost in te round-off error. Notice tat te velocity does not explicitly appear in te Verlet algoritm. Tis may be a problem if properties of te system tat depend on velocity, suc as kinetic energy, are desired. Also, te velocity at time t n cannot be calculated until te position at time t n +1 is obtained. As a result te velocity is usually calculated from te positions using an approximate formula based on te derivative of te position, v i (t n ) = r i (t n +1 ) r i (t n 1 ) 2. (8) Also notice tat te Verlet algoritm is not self-starting, since it requires te positions at two previous times ( t n and t n 1 ) to get te position at te next time, t n+1. Tis is usually overcome by first completing one step of a less accurate metod tat only requires information at one previous time step, suc as te Euler metod, and ten switcing to te Verlet metod for subsequent steps. Te Verlet Leapfrog Algoritm In an attempt to correct some of te problems associated wit te original Verlet algoritm, te Verlet Leapfrog algoritm was developed. Using an approximation for te derivative, te velocity at te midpoint between times t n and t n+1 can be defined as, v i (t n+1/ 2 ) = r i (t n+1 ) r i (t n ), (9) Eq. (8) can be solved for r i (t n +1 ) to yield r i (t n +1 ) = r i (t n ) + v i (t n +1/ 2 ). (10) Similarly, defining te velocity at te midpoint between times t n 1 and t n gives v i (t n 1/ 2 ) = r i (t n ) r i (t n 1 ). (11) Te acceleration at time t n can be defined using anoter approximate formula for te derivative, a i (t n ) = v i (t n+1/ 2 ) v i (t n 1/ 2 ). (12)
3 Using Newton's equations for te acceleration, a i (t n ) = F i (t n ) /m i, and equating te acceleration to Eq. (12) yields v i (t n+1/ 2 ) v i (t n 1/ 2 ) = F i (t n ) m i, (13) wic can be solved for v i (t n+1/ 2 ), v i (t n+1/ 2 ) = v i (t n 1/ 2 ) + m i F i (t n ). (14) Eqs. (10) and (14) constitute te equations of te Verlet Leapfrog algoritm. Te Leapfrog algoritm as some advantages over te original Verlet algoritm, Eq. (7). First, te loss of accuracy due to round-off error in te original Verlet algoritm because of vastly different magnitudes of terms in te equation is corrected. Second, te velocities are included explicitly in te metod, unlike te original Verlet algoritm. Tere are still a few problems associated wit te Leapfrog algoritm, owever. First, it is still not self-starting. Tis can be overcome as in te original Verlet metod by completing one step of te Euler metod first, and ten switcing to te Leapfrog algoritm for subsequent steps. Toug te Leapfrog algoritm produces bot positions and velocities, te velocities are obtained at 1/2-integer time steps ( t n +1/ 2, t n + 3/ 2, t n+ 5/ 2,...), wile te positions are obtained at integer time steps ( t n, t n +1, t n + 2,...). If te velocities at integer time steps are required, an auxiliary equation may be utilized wic simply averages te 1/2- integer velocities, v i (t n ) = 1 [ 2 v i (t n 1/ 2 ) + v i (t n+1/ 2 )]. (15) Example: Verlet Leapfrog Algoritm for Bond Stretcing Consider te simple one-dimensional armonic potential as a representation of te motion of te vibrations of a bond in a molecular system, V( x) = 1 2 k x 2. (16) Te coordinate x represents te bond displacement, x = r r eq. Te Verlet leapfrog algoritm for tis system is given by x( t n +1 ) = x( t n ) + v x ( t n +1/ 2 ) v x ( t n +1/ 2 ) = v x ( t n 1/ 2 ) + µ F x( t n ). (17) Te force F x is obtained from te force field, F x = dv dx F x = kx. (18)
4 Substituting, te Verlet Leapfrog equations become x( t n +1 ) = x( t n ) + v x ( t n +1/ 2 ) v x ( t n +1/ 2 ) = v x ( t n 1/ 2 ) k m x ( t n). (19) Example: Carbon-Carbon Bond Stretcing Using te Verlet Leapfrog Algoritm Modeling Carbon-Carbon Bonds To apply te Verlet Leapfrog algoritm (Eq. 19) to model te motion of a carbon-carbon bond, ten te mass m would be replaced by te reduced mass µ of te bond. For a bond A-B, te reduced mass µ is defined as µ = m A m B m A + m B. (20) were m A and m B are te masses of atoms A and B. So, for a carbon-carbon bond, te reduced mass is 6.0 g/mol (or about 10940 atomic units). Te force constants for carbon-carbon bonds from te on-line CRC (Table 9-75) are listed in Table 1 in units of kcal mol 1 Å 2, N/cm, N/m (or J/m 2 ), and atomic units (artree/bor 2 ). Table 1. Force constants for typical carbon-carbon bonds. C C C Bond Force Constant (kcal mol 1 Å 2 ) Force Constant (N/cm) Force Constant (N/m) Force Constant (a.u.) C (from C 2 H 6 ) 648 4.50 450 0.289 C (from CCl 2 CH 2 ) 1213 8.43 843 0.541 C (from C 2 ) 1750 12.16 1216 0.781 Results: Variation of Force Constants Calculations were performed using te tree force constants given in Table 1 (k=0.289, 0.541, and 0.781 a.u.), representing carbon-carbon single, double, and triple bonds, respectively. Te Verlet Leapfrog Algoritm was implemented using a value of 5 a.u. for and 500 total time steps wit an initial position of 0 a.u. and an initial velocity of 0.003 a.u. [Note tat an atomic unit of time is 2.419 10 17 s, or 0.024 fs. An atomic unit of distance (one bor) equals 0.5291771 Å. An atomic unit of velocity equals 2.188 10 5 m/s.] Te position and velocity values are plotted as functions of time to demonstrate te dynamics of a carbon-carbon bond modeled by eac of te force constants in Figures 1-3. Note tat in eac case te position oscillates symmetrically about x=0, a caracteristic of te armonic oscillator. In addition, we see tat te velocity is out of pase wit te position (and it also oscillates symmetrically about v=0). Te figures also sow tat as te force constant increases, te frequency of oscillation of te C-C bond increases, as would be expected as a result of te relationsip between te armonic frequency and force constant. Te period of oscillation terefore decreases as te force constant increases, from 0.030 ps to 0.022 ps to 0.018 ps for force constants of 0.289, 0.541, and 0.781 a.u., respectively.
5 (a) (b) Figure 1. (a) Bond displacement and (b) velocity as functions of time for a model carbon-carbon single bond wit k=0.289 a.u. (a) (b) Figure 2. (a) Bond displacement and (b) velocity as functions of time for a model carbon-carbon double bond wit k=0.541 a.u. (a) (b) Figure 3. (a) Bond displacement and (b) velocity as functions of time for a model carbon-carbon triple bond wit k=0.781 a.u.
6 Testing te Accuracy of te Verlet Algoritm Te exact solution for te position at eac time step for te armonic oscillator may be compared to te numerical solution from te Verlet Algoritm. Comparisons were made wit te following time steps and number of points: (a.u.): 10. 5. 2. # steps: 200 400 1000 Te initial conditions used for eac run were x 0 = 0.0 a.u. and v 0 = 0.003 a.u. Te absolute error between te Verlet and exact results for te bond displacement coordinate x were plotted as functions of time. Results for eac of te force constants are sown in Figures 4-6. Figure 4. Absolute error in position as a function of time for a model carbon-carbon double bond wit k=0.289 a.u. Figure 5. Absolute error in position as a function of time for a model carbon-carbon double bond wit k=0.541 a.u.
7 Figure 6. Absolute error in position as a function of time for a model carbon-carbon double bond wit k=0.789 a.u. Te maximum absolute error in te position sown in eac of Figures 4-6 clearly increases over time. It is also cyclic, since we can see tat te largest error occurs at te maximum or minimum extension of te bond. For eac time step, te maximum absolute error over one oscillation cycle can be compared. Results are given in Table 2. Table 2. Maximum absolute error for different time steps and force constants. Maximum Absolute Error (a.u.) (a.u.) k = 0.289 a.u. k = 0.541 a.u. k = 0.781 a.u. 10 3.148 10 4 4.310 10 4 5.176 10 4 5 7.869 10 5 1.077 10 4 1.294 10 4 2 1.259 10 5 1.723 10 5 2.070 10 5 Te results sow tat te absolute error decreases as te time step decreases. Similar trends are observed for eac of te tree force constants. Notice, owever, tat te decrease in te error is not linear. A grap sowing te maximum absolute error plotted against te time step is sown in Figure 7.
8 Figure 7. Maximum absolute error in position as a function of step size in time for model carboncarbon bonds. Te results sown in Figure 7 appear rougly quadratic in form. Looking at te data, we see tat wen te step size decreases from 10 to 5 a.u. (a factor of 2), te error decreases by a factor of 4. Similarly, wen te step size decreases from 10 to 2 a.u. (a factor of 5), te error decreases by a factor of 25. Te relationsip between step size and error can be explored furter. Assume tat te error as te following form, Error = C M, (21) were C is a constant and M is an integer. Taking te log of bot sides yields, log( Error) = logc + M log( ). (22) Tis equation indicates tat a plot of log(error) on te y-axis and log() on te x-axis sould be linear wit a slope of M. If te error scales quadratically wit te step size, ten te slope sould be equal to 2. Te log plot is sown in Figure 8.
9 Figure 8. Log-log plot of maximum error in bond displacement and step size for Verlet Leapfrog algoritm. As illustrated in Figure 8, te slope for all te k values does indeed equal 2. Tis verifies tat wen te step size is decreases by some factor S, ten te error decreases by S 2.