You are on page 1of 25

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

PQ
exp( EHQ ) U ¦ PQ EQ
Q e
Q
V ¦
Q
PQVQ
e

Simple Sampling
Pick states Q randomly and weigh their property proportional to PQ
M exp( EHQ )
 A! ¦ PQ AQ PQ M
Q 1
¦ exp(EHQ )
Q 1
Importance Sampling
Pick states with a frequency proportional to their probability PQ

M Probability
 A! ¦
Q 1
AQ weighted sample

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
probability ª'E º
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

1
H  ¦ 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 º
5. Go back to 2 «
¬ k7 »
¼
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 1
2N 2N 2N

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

1
H  ¦ 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


ª § 1 ·º
weighted by exp « E ¨ ¦ JV iV j  Pi ¦ V i ¸»
¬ © 2 i, j
« i ¹»
¼

4/12/05 3.320 Atomistic Modeling of Materials G. Ceder and N Marzari


Legendre Transform of Energy and Entropy

Energy formulation

dU TdS  ( pdV)  PdN  ...


Legendre F U  TS Different variables F(V,N,T),
transforms G U  TS  pV G(P,N,T)

Entropy formulation
1 p P
dS dU  ( dV)  dN  ...
T T T
1 1
A( ,V, N) S U
T T
1 p 1 p These are the form of the
K( , ,N) S U V Hamiltonians !
T T T T
1 P 1 P
L( ,V, ) S U N
T T T T
4/12/05 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

1
H ¦
2 i, j
W1 pi pj  Ea ¦ pi
i

pi = 1 when site is occupied by H, =0 when not


Can be transformed to: W1
1 V1
H ¦ V1V iV j  Pi ¦ V i with 4
2 i, j i Ea zW1
P 
2 4

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


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
“A” is quantity being sampled
error on the average for random
sampling ? 2
2 V dist  A 2 !   A !2
2
V av  A !  A m
|
m

V dist Sample size

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
1 A(t)  A ! A(t  W )  A !
Correlation function CA (W ) limt  !f ³ 2 2 dt
t0 A !A!

e.g. velocity in harmonic oscillator


f

Correlation time WA ³ C (W )dW


A
0

2  A2 !   A ! 2
Quality of average gets V av (1  2W A )
diluted by correlation time m
4/12/05 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

80 5L

10 L

20 L

30 L
60
XL 50 L

40

Figure by MIT OCW.


20

0.9 1.0 1.1 1.2 1.3 T/Tc


4/12/05 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
1
H ¦
2 i, j
(V
AB
(p i
A B
p j  p
B A
i p j )  V
AA
p i
A A
p j  V
BB
p i
B B
p j )  ( P A  P B ¦ i
)
i
p
A

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

φ
Figure by MIT OCW.

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

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) P T

1/2

x T
-1 1 T(x) ? 0 90 180
Homogeneous distribution of Distribute T as 1/2 sin(T)
random numbers

T = cos-1 (-x)

4/12/05 3.320 Atomistic Modeling of Materials G. Ceder and N Marzari


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 randomly Sample with Boltzmann weight


M M
exp( EHQ )
 A! ¦ M AQ  A! ¦ AQ
Q 1
¦
Q
exp( EHQ )
1
Q1

Non Boltzmann Sampling


'H = H - Ho
Sample with some Hamiltonian Ho
M

¦ exp(E (HQ  HX )) o
AQ
Q 1
 A! 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

You might also like