You are on page 1of 12

Middle 

East Technical University – Department of Metallurgical & Materials Engineering

The Monte Carlo Method
Prepared and Presented by :

Assoc.Prof.Dr. Caner Şimşir

2019 Spring METE 350 – Multi‐Scale Modeling and Simulation in Materials Science & Engineering 1/12


The Monte Carlo Method
 MCM provides an alternative to MD for
providing thermodynamic information.
 MCM was devised to solve
multidimensional integrals and rather
intractable problems.
 As a simple example, MC is used to
evaluate the following integral:
4

 ln  x   dx  x ln  x   x
4
1
 2.5418
1
 First, a region including the function to be
integrated.
 Then, random points in the region are
chosen using a random number generator.
 The integral is the fraction of points below
the curve to the total area of the region.
 Thermodynamics information can be
acquired by either time averaging (MD) or
by ensemble averaging (MCM). The focus
of this chapter is the direct calculation of
ensemble averages by the MCM.
2019 Spring METE 350 – Multi‐Scale Modeling and Simulation in Materials Science & Engineering 2/12
Ensemble Averages
 Standard Monte Carlo method describes the systems under constant temperature (T), volume
(V) and number of particles (N), which is the canonical ensemble.
 Thermodynamic averages for systems in the canonical ensemble are given by:

B 
 e  E / k BT
B
  B 
 e  E / k BT

 B is a thermodynamic quantity and α indicate the possible configurations in the system. The
probability of being in a specific configuration (ρα) is:

e  E / kBT e  E / kBT
  
 e  E / k BT
Q
 The partition function Q is

Q    e  E / kBT

2019 Spring METE 350 – Multi‐Scale Modeling and Simulation in Materials Science & Engineering 3/12


Ensemble Averages
 The relative probability between two states (α,β) takes the form of

  e  E / k T Q
B
 E  E  / k T
  e B

 Q e  E / k T B

 Then, the relative probabilities of two states is completely determined by the energy difference
ΔEα,β = Eβ - Eα


if E  E  0 then 1


if E  E  0 then 1


2019 Spring METE 350 – Multi‐Scale Modeling and Simulation in Materials Science & Engineering 4/12


Ensemble Averages
 When applying MC to atomic systems, the sum over discrete
states is replaced by a set of integrals.
 For a system of N atoms, the probability of an atomic
   

configuration r N  r1 , r2 ,..., rN is 
 
U ( r N )/ k BT U ( r N )/ k BT
N
  r   U ( r N )/ k T 
e e
 e B Z NVT
 ZNVT is the configurational integral.
 The average quantity that depends only on positions is:

1  N N
e
U ( r N )/ k BT
U  U (r )  dr
Z NVT
 In principle, evaluation requires a list of all possible
configurations. However, many of the configurations of any
system will be possible, but not probable.

 The key to Monte Carlo method is a very clever way to sample


only those configurations that are most likely. This approach is
often called as importance sampling.

2019 Spring METE 350 – Multi‐Scale Modeling and Simulation in Materials Science & Engineering 5/12


The Metropolis Algorithm
 Metropolis et al. introduced a method that samples configuration space in such a way that
state α, occurs in the sampling with a probability ρα.
 Metropolis algorithm creates that sampling by focusing on the relative probabilities of states.
The output is a set of states with correct probability, from which averages can be determined.
 The Metropolis algorithm is based on the idea that while we cannot know the actual probability
of a state (since we cannot evaluate Q). The relative probabilities can be used to create a list
through configuration space that has the correct probability distribution. This list is called a
trajectory through the configuration space.
 Their approach is to start a system at a configuration then make a trial move of the system to
a new configuration, and to test, based on the probability of the new configuration relative to
starting configuration whether the new configuration should be added to the trajectory or not.

Ei ,i 1 / k BT
if Ei ,i 1  0 then accept because e 1
Ei ,i 1 / k BT
if E  E  0 then accept move with probability e

 Repeating this procedure many times, we can generate a list of configurations {n} with energy
En that have the correct overall probability.

2019 Spring METE 350 – Multi‐Scale Modeling and Simulation in Materials Science & Engineering 6/12


Implementation of Metropolis Algorithm
a) Suppose the system starts in configuration i. A trial move
is made to configuration i+1 and ΔEi,i+1=Ei+1 - Ei is calculated.
b) Decide whether to accept or reject the trial move:
1. If ΔEi,i+1<=0 then ρi+1/ρi>=1, the move is accepted.
2. If ΔEi,i+1>0 then the move will be accepted with a
probability of exp(-ΔE/kBT). Decision is made by
generating a random number R between (0,1). If
R<exp(-ΔE/kBT) then the move is accepted else the
move is rejected.
c) If the trial is accepted then the next configuration in the
trajectory is the new state i+1.
d) If the trial move is rejected, the next configuration is taken
same as i.
e) Repeat
f) The average quantity <B> is then

1 m
B   B
m  1

2019 Spring METE 350 – Multi‐Scale Modeling and Simulation in Materials Science & Engineering 7/12


Sampling in the Metropolis Algorithm

2019 Spring METE 350 – Multi‐Scale Modeling and Simulation in Materials Science & Engineering 8/12


Monte Carlo Method for Atomic Systems
a) Randomly pick an atom I from N atoms. Atom i has ri(old) and U(old).
b) Move atom i to a new position by a random displacement.
1. Find 3 random numbers R1,R2,R3 in the range (-1,1)
2. Take xi (new)  xi (old )  R1 max
yi (new)  yi (old )  R2  max
zi (new)  zi (old )  R3  max
c) Find the change in potential energy ΔU=U(new)-U(old)

 
  

U    rj  ri  n     rj  ri  o 
j i j i
 
Accept or reject the move based on Metropolis algorithm.
1. If trial is accepted, the next entry in MC list is ri=ri(new) with
U=U(new)
2. If trial is rejected, the next entry in MC list is ri=ri(old) with
U=U(old)
e) Repeat
f) Accumulate the averages.

2019 Spring METE 350 – Multi‐Scale Modeling and Simulation in Materials Science & Engineering 9/12


Sampling in the Metropolis Algorithm

2019 Spring METE 350 – Multi‐Scale Modeling and Simulation in Materials Science & Engineering 10/12


Assessment of the Monte Carlo Method 
 One could argue that MC simulations offer no advantages over MD yet have the disadvantage
that there is a lack of dynamic information. For atomic systems with simple potentials, this is a
valid view. However, if one is interested in structure and thermodynamics MC is a reasonable
option.
 MC simulations are easily extended to molecular systems.
 It is generally easier to extend MC to other ensembles than MD.
 There are number of problems for which MC is the only approach such as spin models.
Indeed, any system in which there are no easily defined forces must be modeled with MCM.
 The principles of MC are not restricted to energy based modeling. In the next chapter, we
introduce a method Kinetic Monte Carlo, in which rates of the process takes the place of
energy, enabling long-time simulations of systems whose dynamics can be described as
activated processes.
 Uses of MCM in materials research :
 Structure and Thermodynamics
 Defect structure and properties
 Segregation

2019 Spring METE 350 – Multi‐Scale Modeling and Simulation in Materials Science & Engineering 11/12


Middle East Technical University – Department of Metallurgical & Materials Engineering

Thanks for listening.
Prepared and Presented by :

Assoc.Prof.Dr. Caner Şimşir

2019 Spring METE 350 – Multi‐Scale Modeling and Simulation in Materials Science & Engineering 12/12

You might also like