Sei sulla pagina 1di 37

Computer Simulation of Complex Fluids

Postgraduate Lecture Course

Michael P Allen

H H Wills Physics Laboratory, Royal Fort, Tyndall Avenue, Bristol


and
Department of Physics, University of Warwick, Coventry

Torino, March–June 2017


Outline
Introduction
Statistical mechanics
Molecular dynamics
Monte Carlo methods
Some tricks of the trade
Long-range forces
Parallel Simulation
How to analyse the results
Advanced Monte Carlo methods
Rare-event simulation
Non-equilibrium molecular dynamics
Mesoscale methods
Quantum simulations
Inhomogeneous fluids
A general bibliography

M. P. Allen and D. J. Tildesley, Computer Simulation of Liquids,


2nd ed. (Oxford University Press, 2017).
D. Frenkel and B. Smit, Understanding Molecular Simulation: from
Algorithms to Applications, 2nd ed. (Academic Press, 2002).
D. C. Rapaport, The Art of Molecular Dynamics Simulation, 2nd ed.
(Cambridge University Press, 2004).
M. E. Tuckerman, Statistical Mechanics: Theory and Molecular
Simulation (Oxford University Press, 2010).
B. J. Leimkuhler and S. Reich, Simulating Hamiltonian Dynamics
(Cambridge University Press, 2004).
Simple phase diagram: gas–liquid–solid

G L S
T
t

P
Simple phase diagram: gas–liquid–solid

G L S
T
t

P
Simple phase diagram: gas–liquid–solid

G L S
T
t

P
Simple phase diagram: gas–liquid–solid

G L S
T
t

P
Simple phase diagram: gas–liquid–solid

G L S
T
t

ρ
Simple phase diagram: gas–liquid–solid

G L S
T
t

ρ
Molecular simulation
What is it?

length (m) Methods


100 FE Finite Elements
Macroscopic CFD Computational Fluid
10−3 Dynamics
LB Lattice Boltzmann
10−6 Mesoscopic
MPC MultiParticle Collision
Dynamics
10−9 Molecular DPD Dissipative Particle
Dynamics
Atomistic
10−12 BD Brownian Dynamics
Quantum time (s) MC Monte Carlo
MD Molecular Dynamics
10−12 10−9 10−6 10−3 100
CP Electronic Structure
Molecular simulation
What is it?

length (m) Methods


100 FE Finite Elements
Macroscopic CFD Computational Fluid
10−3 Dynamics
LB Lattice Boltzmann
10−6 Mesoscopic
MPC MultiParticle Collision
Dynamics
10−9 Molecular DPD Dissipative Particle
Dynamics
Atomistic
10−12 BD Brownian Dynamics
Quantum time (s) MC Monte Carlo
MD Molecular Dynamics
10−12 10−9 10−6 10−3 100
CP Electronic Structure
Articles

100
101
102
103
104
105
106

19
50
Growth of the field

–5
9
19
60
–6
9
19
70
–7
9
19
80
–8

Decade
9
19
90
–9
9
20
00
–0
9
Molecular simulation
Bridging experiment and theory

Real Systems Make Models Model Systems

Do Experiments Do Simulations Do Theory

Experimental Exact Results Theoretical


Results for Model Predictions

Compare Compare

Test Models Test Theories


Molecular simulation
Bridging experiment and theory

Real Systems Make Models Model Systems

Do Experiments Do Simulations Do Theory

Experimental Exact Results Theoretical


Results for Model Predictions

Compare Compare

Test Models Test Theories


Periodic Boundary Conditions

I Consider N = 103 atoms


arranged in a cube.
I Atoms not on the surface:
83 = 512
I Atoms on the surface:
103 − 83 = 488
I That’s nearly half of them!
I Large effect on the
measured properties.

Even for N = 1003 = 106 atoms, 6% of atoms are on surface.


Periodic Boundary Conditions

I Simulation box is
cubic.
I Surround cube with
1 4 replicas.
2
3
I If a molecule leaves
5 the basic simulation
box, attention can
be switched to the
incoming image.

L
Periodic Boundary Conditions

For short-range
potentials, adopt the
minimum image
1 convention: each atom
4
interacts with the
2
nearest atom or image in
5 3
the periodic array.
No more interfaces;
however the periodicity
is artificial!
Angular momentum
pi
X
L= ri × p i
fj i
X
i L̇ = ri × fi
j
i

ri Locally, angular momentum is


rj
conserved.
pi r 0 rk
i fj = fjk = −fk directed along
the minimum-image rjk .
k However, rjk may not be the
i same as rj − rk , depending on
fk
choice of origin.
I Periodic boundary conditions imply no rotational invariance.
I Implies no angular momentum conservation.
I NB molecular torques satisfy τjk + τkj + rjk × fjk = 0.
Non-bonded interactions

We feed in potential energies, and forces obtained by


differentiating the potential.
The non-bonded potential energy Unb is traditionally split into
1-body, 2-body, 3-body . . . terms:
X X X
Unb (r) = v(1) (ri ) + v(ri , rj ) + v(3) (ri , rj , rk ) + . . . .
i i,j>i ijk

I v(1) represents the external field or container walls,


I usually dropped for simulations of bulk systems.
I v = v(2) is the interatomic pair potential.
I We usually neglect higher order interactions such as v(3) .
There is an extensive literature on the experimental determination
of these potentials.
Inert gases: argon

100

effective pair potential


v(r)/kB (K)

−100
actual pair potential

0.3 0.4 0.5 0.6 0.7 0.8


r (nm)
Lennard-Jones potential

I Sometimes sufficient to use the simplest models that


