8 (4/12/05) 3.320 Lecture 1 Monte Carlo Simulation II and

advertisement
3.320 Lecture 18 (4/12/05)
Monte Carlo Simulation II and
free energies
Figure by MIT OCW.
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
References
General Statistical Mechanics
D. Chandler, “Introduction to Modern Statistical Mechanics”
D.A. McQuarrie, “Statistical Thermodynamics” OR “Statistical
Mechanics”
Monte Carlo
D. Frenkel and B. Smit, "Understanding Molecular Simulation", Academic
Press.
Fairly recent book. Very good background and theory on MD,
MC and Stat Mech. Applications are mainly on molecular
systems.
M.E.J. Newman and G.T. Barkema, “Monte Carlo Methods in Statistical
Physics”
K. Binder and D.W. Heerman, “Monte Carlo Simulation in Statistical
Physics”
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Monte Carlo is Efficient Sampling of Ensemble
Ensemble is collection of possible microscopic states
exp( EHQ )
Q
PQ
¦ PQ EQ
U
Q e
PQVQ
¦
Q
V
e
Simple Sampling
Pick states Q randomly and weigh their property proportional to PQ
M
A!
PQ AQ
¦
Q
1
PQ
exp( EHQ )
M
¦ exp(EHQ )
Q 1
Importance Sampling
Pick states with a frequency proportional to their probability PQ
M
A!
¦
Q
AQ
Probability
weighted sample
1
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Metropolis Algorithm
Put it all together: The Metropolis Monte Carlo Algorithm
1. Start with some configuration
2. Choose perturbation of the system
3. Compute energy for that perturbation
4.
If '(!accept perturbation
If '(!!accept perturbation, accept perturbation with
ª'E º
probability
exp «
¬ k7 »
¼
5. Choose next perturbation
Property will be average over these states
Metropolis, Rosenbluth, Rosenbluth, Teller and Teller, The Journal of Chemical
Physics, 21, 1087 (1953).
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Ising Model
But first, a model system: The Ising Model
At every lattice site i, a spin variable Vi = +1 or -1
H
1
¦ J V iV j
2 i, j
Also used for other “two-state” systems: e.g. alloy ordering
Which perturbation ? Pick spin and flip over
1. Start with some spin configuration
2. Randomly pick a site and consider flipping the spin
over on that site
3. Compute energy for that perturbation
4.
If '(!accept perturbation
If '(!!accept perturbation, accept
perturbation with probability exp ª'E º
«
¬ k7 »
¼
5. Go back to 2
Implemented by random numbers
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Random Numbers
Most random number generators generate integers between 0 and 2N - 1
To generate real numbers in interval [0,1], division by 2N is performed
…
0
1 2 3
2N 2N 2N
1
The probability that “0” is given for the random number is 1/2N
When rand = 0, any excitation occurs, since exp (-E'E) > 0, for
any 'E
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
What exactly is the quantity in the exponential ?
E.g. Ising Model
At every lattice site i, a spin variable Vi = +1 or -1
H
1
¦ J V iV j P i ¦ V i
2 i, j
i
If average spin of system is not conserved, then probability need to be
weighted by
4/12/05
ª § 1
·º
exp « E ¨ ¦ JV iV j Pi ¦ V i ¸»
¹»
«
i
¬ © 2 i, j
¼
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Legendre Transform of Energy and Entropy
Energy formulation
dU
Legendre
transforms
TdS ( pdV) PdN ...
F
G
U TS
U TS pV
Different variables F(V,N,T),
G(P,N,T)
Entropy formulation
dS
4/12/05
P
p
1
dN ...
dU ( dV) T
T
T
1
1
S U
A( ,V, N)
T
T
These are the form of the
p
1
1 p
S U V
K( , ,N)
Hamiltonians !
T
T
T T
P
1
P
1
S U N
L( ,V, )
T
T
T
T
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Lab problem: H adsorption phase diagram on Pd (100)
Simple transformation to a lattice model -> spin can be used to indicate
whether a lattice site is occupied or not. E.g. Adsorption on surface sites
H
1
W1 pi pj Ea ¦ pi
¦
2 i, j
i
pi = 1 when site is occupied by H, =0 when not
Can be transformed to:
H
1
V1V iV j Pi ¦ V i
¦
2 i, j
i
V1
with
P
Can use canonical or grand-canonical ensemble to get
H/Pd(100) phase diagram
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
W1
4
Ea zW1
4
2
Why work grand canonical instead of canonical ?
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Accuracy of Monte Carlo to obtain Ensemble Properties
Not worry about accuracy of model or Hamiltonian. Only ask question:
Given H, how good is Monte Carlo sampling to get properties of ensemble ?
As good as you want !
Sources of error: Finite sample (time in MC); Finite Size (Periodic
Boundaries)
Sampling Error
error on the average for random
sampling ?
2
2
V av
A ! A “A” is quantity being sampled
2
V dist
m
A 2 ! A !2
|
m
Sample size
V dist
How accurate is the average ?
A
A (True average)
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
But sample is correlated
States in Markov chain are not independent. State is obtained from
previous state through some perturbation mechanism !
Convergence is not as good as random sampling formula would
indicate.
Correlation Time
t
Correlation function CA (W )
limt !f
1 A(t) A ! A(t W ) A ! dt
2
2
³
t0
A !A!
e.g. velocity in harmonic oscillator
f
Correlation time
WA
³ C (W )dW
A
0
Quality of average gets
diluted by correlation time
4/12/05
V
2
av
A2 ! A ! 2
(1 2W A )
m
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Correlation time in Ising models
long tail is spurious
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Size effects
Only important near second order transitions and for phases to “fit”
within the periodic boundary conditions
100
5L
80
10 L
20 L
30 L
60
XL
50 L
40
Figure by MIT OCW.
20
0.9
4/12/05
1.0
1.1
1.2
1.3
T/Tc
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
It is your move !
“Dynamics” in Monte Carlo is not real, hence you can pick any “perturbations” that
satisfy the criterion of detailed balance and a priori probabilities.
e.g. mixing of A and B atoms on a lattice (cfr. regular and
ideal solution in thermodynamics)
Could pick nearest neighbor A-B interchanges (“like” diffusion)
-> Glauber dynamics
Could “exchange” A for B
-> Kawasaki dynamics
For Kawasaki dynamics Hamiltonian needs to reflect fact that number of A and B
atoms can change (but A+B number remains the same) -> add chemical potential
term in the Hamiltonian
H
1
AB
AA
BB
A B
B A
A A
B B
A
(V
(p
p
p
p
)
V
p
p
V
p
p
)
(
P
P
)
p
¦
i
j
i
j
i
j
i
j
A
B ¦ i
2 i, j
i
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
With more difficult system, algorithms that can easily access
the low energy states are most efficient
Example: Heisenberg Model: continuously rotating magnetic moment
z
Coordinates
r
θ
y
φ
Figure by MIT OCW.
x
Should I pick T and I randomly ?
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Proper distribution of T and I
Random distribution of T and I does not give random distribution of vector
orientation in space. For small Tall I give spin oriented along the z-axis
Area is proportional to 2Ssin(T d T
T
Need to pick Tproportional to sin(T d T
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Sampling variables that are not homogeneously distributed in
phase space
P(x)
PT
1/2
-1
1
x
Homogeneous distribution of
random numbers
T(x) ?
0
90
Distribute T as 1/2 sin(T)
T = cos-1 (-x)
4/12/05
180
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
T
Low Temperature Spin Waves
More efficient to perturb spins slightly by picking their new orientation
from a narrow cone around the old orientation
Figure by MIT OCW.
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Long chain molecules
Fixed dihedral angle, but still
rotation possible
Sample configuration space by sampling possible
values of free rotations. Often only small
perturbations possible
ω
Figure by MIT OCW.
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Polymers on a lattice
Possible algorithms ?
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Non-Boltzmann sampling and Umbrella sampling
Simple Sampling
Importance Sampling
Sample with Boltzmann weight
Sample randomly
M
A!
¦
Q 1
exp( EHQ )
M
exp( EHQ )
¦
Q
M
AQ
A!
¦
Q
AQ
1
1
Non Boltzmann Sampling
Sample with some Hamiltonian
Ho
'H = H - Ho
M
¦ exp(E (HQ HX ))
o
A!
AQ
Q 1
M
¦ exp(E(HQ HX
o
))
Q 1
[end of this day’s lecture…to be continued next lecture.]
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Monte Carlo
Advantages
•Conceptually simple
•Easy to implement
•Can Equilibrate any degree of freedom/No Dynamics needed
•Accurate Statistical Mechanics
Disadvantages
•No Kinetic Information
•Requires many Energy Evaluations
•Stochastic nature gives noise in data
•Not easy to get entropy/free energy
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
References
D. Frenkel and B. Smit, "Understanding Molecular Simulation", Academic
Press.
Fairly recent book. Very good background and theory on MD,
MC and Stat Mech. Applications are mainly on molecular
systems.
M.E.J. Newman and G.T. Barkema, “Monte Carlo Methods in Statistical
Physics”
K. Binder and D.W. Heerman, “Monte Carlo Simulation in Statistical
Physics”
4/12/05
3.320 Atomistic Modeling of Materials G. Ceder and N Marzari
Download