Download Molecular Dynamics - University of Calgary

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Eigenstate thermalization hypothesis wikipedia , lookup

Transcript
Molecular Dynamics
• Classical trajectories and exact solutions
• Finite difference methods: the Verlet
algorithm and variants
• Predictor-corrector methods
• Choosing an algorithm and time step
Classical Trajectory
Simulated atoms are modeled classically, by Newton’s second Law
F  ma
For particle i with position xi,
d xi Fxi
2 
dt
mi
2
Forces are determined by the specific program used
Simplest case: Hard Spheres
In this, earliest model, interactions occur only in collision.
(no Van der Walls forces)
Energy
Acceleration only occurs at discrete times:
when a collision occurs.
separation
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
The time step dt
The numeric solution to the dilemma of the coupling of motions is
to use a finite time step, labeled dt.
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  dt)  r(t)  dtv(t)  dt a(t)  dt b(t)...
2
v(t  dt)  v(t)  dta(t)  dt b(t)...
a(t  dt)  a(t)  dtb(t) ...
1
2
1
2
2
1
6
3
The Verlet algorithm
The next step can be predicted from the Taylor expansion:
r(t  dt)  r(t)  dtv(t)  dt a(t)  ...
1
2
2
Similarly, the previous step:
r(t  dt)  r(t)  dtv(t)  dt a(t)  ...
1
2
2
Taking the difference cancels the velocity term:
r(t  dt)  2r(t)  r(t  dt )  dt a(t)
2
Velocity need not be explicitly calculated, but can be estimated, e.g.:
v(t)  r(t  dt)  r(t  dt) 2dt
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(dt)  r(0)  dtv(0)
(from truncated Taylor expansion.)
Numeric problems can arise from the small dt2a(t) being
added to the much larger r(t) and r(t-dt) terms
The Half-Step (‘Leapfrog’)
Velocities are calculated, halfway between position steps:
r(t  dt)  r(t)  dtv(t  dt)
1
2
v(t  dt)  v(t  dt)  dta(t)
1
2
1
2
Explicitly includes the velocity, so energy scaling is easier
Avoids a dt2 term, so numeric (rounding) errors are smaller
Positions and velocities are not known simultaneously,
complicating analysis of the results.
Velocity Verlet
r(t  dt)  r(t)  dtv(t)  dt a(t)
1
2
2
v(t  dt)  v(t)  12 dta(t)  a(t  dt)
This method also uses a half-step velocity calculation:
v(t  dt)  v(t)  dta(t)
1
2
1
2
After which a(t+dt) is computed, then the next v:
v(t  dt)  v(t  dt)  dta(t  dt)
1
2
1
2
(a): Verlet
(b): Half-Step (Leapfrog)
(c ): Velocity Verlet
Beeman’s algorithm
Somewhat similar to velocity Verlet:
r(t  dt)  r(t)  dtv(t)  dt a(t)  dt a(t  dt)
7
1
v(t  dt)  v(t)  6 dta(t)  6 dta(t  dt)
2
3
2
1
6
2
More complicated and requires more memory than velocity
Verlet, but is more consistent in energetic consistency.
Gear’s Predictor-Corrector methods
Predict ac(t+dt) from the Taylor expansion at the starting point
Begin with a simple prediction, as in any of the previous methods
Initially step to r(t+dt), v (t+dt), a(t+dt),b(t+dt) at that point.
The difference between the a(t+dt) and the predicted ac(t+dt):
a(t  dt)  a c (t  dt)  a(t  dt)
Estimates the error in the initial step, which is used to correct:
r (t  dt)  r(t  dt)  c0a(t  dt)
c
v (t  dt)  v(t  dt)  c1 a(t  dt)
a c (t  dt) / 2  a(t  dt)/ 2  c2 a(t  dt)
c
b (t  dt)/ 6  b(t  dt) / 6  c3a(t  dt)
c
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/3
These 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.
Error with respect to size of timestep
Circles: Verlet
Squares: Gear 4th order
Triangles: Gear 5th order
Diamonds: Gear 6th order
(RMS Energy deviation)
(log/log scale)
Choosing a time step
Too short - computation needlessly slow
Too long - errors result from approximations
Just right - errors acceptable, maximum speed
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 dts.
The difference from the exact path is plotted.
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)