faithfully represent the essential physics.
I The Lennard-Jones potential is the most commonly used
form, developed for studies of inert gases.

3   
σ 12  σ 6
2 vLJ (r) = 4ε −
r r
v(r)/ε

1 (12)
vLJ (12) (6)
vLJ = vLJ (r) + vLJ (r)
0
σ = diameter
−1
ε = well depth
(6)
vLJ
−2
0.8 1.0 1.2 1.4 1.6 1.8 2.0
r/σ
Lennard-Jones potential

rij dv(rij )
fi = −fj = −∇i v(rij ) = −
rij drij
  
σ 12  σ 6
vLJ (r) = 4ε −
r r
    σ 6 
r dvLJ (r) 4ε σ 12
fLJ (r) = − = 2 12 −6 r
r dr r r r
4

3
Alternative division into
attractive and repulsive parts:
2
v(R)
v(r)/ε

LJ
1
vLJ
vLJ (r) = v(R) (A)
LJ (r) + vLJ (r)
0
r 6 rmin r > rmin
−1
v(A)
v(R)
LJ (r) = vLJ (r) + ε 0
LJ
−2
0.8 1.0 1.2 1.4 1.6 1.8 2.0 v(A)
LJ (r) = −ε vLJ (r)
r/σ
Three-body forces
Triple-dipole interaction

BM Axilrod, E Teller, J. Chem. Phys., 11, 299 (1943).

rj

θj rjk
rij

θi θk
ri rk
rki

1 + 3 cos θi cos θj cos θk


v(3) (ri , rj , rk ) = ν
r3ij r3jk r3ki
Molecular models
For molecular systems, we simply build the molecules out of
Lennard-Jones site–site potentials, or similar.
XXX
Unb = vLJ (riajb ) riajb = ria − rjb
i<j a b

i
j
a=1
b=2

a=2
b=1
Linear molecule forces and torques

ei
θi
ej
φij
θj ri
rij
rj
Rigid molecular interactions
JG Gay, BJ Berne, J Chem Phys, 74, 3316 (1981).

4.0

2.0
v(r)/0

0.0

−2.0

−4.0

1.0 2.0 3.0 4.0 5.0


r/σs
Partial charges and polarizability

H H
+q +q

−2q
q2 (t) q1 (t)

O
q4 (t)
q3 (t)

The charges q1 (t) . . . q4 (t) respond dynamically to the local field.


Molecular models

Potential energy depends on:


I internal coordinates
4
I bond stretching r
φ I angle bending θ
θ0 I angle twisting φ
2 r I non-bonded atom
3 interactions
θ I Lennard-Jones
I electrostatics (partial
charges, multipoles)
1
Intramolecular bonding potentials

A very simple example:


X 2 X 2
1 1
Uint = 2 kij rij − req + 2 Kijk θijk − θeq
bonds bend
angles
X X
Cm
ijk` 1 + cos(mφijk` − γm )
 
+
torsion m
angles

I Constants kij etc. are ingredients of a ‘force field’.


I Bond vibration frequencies relatively high
I E.g. for C—H bonds, period ∼ 10fs

I Angle-bend timescales somewhat lower


I E.g. in H O, period ∼ 20fs.
2
I All of this affects the MD time step ∆t that must be used.
Polymer chain forces

ra−2
ra−4 θa−1
φa−1
ra−1 ra+1
da−3 da−1 φ
a
da−2
θa−2 θa φ
da a+1
ra−3 da+1
θa+1
ra

I Bond stretch da gives forces on a, a − 1.


I Angle bend θa gives forces on a, a − 1, a − 2.
I Angle torsion φa gives forces on a, a − 1, a − 2, a − 3.
FENE bond stretching potential

200

150
v(r)/

100

50

0
0.0 0.5 1.0 1.5
r/σ
Angle torsion potential

2 000

v(φ)/kB (K) 1 500

1 000

500

0 π
−π 0
φ (radians)
Deriving forces from potentials

Hopefully someone has done this correctly!


It is a common source of error in home-written programs.
The bond angle-bending potential provides a simple example.
Express it as a function v(cos θijk ). Use the chain rule
 
dv
fi = −∇ri v(cos θijk ) = − ∇ri cos θijk
d cos θijk

and similarly for fj , fk ; then we need


−1/2 −1/2
cos θijk = r̂ij · r̂jk = rij · rij

rjk · rjk rij · rjk

Gradients of cos θijk with respect to ri , rj and rk easily calculated.


Derived forces affect all three atoms i, j and k.
Discuss: is it true that fi + fj + fk = 0, where the forces are
derived from an arbitrary function v(cos θijk )? Can you prove it?
Simple model potentials

hard sphere square well


v(r) v(r)

σ σ1
σ2
r r
Outline
Introduction
Statistical mechanics
Molecular dynamics
Monte Carlo methods
Some tricks of the trade
Long-range forces
Parallel Simulation
How to analyse the results
Advanced Monte Carlo methods
Rare-event simulation
Non-equilibrium molecular dynamics
Mesoscale methods
Quantum simulations
Inhomogeneous fluids
Simulation and statistical mechanics

I We feed in microscopic information:


I atomic or molecular coordinates r = {r , r , · · · , r }
1 2 N
I possibly, conjugate momenta p = {p1 , p2 , · · · , pN }

I We compare results with theories or experiments


I thermodynamic quantities
I structure
I phase transitions
I dynamical properties
I We need to understand some statistical mechanics
I Distributions of states and how to sample them
I Finite-size effects
I Correlation functions in space and time
Time and ensemble averages

Potrebbero piacerti anche