Two Verlet Algorithms will be briefly discussed: the Original Verlet and the Velocity Verlet, and the updating procedures are as follows: Orignal Verlet: ( +Β ...
Error Propagation of Verlet Algorithm Binbin Li Civil and Environmental Engineering, UC Berkeley
1. Introduction Verlet Algorithm is a popular numerical integration method, especially in molecular dynamics (MD) simulation. The discussion of errors in Verlet Algorithm appears in almost all books about MD simulation, but many of their descriptions are conflicted, and none of them provides strictly mathematical, thus it confuses most of readers, like me. Here, I try to talk about the error analysis of Verlet Algorithm using mathematical derivations, but it is not guaranteed to be errorfree. 2. Verlet Algorithm Two Verlet Algorithms will be briefly discussed: the Original Verlet and the Velocity Verlet, and the updating procedures are as follows: Orignal Verlet: π(π‘ + Ξπ‘) = 2π(π‘) β π(π‘ β Ξπ‘) + π(π‘)Ξπ‘ 2 (1) π£(π‘) =
π(π‘+Ξπ‘)βπ(π‘βΞπ‘)
(2)
2Ξπ‘
Velocity Verlet: 1
π(π‘ + Ξπ‘) = π(π‘) + π£(π‘)Ξπ‘ + 2 π(π‘)Ξπ‘ 2 π£(π‘ + Ξπ‘) = π£(π‘) +
Ξπ‘ 2
[π(π‘) + π(π‘ + Ξπ‘)]
(3) (4)
where π(π‘), π£(π‘) and π(π‘) are displacement, velocity and acceleration at π‘, respectively, and Ξπ‘ is the integration time step. In fact, these two Verlet Algorithms are mathematically equivalent, i.e. we could derive one from the other1. 3. Error Analysis The errors considered here include the truncation error (local error) and global error. The basic mathematical tool used is Taylor expansion. 3.1 Original Verlet First, letβs consider the Original Verlet. Taking the Taylor expansion of π(π‘ + Ξπ‘) and π(π‘ β Ξπ‘) at π(π‘) gives 1
1
1
1
π(π‘ + Ξπ‘) = π(π‘) + π£(π‘)Ξπ‘ + 2 π(π‘)Ξπ‘ 2 + 6 π(π‘)Ξπ‘ 3 + π(Ξπ‘ 4 ) π(π‘ β Ξπ‘) = π(π‘) β π£(π‘)Ξπ‘ + 2 π(π‘)Ξπ‘ 2 β 6 π(π‘)Ξπ‘ 3 + π(Ξπ‘ 4 )
1
http://www.physics.udel.edu/~bnikolic/teaching/phys660/numerical_ode/node5.html
(5) (6)
where π(π‘) is the βjerkβ at π‘ (i.e. the third derivative of displacement). Summarizing Eqn. (5) and (6) and doing some elementary operations yields π(π‘ + Ξπ‘) = 2π(π‘) β π(π‘ β Ξπ‘) + π(π‘)Ξπ‘ 2 + π(Ξπ‘ 4 ) (7) Subtracting Eqn. (6) by (5) and doing some elementary operations gives π£(π‘) =
π(π‘+Ξπ‘)βπ(π‘βΞπ‘) 2Ξπ‘
+ π(Ξπ‘ 2 )
(8)
By comparing Eqn. (1) and (7), (2) and (8), we can conclude that the truncation error of displacement and velocity are π(Ξπ‘ 4 ) and (Ξπ‘ 2 ) , respectively. Based on these truncation errors, the global error could be derived as follows2: First, we have πππππ[π(π‘ + Ξπ‘)] = π(Ξπ‘ 4 ) and π(π‘ + 2Ξπ‘) = 2π(π‘ + Ξπ‘) β π(π‘) + π(π‘ + Ξπ‘)Ξπ‘ 2 + π(Ξπ‘ 4 ) Then, πππππ[π(π‘ + 2Ξπ‘)] = 2 Γ πππππ[π(π‘ + Ξπ‘)] + π(Ξπ‘ 4 ) = 3π(Ξπ‘ 4 ) πππππ[π(π‘ + 3Ξπ‘)] = 2 Γ πππππ[π(π‘ + 2Ξπ‘)] + π(Ξπ‘ 4 ) = 6π(Ξπ‘ 4 ) πππππ[π(π‘ + 4Ξπ‘)] = 2 Γ πππππ[π(π‘ + 2Ξπ‘)] + π(Ξπ‘ 4 ) = 10π(Ξπ‘ 4 ) and so on. By induction, we get πππππ[π(π‘ + πΞπ‘)] =
π(π+1) 2
π(Ξπ‘ 4 )
Considering the global error in displacement between π(π‘) and π(π‘ + π) with π = πΞπ‘, it is clear that 1 π
π
πππππ[π(π‘ + π)] = 2 Ξπ‘ (Ξπ‘ + 1) π(Ξπ‘ 4 ) = π(Ξπ‘ 2 )
(9)
Using the same way, we can derive the global error for velocity: πππππ[π£(π‘ + Ξπ‘)] =
πππππ[π(π‘+2Ξπ‘)]βπππππ[π(π‘)]
πππππ[π£(π‘ + 2Ξπ‘)] =
+ π(Ξπ‘ 2 ) = π(Ξπ‘ 3 ) + π(Ξπ‘ 2 ) = π(Ξπ‘ 2 )
2Ξπ‘ πππππ[π(π‘+3Ξπ‘)]βπππππ[π(π‘+Ξπ‘)] 2Ξπ‘
+ π(Ξπ‘ 2 ) = π(Ξπ‘ 2 )
β¦ πππππ[π£(π‘ + πΞπ‘)] = π(Ξπ‘ 2 ) Therefore, πππππ[π£(π‘ + π)] = π(Ξπ‘ 2 ) (10) We see that the error of velocity does not increase with time. Conclusively, Original Verlet is a second-order integrator both for displacement and velocity. 3.2 Velocity Verlet The error analysis of Velocity Verlet is a little more complex than Original Verlet. Letβs first show the truncation error for velocity. Taking Taylor expansion of π(π‘ +
Ξπ‘ 2
) and π(π‘ + Ξπ‘) at π(π‘) gives
π (π‘ +
Ξπ‘ 2
1
) = π(π‘) + 2 π(π‘)Ξπ‘ + π(Ξπ‘ 2 )
π(π‘ + Ξπ‘) = π(π‘) + π(π‘)Ξπ‘ + π(Ξπ‘ 2 ) Eqn. (11) minus half of Eqn. (12) gives 2
http://www.saylor.org/site/wp-content/uploads/2011/06/MA221-6.1.pdf
(11) (12)
π (π‘ +
Ξπ‘
)= 2
π(π‘)+π(π‘+Ξπ‘) 2
+ π(Ξπ‘ 2 )
Then, taking Taylor expansion of π£(π‘)and π£(π‘ + Ξπ‘) at π£(π‘ + π£(π‘) = π£ (π‘ +
Ξπ‘
) β π (π‘ + 2
π£(π‘ + Ξπ‘) = π£ (π‘ +
Ξπ‘ Ξπ‘
) 2
Ξπ‘
2
) + π (π‘ + 2
Ξπ‘
1
+ 2 π (π‘ +
Ξπ‘ Ξπ‘
) 2
2
2
) gives
Ξπ‘
1
(13)
Ξπ‘ 2
) ( 2 ) + π(Ξπ‘ 3 ) 2
+ 2 π (π‘ +
Ξπ‘ 2
Ξπ‘ 2
) ( 2 ) + π(Ξπ‘ 3 )
(14) (15)
Eqn. (15) minus Eqn. (14) gives π£(π‘ + Ξπ‘) = π£(π‘) + π (π‘ +
Ξπ‘ 2
) Ξπ‘ + π(Ξπ‘ 3 )
(16)
Substituting Eqn. (13) into Eqn. (16) turns out π£(π‘ + Ξπ‘) = π£(π‘) + [ = π£(π‘) +
π(π‘)+π(π‘+Ξπ‘)
Ξπ‘ 2
2
+ π(Ξπ‘ 2 )] Ξπ‘ + π(Ξπ‘ 3 )
[π(π‘) + π(π‘ + Ξπ‘)] + π(Ξπ‘ 3 )
(17) 3 ).
By comparing Eqn. (4) and Eqn. (17), it easy to see the truncation error of velocity is π(Ξπ‘ For the truncation error of displacement, just taking Taylor expansion of π(π‘ + Ξπ‘) at π(π‘) gives the answer 1
π(π‘ + Ξπ‘) = π(π‘) + π£(π‘)Ξπ‘ + 2 π(π‘)Ξπ‘ 2 + π(Ξπ‘ 3 )
(18)
Thus, the truncation error of displacement is also π(Ξπ‘ 3 ). Now, letβs consider the global error of Velocity Verlet. Starting from π£(π‘ + Ξπ‘) = π(Ξπ‘ 3 ) and (π‘ + 2Ξπ‘) = π£(π‘ + Ξπ‘) +
Ξπ‘ 2
[π(π‘ + Ξπ‘) + π(π‘ + 2Ξπ‘)] + π(Ξπ‘ 3 ) , we have
πππππ[π£(π‘ + 2Ξπ‘)] = πππππ[π£(π‘ + Ξπ‘)] + π(Ξπ‘ 3 ) = 2π(Ξπ‘ 3 ) πππππ[π£(π‘ + 3Ξπ‘)] = πππππ[π£(π‘ + 2Ξπ‘)] + π(Ξπ‘ 3 ) = 3π(Ξπ‘ 3 ) β¦β¦ πππππ[π£(π‘ + πΞπ‘)] = ππ(Ξπ‘ 3 ) For the global error in velocity between π£(π‘) and π£(π‘ + π) with π = πΞπ‘, it is clear that π
πππππ[π£(π‘ + π)] = Ξπ‘ π(Ξπ‘ 3 ) = π(Ξπ‘ 2 )
(19)
About the global error in displacement, πππππ[π(π‘ + Ξπ‘)] = π(Ξπ‘ 3 ), πππππ[π£(π‘ + Ξπ‘)] = 1
π(Ξπ‘ 3 ) and π(π‘ + 2Ξπ‘) = π(π‘ + Ξπ‘) + π£(π‘ + Ξπ‘)Ξπ‘ + 2 π(π‘ + Ξπ‘)Ξπ‘ 2 + π(Ξπ‘ 3 ), then πππππ[π(π‘ + 2Ξπ‘)] = πππππ[π(π‘ + Ξπ‘)] + πππππ[π£(π‘ + Ξπ‘)]Ξπ‘ + π(Ξπ‘ 3 ) = 2π(Ξπ‘ 3 ) πππππ[π£(π‘ + 3Ξπ‘)] = πππππ[π£(π‘ + 2Ξπ‘)] + πππππ[π£(π‘ + 2Ξπ‘)]Ξπ‘ + π(Ξπ‘ 3 ) = 3π(Ξπ‘ 3 ) β¦β¦ πππππ[π(π‘ + πΞπ‘)] = ππ(Ξπ‘ 3 ) Therefore, the global error in displacement between π(π‘) and π(π‘ + π) with π = πΞπ‘ is π
πππππ[π(π‘ + π)] = Ξπ‘ π(Ξπ‘ 3 ) = π(Ξπ‘ 2 )
(20)
We see that the global error in Velocity Verlet are both π(Ξπ‘ 2 ) for displacement and velocity, and it is the same as Original Verlet. Conclusion This paper is concluded by the follow table:
Order Truncation error Global error
Table 1 Error in Verlet Algorithm Original Verlet Velocity Verlet Displacement Velocity Displacement Velocity π(Ξπ‘ 4 ) π(Ξπ‘ 2 ) π(Ξπ‘ 3 ) π(Ξπ‘ 3 ) 2) 2) 2) π(Ξπ‘ π(Ξπ‘ π(Ξπ‘ π(Ξπ‘ 2 )