Project Presentation

advertisement
Computational Physics Project
•Predictor-Corrector method
•Verlet Integration
Guy Halioua 302748546
Technion – Israel Institute of Technology
Preface – Molecular Dynamics

Simulation method for exploring
Dynamic systems

Based on Newton’s laws of motion

Solve problems with multiple bodies
General Algorithm for MD
Determine primary Positions and
velocities of the system, and choose a
small ∆t
Calculate accelerations by:
F  V
aF
M
Calculate location and velocity of every
particle in the system at the next time
step
Update time to the next time step, and
repeat for as much as you need.
Integration Methods
Solve a second order ODE:
x  f  x, x, t 

Predictor Corrector - Multiple values
method

Verlet Integration – Numerical
approximations to the derivatives
Predictor - Corrector
Predict a primitive guess for the values
of x t  t  and x t  t  by the formulas:
P  x   x  t  t   x  t   t  x  t   t
k 1
2
 f t  1  i  t 
i
i 1
P  x   t  x  t  t   x  t  t   x  t   t
k 1
2
 ' f t  1  i  t 
i 1
While:
k 1
 1  i 
q
i 1
k 1
i 
1
 q  1 q  2 
1
1  i   i ' 

 q  2
i 1
q
i
q  0,1,..., k  2
Predictor - Corrector
Calculate the accelerations for time t+∆t
based on the prediction made earlier.
x  t  t   f  x  t  t  , x  t  t  , t 
Predictor - Corrector
Correct the primitive guess for the
values of x t  t  and x t  t  made
O  t k 1 
earlier by the formulas:
C  x   x  t  t   x  t   t  x  t   t
k 1
2
  f t  2  i  t 
i
i 1
C  x   t  x  t  t   x  t  t   x  t   t
k 1
2
  ' f t  2  i  t 
i 1
k 1
While:
2  i
q
i 1
k 1
2  i
i 1
q
i 
i
1
 q  1 q  2 
1
i ' 
 q  2
q  0,1,..., k  2
Predictor - Corrector
Predictor Corrector coefficients for secondorder equations
Taken from D.C Rapaport’s Book: “The Art of Molecular Dynamics Simulation”
Verlet Integration
Taylor Expand of
x t  t  and x t  t 
t 2
x  t  t   x  t   v  t  t  a  t 
 O t 3
2
t 2
x  t  t   x  t   v  t  t  a  t 
 O t 3
2
 
 
 
x  t  t   2 x  t   x  t  t   t 2 a  t   O t 4
Verlet Integration
While a t  can be found from Newton’s
equations of motion:
a t  
F  x t 
M

V  x  t  
M
And the velocity is found by the mean value
theorem:
x  t  t   x  t  t 
v t  
 O  t 2 
2t
Verlet Integration
Accuracy analysis:
Velocity O  t 2 
 
Overall accuracy O  t 2 
4
O

t
Coordinate
Looking for a better approximation
Velocity Verlet Integration
Simply a Taylor Expand of
x  t  t  and v  t  t 
t 2
x  t  t   x  t   v  t  t  a  t 
 O t 3
2
1
v  t  t   v  t   t  a  t   a  t  t  
2
 
while a t  t  is taken from the motion
equation using x t  t 
MD Simulation
1D Row of Linear Oscillators
Defining the problem:
row of masses, divided by linear oscillators
(k,l)
1
2
3
4

n2
n 1
n
Determine the Dynamics of the system
MD Simulation
1D Row of Linear Oscillators
Defining the potential function:


Elastic potential
k
2
ui   xi  xi 1  l 
2
n
K
 U     xi  xi 1  l 
i 1 2
Force
U
Fi 
 k  xi 1  xi 1  2 xi 
xi
MD Simulation
1D Row of Linear Oscillators
Choosing parameters:
m  1 kg 
Mass
a  0.5  m 
Lattice’s const’
k  1 N 
 m
l  0.5  a  0.25  m 
Oscillator’s const’
n  30
No. of particles
t  5 104 [sec]
Size of time step
T  40000
No. of time steps
Oscillator’s free length
MD Simulation
1D Row of Linear Oscillators
Choosing initial conditions:

Coordinates: Lattice organization around
the origin

Velocities: randomly picked, range [-0.3,0.3]
using Matlab’s random number generator
MD Simulation
1D Row of Linear Oscillators
Programming

Two programs in C for computing the
positions, velocities and energies at all the
time steps.

Input is a file with the initial velocities
MD Simulation
1D Row of Linear Oscillators
Expected results:

Solution of 1 oscillator – sine (cosine) wave

Expected solution for multiple oscillators,
multiple sine (cosine) waves.
MD Simulation
1D Row of Linear Oscillators
Results - Predictor Corrector
MD Simulation
1D Row of Linear Oscillators
Results – Verlet Integration
MD Simulation
1D Row of Linear Oscillators
Results – animation:
Verlet Integration
Predictor – Corrector
MD Simulation
1D Row of Linear Oscillators
Results – Differences:
MD Simulation
1D Row of Linear Oscillators
Results – Differences:
 Max Difference ≈ 1.2e-4 [m]

Typical system size- a=0.5 m

% max difference: 0.024%
Identical Results
MD Simulation
1D Row of Linear Oscillators
Energy analysis – Predictor Corrector
MD Simulation
1D Row of Linear Oscillators
Energy analysis – Verlet Integration
MD Simulation
1D Row of Linear Oscillators
Conclusions



Energy and momentum conservation
Identical results in 2 different methods
Compatible with theory
Logical Results
Download