Monte Carlo

advertisement
Monte Carlo Methods in
Statistical Mechanics
Aziz Abdellahi
CEDER group
Materials Basics Lecture : 08/18/2011
1
What is Monte Carlo ?
Monte Carlo is an administrative area of the principality of
Monaco.
Famous for its casinos !
Monte Carlo is a (large) class of numerical methods used to solve
integrals and differential equations using sampling and
probabilistic criteria.
2
The simplest Monte Carlo method
Finding the value of π (“shooting darts”)
π/4 is equal to the area of a
circle of diameter 1.

4
1

 dx dy
x 2  y 2 1
Integral solved
with Monte Carlo

1
Details of the Method
Randomly select a large number of points inside the square
N _ inside _ circle
  4*
N _ total
(Exact when N_total  ∞)

3
MC : Common features and applications
Common features in Monte Carlo methods
Uses random numbers and selection criteria
Requires the repetition of a large number of events
Monte Carlo method that will be discussed in this talk
Monte Carlo in Statistical Mechanics : Calculating thermodynamic
properties of a material from its first-principles Hamiltonian
Example of results obtained from MC : LixFePO4 (Li-ion battery
cathode)
Only consider configurational
degrees of freedom (Li-Vacancy)
The energies of all Li-Vacancy
configurations are known
(Hamiltonian)
4
Results obtained from Monte Carlo
Useful battery properties that can be obtained from Monte Carlo
Phase diagram, Voltage profiles
These properties are deduced from the μ(x,T) relation [or alternatively x(μ,T)]
Results obtained in the Ceder group (using Monte Carlo)
LixFePO4 phase diagram
Voltage profile (room temperature)
5
How to calculate the partition function ?
Key physical quantity : The partition function
 1

QT,   exp
E j  N j 
 kB T

j


{j} : Set of all possible Li-Vacancy configurations
Ej : Energy of configuration j
Nj : Number of Li in configuration j
Control parameters

All thermodynamic properties can be computed from the partition function
x ,T 

 1

Nj
1
 
exp
E j  N j 
Q j N Li _ sites
 kB T



 1

1
E  ,T    Ej exp
Ej  N j 
Q j
 kBT

Etc.
Finding a numerical approximation
to the partition function

The partition function cannot be calculated directly because the number of
configurations scales exponentially with the system size (2N_sites possible
configurations … too hard even for modern computers !).
Monte Carlo strategy : Calculate thermodynamic properties by sampling
configurations according to their Boltzmann probability
6
Monte Carlo or “Importance Sampling”
Importance sampling : Sample states according to
their actual probability
Consider the following random variable x :
Direct calculation of <x> :
x  0* 0.1  1* 0.8  2* 0.1  1
Importance sampling : Randomly pick 10 values of x out of a giant hat
containing 10% 0’s, 80%
 1’s and 10% 2’s.
Possible outcome : 10 2 11112 11
x  1.1
The arithmetic average will not always be equal to the average.
However, the two become equal in the limit of large “chains”.


Importance sampling
: Sample states with the correct probability. Works
well for very large systems that have heavy probability discrepancies.
7
Monte Carlo or “Importance Sampling”
Monte Carlo : Methodology
Start from an initial configuration C1
Create a Markov chain of configurations, where each configuration is
determined from the previous one using a certain probabilistic criteria
C1  C2  …  CN_max
Choose the probabilistic criteria so that states are asympotically sampled
with the equilibrium Boltzmann probability (that is the main difficulty !)
Lim  P Cn  
n

 1

1
exp
E


N
 n
n 
Q
 kB T

En : Energy of configuration Cn
Nn : Number of Li in configuration Cn
Calculate thermodynamic averages directly through arithmetic averages
over the Markov Chain
nM
1
Nn
x ,T  

(N Max  M) Configurationsin Markov Chain Number_ Li _ sites
8
Metropolis Algorithm
Building the chain : The Metropolis Algorithm
Start from an initial configuration C1 :
Change the occupation state of the first Li site :
Calculate Ei-μNi (Before the change) and Ef -μNf (After the change)
If Ef -μNf < Ei-μNi , accept the change
If Ef-μNf > Ei –μNi , accept the change with the probability :
Paccept
 1

 exp
E f  N f  E i  N i  
k
T
 B




Repeat for all other Li sites to get C2
(Ratio of Boltzmann probabilities…)
9
Metropolis algorithm (3)
Why does the Metropolis algorithm work ?
The Metropolis algorithm generates a chain Markov consistent with
Boltzmann probabilities sampling because the selection criteria has
Boltzmann probabilities built into it.
 It can be shown that all selection criteria that respect the
condition of detailed balance produce correct sampling :
 1

Pi j
 exp
E j  N j  E i  N i  
Pj  i
 kB T





Pi j :
Probability of generating
configuration j from configuration i

Because the most probable configurations are sampled preferentially, good
approximations of thermodynamic averages can be obtained by sampling a
relatively small number of configurations
10
Conclusion
Monte Carlo in Statistical Mechanics
Method to approximate thermodynamic properties using clever sampling
Good results can be obtained by sampling a relatively small number of
configurations (relative to the total number of possible configurations) :
 LixFePO4 voltage profile : 50 000 states sampled instead of 21728
Other Monte Carlo methods in engineering
Kinetic Monte Carlo (to calculate diffusivities)
Quantum Monte Carlo (to solve the Schrodinger equation)
Monte Carlo in nuclear engineering (to predict the evolution of the neutron
population in a nuclear reactor)
11
Questions ?
12
Download