This preview shows pages 1–2. Sign up to view the full content.
MSE 4270/6270: Introduction to Atomistic Simulations, Leonid Zhigilei
Homework #1 (page 1 of 2)
Simple MD code with Velocity Verlet algorithm
Write the simplest possible onedimensional “molecular dynamics code” for two particles
connected by a spring (Force = k(x
2
x
1
x
0
)) where
Δ
x=x
2
x
1
is the distance between particles,
x
0
is the equilibrium length of the spring.
Your code can have the following structure:
• Define the parameters of the system (k, x
0
, m
1
, m
2
), initial coordinates and velocities of the
particles in the system (x
1
0
, x
2
0
, v
1
0
, v
2
0
), initial time = 0, time of the simulation, and timestep
of integration,
Δ
t.
• Calculate initial force F
init
= k(x
2
0
x
1
0
x
0
)
•F
old
= F
init
, x
1
old
= x
1
0
, x
2
old
= x
2
0
, v
1
old
= v
1
0
, v
2
old
= v
2
0
• Time loop:
1. Calculate position at the current time
x
1
new
= x
1
old
+
Δ
t v
1
old
+
Δ
t
2
F
old
/2m
1
x
2
new
= x
2
old
+
Δ
t v
2
old

Δ
t
2
F
old
/2m
2
2. Calculate new forces
F
new
= k(x
2
new
x
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Fall '11
 Zhigilei

Click to edit the document details