Top Banner
Molecular Dynamics • Classical trajectories and exact solutions • Finite difference methods: the Verlet algorithm and variants • Predictor-corrector methods • Choosing an algorithm and time step
16

Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

Dec 22, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

Molecular Dynamics

• Classical trajectories and exact solutions

• Finite difference methods: the Verlet algorithm and variants

• Predictor-corrector methods

• Choosing an algorithm and time step

Page 2: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

Classical Trajectory

Simulated atoms are modeled classically, by Newton’s second Law

F =ma

d2xidt2

=Fximi

For particle i with position xi,

Forces are determined by the specific program used

Page 3: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

Simplest case: Hard Spheres

In this, earliest model, interactions occur only in collision.

separation

Energy(no Van der Walls forces)

Acceleration only occurs at discrete times: when a collision occurs.

The trajectories can be solved exactly

More sophisticated models have continuous interactions,Each motion is coupled to all other motions; this results in a

many-body problem with no analytic solution

Page 4: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

The time step t

The numeric solution to the dilemma of the coupling of motions is to use a finite time step, labeled t.

For this timeframe, the changes to the force on the particle due to its own motion are neglected, avoiding the many-body problem.

Trajectories of the particles are approximated using a Taylor series:

r(t+δt) =r(t)+δtv(t)+12δt

2a(t)+16δt

3b(t)...v(t+δt)=v(t)+δta(t)+1

2δt2b(t)...

a(t+δt) =a(t)+δtb(t) +...

Page 5: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

The Verlet algorithm

r(t+δt) =r(t)+δtv(t)+12δt

2a(t)+...The next step can be predicted from the Taylor expansion:

r(t−δt) =r(t)−δtv(t) +12δt

2a(t)+...Similarly, the previous step:

Taking the difference cancels the velocity term:

r(t+δt) =2r(t)−r(t−δt)+δt2a(t)

Velocity need not be explicitly calculated, but can be estimated, e.g.:

v(t) = r(t+δt)−r(t−δt)[ ] 2δt

Page 6: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

Using Verlet

The Verlet algorithm is straightforward and easy to implement

However, it requires a previous step’s position, so the first step requires an additional position, which can be estimated simply:

r(−δt) =r(0)−δtv(0)(from truncated Taylor expansion.)

Numeric problems can arise from the small t2a(t) being added to the much larger r(t) and r(t-t) terms

Page 7: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

The Half-Step (‘Leapfrog’)

Velocities are calculated, halfway between position steps:

r(t+δt) =r(t)+δtv(t+12δt)

v(t+12δt) =v(t−

12δt)+δta(t)

Explicitly includes the velocity, so energy scaling is easierAvoids a t2 term, so numeric (rounding) errors are smaller

Positions and velocities are not known simultaneously, complicating analysis of the results.

Page 8: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

Velocity Verlet

r(t+δt) =r(t)+δtv(t)+12δt

2a(t)

v(t+δt)=v(t)+12δt a(t) +a(t+δt)[ ]

This method also uses a half-step velocity calculation:

v(t+12δt) =v(t)+

12δta(t)

v(t+δt)=v(t+12δt)+

12δta(t+δt)

After which a(t+t) is computed, then the next v:

Page 9: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

(a): Verlet(b): Half-Step (Leapfrog)(c ): Velocity Verlet

Page 10: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

Beeman’s algorithm

Somewhat similar to velocity Verlet:

r(t+δt) =r(t)+δtv(t)+23δt

2a(t)−16δt

2a(t−δt)

v(t+δt)=v(t)+76δta(t)−

16δta(t−δt)

More complicated and requires more memory than velocityVerlet, but is more consistent in energetic consistency.

Page 11: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

Gear’s Predictor-Corrector methods

Predict ac(t+t) from the Taylor expansion at the starting pointBegin with a simple prediction, as in any of the previous methodsInitially step to r(t+t), v (t+t), a(t+t),b(t+t) at that point.The difference between the a(t+t) and the predicted ac(t+t):

Δa(t+δt) =ac(t+δt)−a(t+δt)

Estimates the error in the initial step, which is used to correct:rc(t+δt) =r(t+δt) +c0Δa(t+δt)vc(t+δt) =v(t+δt)+c1Δa(t+δt)

ac(t+δt) /2=a(t+δt)/2+c2Δa(t+δt)

bc(t+δt)/ 6=b(t+δt) /6+c3Δa(t+δt)

Page 12: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

More Predictor-Corrector

The set of constants to use is parameterized.For the third-order example above Gear suggested:c0=1/6, c1=5/6, c2=1 (obviously), c3=1/3These change with different order computations

This method can be iterated over the same step to improve the step prediction. This is usually done two or three times.

Gear methods are very accurate with short time steps, but are worse than simpler methods for long time steps.

Page 13: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

(RMS Energy deviation)

Circles: VerletSquares: Gear 4th orderTriangles: Gear 5th orderDiamonds: Gear 6th order

(log/log scale)

Error with respect to size of timestep

Page 14: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

Choosing a time step

Too short - computation needlessly slow

Too long - errors result from approximations

Just right - errors acceptable, maximum speed

Page 15: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

Overlong Timesteps

Particularly near collisions,The forces change quickly.

Errors in these regions are compounded in subsequent steps.

Simulation of the interatomic distance between two Argon atoms at two ts.The difference from the exact path is plotted.

Page 16: Molecular Dynamics Classical trajectories and exact solutions Finite difference methods: the Verlet algorithm and variants Predictor-corrector methods.

Choosing an Integration Algorithm

Usual test of adequacy of the algorithm is the size of the RMS of the total energy variance over a number of steps.

This is strongly dependent on the step size. While methods are better with smaller sizes, some scale up better than others.

Often, the best algorithm to choose is the one which maximizes (maximum accurate step size / computation time per step)

Other factors may be relevant (memory required, self-starting, compatibility with other algorithms)