Professional Documents
Culture Documents
Molecular Dynamics Simulations in Materials Science: Algorithms, Interatomic Potentials and Parallel Computing
Molecular Dynamics Simulations in Materials Science: Algorithms, Interatomic Potentials and Parallel Computing
Molecular Dynamics Simulations in Materials Science: Algorithms, Interatomic Potentials and Parallel Computing
Fabrizio CLERI
2
F. Cleri – Introduction to Molecular Dynamics
OUTLINE
3
F. Cleri – Introduction to Molecular Dynamics
4
F. Cleri – Introduction to Molecular Dynamics
MOTIVATION : WHY ATOMIC-SCALE COMPUTER SIMULATIONS ?
5
F. Cleri – Introduction to Molecular Dynamics
STATISTICAL MECHANICS AND THERMODYNAMIC ENSEMBLES .
Without going into excessive details about the formal connection between the
kinetic theory and statistical mechanics of a classical system, we will
consider a system of N pointlike atoms, and want to be able to perform
measurements of some observable A (internal energy, pressure, specific heat,
transport coefficients, ...).
1 ⌠τ
A Macroscopic = < A >Ensemble ˜ lim τ⌡ A(Γ(t)) dt
0
The time (or “trajectory”) average must be performed under the same
thermodynamic constraints of the ensemble average that it replaces.
For example:
6
F. Cleri – Introduction to Molecular Dynamics
CLASSICAL DYNAMICS FROM A LAGRANGIAN POINT OF VIEW .
d ∂L ∂L
( )
dt ∂q• - (∂qi ) = 0
i
_______________________________
••
mi q i
= Fi
Fi = - Σqi V
7
F. Cleri – Introduction to Molecular Dynamics
In a rather general way, atomic coordinates Ri are expressed in a scaled form
si ∈{0,1} through the introduction of a metric tensor
G = hT ⊗ h
Ri = h ⊗ s i cartesian coordinates
Ω = det h = a ( b ^ c ) volume
Rz
sz c
sy
0 1 0
b Ry
Rx a
1
sx
This definition is very useful because it allows any generalized variables (other
than R: chemical species, magnetic moment, spin, ...) to be attached to an atom
, or to the system as a whole.
8
F. Cleri – Introduction to Molecular Dynamics
1 • • 1 • •
L = 2 Σ i mi s i
T
Gs i + 2 W Tr (h T
h ) - Σ i,j>i V(Rij) - pΩ
1 ∂V
mi s
••
i
= - Σ j≠i ( )
Rij ∂Rij (s i - s j) - G -1 •
G s
•
i
••
Wh = (π - p) σ
1 1 • •
H = 2 Σ i mi v2i + 2 W Tr (h T
h ) + Σ i,j>i V(Rij) + pΩ
H = U + pΩ
with the internal energy:
1
U = 2 Σ i mi v2i + Σ i,j>i V(Rij)
9
F. Cleri – Introduction to Molecular Dynamics
1 ∂V
α
Ri
Fi
α
= - Σ j≠i [ ( )] (
Rij ∂Rij Rij )
∂V ∂f
where for a non-pair-additive V = V[f(R)] we compute ∂R = ∂R ( ) (∂V
∂f
).
Special recipes (Ewald sum) exist to evaluate infinitely-ranged forces,
such as the Coulomb 1/R potential.
∂ ∂H (λ )
Fλ = - ∂λ < H (λ) > = < ∂λ >
∂Hkβjα
n
Fi = - 2 Σ n Σ kβjα (ckβ )* ( ∂Ri ) cjαn
10
F. Cleri – Introduction to Molecular Dynamics
All integration methods are based on finite differences and are explicit-
forward in time.
OPEN Algorithms
1
Euler: xn+1 = xn + h vn + 2 h2 f(xn) (essentially a Taylor
vn+1 = vn + h f(xn) expansion for x and v)
2 1
Beeman: xn+1 = xn + h vn + 3 h2 f(xn) - 6 h2 f(xn-1)
1 5 1
vn+1 = vn + 3 h f(xn+1) + 6 h f(xn) - 6 h f(xn-1)
11
F. Cleri – Introduction to Molecular Dynamics
CLOSED Algorithms
Keep track of a vector containing for each atom the coordinates xn and its
first m derivatives
1 1 1
xn ={ xn ; h xʼn ; 2 h2 xʼʼn ; 6 h3 xʼʼʼn ; ... m! hm x(m)n }
yn+1 = A xn
with
F ( yn+1 )
And finally , CORRECT using the difference between F(yn+1) and yʼʼn+1
1
xn+1 = yn+1 + a 2 h2 [ F(yn+1) - yʼʼn+1 ]
3 251 11 1 1
a = { 20 , 360 , 1 , 18 , 6 , 60 }
12
F. Cleri – Introduction to Molecular Dynamics
13
F. Cleri – Introduction to Molecular Dynamics
14
F. Cleri – Introduction to Molecular Dynamics
{Ri}i=1,N Ri=n1a+n2b+n3c
Each atom has Z electrons. The system has M=ZN electrons and N ions.
Using (1) and (2), the total Hamiltonian of the system can be written
1
|Ψtot > = Πi Φi = det { Φ1(Ri), ... , ΦN(Ri) }
N
15
F. Cleri – Introduction to Molecular Dynamics
Htot |Ψtot > = Σ i H i |Φi (x) > = Etot Σ i |Φi (x) > x={r,σ}
r=coordinates
σ=spin
electron electron-ion
kinetic energy potential
h 2 Z e2
Hi | Φi (x) > = { - 2m S2 - Σ k | r i - Rk | +
| Φ (xʼ) |2
+e Σj⌠ 2 j
⌡ dx4 ʻ | r - r ʼ |
i j
} | Φi(x) > -
electron-electron correlation
(“exchange” or “Fock” potential)
Φ∗j(xʼ) Φj(xʼ)
- e2 (Σ j
⌠
⌡ dx4 ʻ | ri - rjʼ | ) |Φj(x) >
The |Φi (x) > are obtained iteratively, adjusting at each step the Hartree
and the Fock-exchange potentials to the new variational set |Φi (x) > from
the previous step , until convergence is achieved.
16
F. Cleri – Introduction to Molecular Dynamics
3 n(r)
VSlater = -3 e2 [ 4π ] 1/3
1 n(r) n(rʼ)
E = T [ n(r) ] + ⌠
⌡ V(r) n(r) dr + 2 ⌠
⌡ |r - rʼ| dr drʼ + ⌠
⌡ n(r) ε exc[n(r)]
dr
kinetic energy of electron-ion Hartree potential , Exchange-correlation
n(r)
noninteracting el. potential , Vext VH =⌠ ⌡ dr’ ,|r-r’| potential (contains all
which at the self-consistency must satisfy n0(r-Ri)=n(r) (i.e., the exchange and
correlation potential is dictated by the average electron density <n>).
The K-S approximation first obtains a solution for the homogeneous electron
gas and then replaces the average density <n> with the point density n(r).
This is the LOCAL DENSITY APPROXIMATION (LDA).
17
F. Cleri – Introduction to Molecular Dynamics
n n
Σα ciα H |Φiα > = ε n Σα ciα |Φiα >
Σα ciα
n
( < Φjβ | H |Φiα > - ε n < Φjβ |Φiα > ) =0
or in matrix form :
(this sometimes called the
n
Σα ciα ( Hiαjβ - ε n Siαjβ ) = 0 Roothan-Hartree-Fock equation)
For the TB-LCAO minimization of the total energy, loop on these two steps:
(1) the coefficients ciα are iteratively calculated, Hiαjβ and Siαjβ are fixed.
(2) then fix the ciα and recalculate self-consistently the |Φiα> .
18
F. Cleri – Introduction to Molecular Dynamics
Observations:
(4) The multi-center (more than two-electron) integrals in Hiαjβ decay very
fast + the e-e (Pauli) repulsion is assumed spherically-symmetric ➠
TWO-CENTER APPROXIMATION (Slater & Koster 1954)
(CNDO/MNDO methods, very popular in chemistry)
The fitting parameters Hiαjβ and Siαjβ are adjusted on a large data base
and are kept fixed during the calculation.
n
EBS = Σ iα Σ n | ciα |2 ε n
19
F. Cleri – Introduction to Molecular Dynamics
Hss = <ssσ>
<ss ">
Hspα = mα <spσ> <sp ">
<pp" >
with :
obtained from the eigenvalue problem
EBS = Vi-e + 2 Ve-e (includes all the direct eletronic interactions)
20
F. Cleri – Introduction to Molecular Dynamics
If we consider all electrons “frozen” in the ground state, then the only term
describing the interaction is the classical (i.e., not explicitly quantum-
mechanical) many-body interatomic potential.
VLJ(Rij) = ε [ ( Rσ )
ij
12
- ( Rσ ) ]
ij
6
Zi Zj
Vionic(Rij) = 4πε0 Rij + ( RΒ )ij
m
+ Ce
-ARij
21
F. Cleri – Introduction to Molecular Dynamics
n(E)
E E E E
f f f
UB = µ2[n(E)] = Σ i Σ j ξ2 e -αRij
22
F. Cleri – Introduction to Molecular Dynamics
The interatomic bonds are extremely strong and angular forces (i.e., three-
and four-body terms) play a dominant role.
with :
1 2
h(Rij,Rik,θijk) = 21. (cos θijk +3 ) exp [ R 1.2
- 1.8
ij
1.2
+ Rik - 1.8 ]
The three-body term is always positive whenever the bond angle among a
triplet of nearest-neighbors θijk is not equal to 109.57˚, or if cos θijk ≠ -1/3,
which forces the structure to be tetrahedrally (four-fold) coordinated, as
expected for the diamond structure of crystalline Silicon.
23
F. Cleri – Introduction to Molecular Dynamics
24
F. Cleri – Introduction to Molecular Dynamics
EXAMPLE 1:
MOLECULAR DYNAMICS STUDY OF SILICON GRAIN BOUNDARIES
WITH SEMI-EMPIRICAL QUANTUM-MECHANICAL FORCES.
pi2
H= Σi 2m + Σ n <Ψn| HTB |Ψn> + Urep
The matrix elements of the Hamiltonian have the following radial form:
Urep= Σ i f [ Σ j V(Rij) ]
with
f(x) = c0 + c1 x + c2 x2 + c3 x3 + c4 x4
V(R) = (RR )p
0
exp -p{ [(RRq )q - (RRq )q]}
0
25
F. Cleri – Introduction to Molecular Dynamics
TRANSLATION !
VECTOR
26
F. Cleri – Introduction to Molecular Dynamics
2000
melting
1500
TEMPERATURE (K)
1000
TERSOFF
classical MD
500
TB MD
0
0 10 20 30 40 50 60 70
TIME (psec)
27
F. Cleri – Introduction to Molecular Dynamics
P(cos !)
g(r)
THE AVERAGE COORDINATION IN THE GB REGIONS IS 4.07. THIS MEANS THAT THE
DISORDERED LAYER CAN SUSTAIN THE PRESENCE OF A SMALL CONCENTRATION
OF COORDINATION DEFECTS IN THERMAL EQUILIBRIUM.
28
F. Cleri – Introduction to Molecular Dynamics
3-fold
ELECTRONIC DENSITY OF STATES
4-fold
5- f ol d
-6 -4 -2 0 2 4 6
Energy (eV)
29
F. Cleri – Introduction to Molecular Dynamics
LOCALIZATION INDEX :
(n ) 4
(n )
L
i = #" c i"
1.00
0.75
0.50
[5 ] [5 ] [3 ]
0.25 [5 ]
0.00
-0.25
-0.50
30
F. Cleri – Introduction to Molecular Dynamics
EXAMPLE 2:
FREE ENERGIES OF DISORDERED SOLIDS FROM A COUPLED
MOLECULAR-DYNAMICS AND CLUSTER-VARIATION METHOD.
mv i2
Etot = Σ i { 2 + [Σ j Φ e -β (Rij/R0 -1) - Σ j ξ2 e -α (Rij/R0 -1) ]}
with :
Cu-Cu Au-Au Cu-Au
m 63.54 196.97 -
R0 (Å) 2.556 2.884 2.642
Φ (eV) 0.0855 0.2061 0.1539
β 10.96 10.229 11.05
ξ (eV) 1.224 1.79 1.5605
α 2.278 4.036 3.0475
31
F. Cleri – Introduction to Molecular Dynamics
OCCUPATION
DISORDERED:
1/4 Au +
3/4 Cu
ISSUES :
(2) constant-{NpT} Molecular Dynamics gives access to the enthalpy H, but not
to entropy terms.
32
F. Cleri – Introduction to Molecular Dynamics
wijkl is the probability that a basic tetrahedron is occupied by the sequence ijkl.
(For example, if Cu=1 and Au=2, the sequence 1121 is Cu-Cu-Au-Cu. The
T=0 K “ordered” sequence is 1112)
( x4 - 1/4 ) 1
η = ( 1 - 1/4 ) = 6 Σ ijkl Hijkl wijkl
where Hijkl = hij+hik+hil+hjk+hjl+hkl and hαβ = (-1)β for β=i,j,k, (-1)β+1 for β=l.
5
Sconf = - NkB { 4 Σ ijkl [ L(xi) + L(xj) + L(xi) + L(xj) ]
- Σ ijkl [ L(yij) + L(yjk) + L(yjk) + L(yil) + L(yjl) + L(ykl) ] + 2 Σ ijkl L(wijkl) }
33
F. Cleri – Introduction to Molecular Dynamics
Obtain a matrix of values H(η,σ ,T) (we had about 300 different values) and
make a multi-linear fit. The best fitting function is
ωmax
Svibr(T) = kB ⌠
⌡ dω g(ω) {-log[2sinh(2khωBT )] + 2khωBT ( hω
coth 2k T
B
)}
0
34
F. Cleri – Introduction to Molecular Dynamics
Now we have a complete expression for the free energy , in terms of the
occupation probabilities wijkl of the basic tetrahedra:
35
F. Cleri – Introduction to Molecular Dynamics
36
F. Cleri – Introduction to Molecular Dynamics
A new logic approach and new programming tools are also needed, to
organize and exchange information among the different processing units.
37
F. Cleri – Introduction to Molecular Dynamics
• REPLICATED DATA
All processors have locally a copy of all the data necessary to the
calculation. However, each processor works on a portion of the data, and
one master processor gathers and summarizes the individual results.
PRO: Very simple programming, inter-processor data exchange restricted to
a minimum.
CON: Extremely memory-consuming, limited to the maximum system size on
one single processor.
• FORCE DECOMPOSITION
Each processor builds and uses only a portion of the force matrix (or the
Hamiltonian matrix in q.-m. calculations), without regard to the spatial location
of the atoms/electrons giving rise to the different elements of the matrix.
PRO: It is the only tool for diagonalization of a large Hamiltonian matrix. Also,
very useful when the number of interactions to compute is much larger than
the number of atoms in the system (e.g., Coulombic interactions).
CON: it can be very difficult to program; moreover, loosing the reference to
the spatial location of the atoms can be source of wasted and inefficient inter-
processor communications.
• DOMAIN DECOMPOSITION
Each processor works on the atoms contained inside a compact region
of space. Interactions along the border of such region require knowledge of
what is happening to the atoms in neighboring regions (i.e., on the
“logically adjacent” processors).
PRO: Relatively easy to program, requires some topology work to be made
efficient; can reach the limits of extremely large sizes (100ʼs millions of atoms
on very large parallel computers).
CON: The strategy and topology of the huge amount of inter-processor
communication required must be treated very carefully, otherwise efficiency is
very poor.
38
F. Cleri – Introduction to Molecular Dynamics
39
F. Cleri – Introduction to Molecular Dynamics
40
F. Cleri – Introduction to Molecular Dynamics
PROGRAM MD
#include "tcgmsg.fh"
[...........]
CALL PBEGINF
MYNOD = NODEID ()
NPROC = NNODES ()
[...........]
C READ INPUT DATA, INITIALIZE THE CALCULATION
[...........]
C Molecular Dynamics MAIN LOOP
DO ITIME=1,NTMAX
[...........]
CALL PREDICTOR (... ... ... )
C Broadcast predicted new coordinates to all processors
CALL SYNCH (nn1)
CALL BRDCST (msgid, RX, natoms*8, 0)
CALL BRDCST (msgid, RY, natoms*8, 0)
CALL BRDCST (msgid, RZ, natoms*8, 0)
[...........]
CALL FORCES (... ... ... )
CALL SYNCH (nn2)
IF (MYNOD. NE. 0) THEN
CALL SND (msgid, FORCEX, natoms*8, 0, 1)
CALL SND (msgid, FORCEY, natoms*8, 0, 1)
CALL SND (msgid, FORCEZ, natoms*8, 0, 1)
ELSE
DO nk=1,NPROC
CALL RCV (msgint, FORCEX, natoms*8, length, nk, n0, 1)
CALL RCV (msgint, FORCEY, natoms*8, length, nk, n0, 1)
CALL RCV (msgint, FORCEZ, natoms*8, length, nk, n0, 1)
END DO
END IF
CALL CORRECTOR (... ... ... )
[...........]
END DO ! End-do main MD loop
CALL PENDF
STOP
END
41