Simulation of multiple particles
Typically spherical particles for such simulations
Steps:
1) Select box length (L, cubic) and number of particles
(N)
2) Create initial configuration of N particles in the box
3) Calculate total force acting on each particle
4) Calculate the displacement of each particle due to
the force within a small time interval
5) Calculate force on each particle for the new
configuration
6) Repeat steps 4 and 5 for the specified number of
timesteps of simulation
Creating initial configuration
Typically positions chosen randomly, without any, or minimal overlap
1) Select the center of the first particle at a random location
o Use random numbers in all 3 directions (0 < x < L, 0 < y < L, 0 < z < L)
2) Repeat step 1 for the second particle
3) Check for any overlap of the second particle with the already existing (i.e. first)
particle (Check if center-to-center distance >= R; R = some characteristic
diameter/size of each particle)
4) If overlap exists, repeat steps 2 and 3. If no overlap, go to next step.
5) Repeat step 1 for the next particle.
6) Check for any overlaps with all existing particles in the box.
7) If overlap exists, repeat steps 5 and 6.
8) Repeat steps 5 - 7 till N particles are placed inside the box.
Periodic boundary condition
Let’s consider a situation where the displacement of particle 1 attempts to
take it outside the box.
Source: Computer
simulation of liquids,
Allen and Tildesley
Periodic boundary condition
(PBC)
By PBC, one of the
image particles
attempts a similar
displacement to
enter the box.
Source: Computer
simulation of liquids,
Allen and Tildesley
How to select which particles interact?
Minimum Image Convention
A particle 1 interacts
with another particle 2
in the box, or one of its
images in the image
boxes, whichever is the
closest.
Source: Computer
simulation of liquids,
Allen and Tildesley
Pairwise interactions
j
Pairwise interactions are usually given in the form of a potential
𝑟 #$% 𝑟 #&
𝑈 𝑟 = 4𝜀 − 𝑟 ≡ 𝑟⃗!"
𝜎 𝜎
i 𝑟⃗!"
𝜕𝑈 𝜕𝑟 𝜕𝑟 𝜕𝑟
𝑓⃗ = −∇𝑈 = − 𝚤̂ + 𝚥̂ + 𝑘4
𝜕𝑟 𝜕𝑥 𝜕𝑦 𝜕𝑧
𝑥" − 𝑥!
% % % 𝑟⃗!" = 𝑟⃗" − 𝑟⃗! = 𝑦" − 𝑦!
𝑟= 𝑥" − 𝑥! + 𝑦" − 𝑦! + 𝑧" − 𝑧! 𝑧" − 𝑧!
𝜕𝑈 𝜕𝑟 𝜕𝑟 𝜕𝑟 𝜕𝑈 𝑥" − 𝑥! 𝑦" − 𝑦! 𝑧" − 𝑧!
𝑓" = −∇(⃗! 𝑈 = − 𝚤̂ + 𝚥̂ + 4
𝑘 =− 𝚤̂ + 𝚥̂ + 𝑘4
𝜕𝑟 𝜕𝑥" 𝜕𝑦" 𝜕𝑧" 𝜕𝑟 𝑟 𝑟 𝑟
𝜕𝑈 𝜕𝑟 𝜕𝑟 𝜕𝑟 𝜕𝑈 𝑥" − 𝑥! 𝑦" − 𝑦! 𝑧" − 𝑧!
𝑓! = −∇(⃗" 𝑈 = − 𝚤̂ + 𝚥̂ + 𝑘4 = − − 𝚤̂ − 𝚥̂ − 𝑘4
𝜕𝑟 𝜕𝑥! 𝜕𝑦! 𝜕𝑧! 𝜕𝑟 𝑟 𝑟 𝑟
𝑥" − 𝑥! 𝑦" − 𝑦! 𝑧" − 𝑧!
where 𝑢!" = 𝚤̂ + 𝚥̂ + 𝑘4
𝑟 𝑟 𝑟
Time integration
Velocity Verlet algorithm:
ax = fx/m
ay = fy/m
az = fz/m
Pseudocode:
Source: Computer
simulation of liquids,
Allen and Tildesley