Professional Documents
Culture Documents
고려대학교
화공생명공학과
강정원
Contents
I-1. Introduction
I-1. Introduction
◼ Example of MC in Science
Classical Monte Carlo (CMC)
• Draw samples from a probability distribution to determine such thing
as energy minimum structure
Quantum Monte Carlo (QMC)
• Random walks are used to determine such things as quantum-
mechanical energy
Path-integral Monte Carlo (PMC)
• Quantum-statistical mechanical integral are evaluated to obtain
thermodynamic properties
Simulation Monte Carlo (SMC)
• Algorithm that evolve configurations depending on acceptance rules.
I-1. Introduction
◼ C-language code
I-1. Introduction
I-1. Introduction
A =
1 1
3N
Q h N! dp N
dr N
A( p N
, r N
) exp
− E ( r N
, p N
)
Q=
1
3N
h N!
dp N
dr N
exp − E( p N
, r N
)
I. Theoretical Basis of Molecular Monte Carlo Method
◼ Separation of Energy
Total energy is sum of kinetic and potential parts
E(r N , p N ) = K ( p N ) + U (r N )
1 1
= 3N
N! dr N
exp − U( r N
)
ZN
1 1
= 3N
ZN
I. Theoretical Basis of Molecular Monte Carlo Method
dr A( r , p ) exp U ( r
−
N N
Z N N! dr exp U ( r )
Start
Loop
Ncycles Trial Move Importance Sampling
Acceptance Criteria (2.5) (Metropolis Algorithm)
Average Properties
End
II. Implementation of MMC in NVT Ensemble
◼ RANDU Algorithm
1960’s , IBM
x(ip) = ( 0.5*(1.-float(nx)) +
Y
0
y(ip) = ( 0.5*(1.-float(ny)) + -2
float((ip-1)/nx) )*by -3
-3 -2 -1 0 1 2 3
60 continue X
bx = rLx/float(nx) 3
by = rLy/float(ny) 2
do 60 ip= 1, np 1
x(ip) = ( 0.5*(1.-float(nx)) +
Y
y(ip) = ( 0.5*(1.-float(ny)) + -2
float((ip-1)/nx) +0.1*r2())*by -3
60 continue -3 -2 -1 0
X
1 2 3
II. Implementation of MMC in NVT Ensemble
Three-body interaction
Two-body interaction
DO 10 I = 1, N
Loop i = 1, N-1 DO 20 J = I+1, N
Loop j = i+1,N DX = X(I)-X(J)
Evaluate rij DY = Y(I)-Y(J)
Evaulate Uij RIJ2 = DX*DX + DY*DY
Accumulate Energy RIJ6 = RIJ2*RIJ2*RIJ2
End j Loop RIJ12 = RIJ6*RIJ6
UTOT = UTOT + 1/RIJ12 – 1/RIJ6
End j Loop 20 CONTINUE
10 CONTINUE
II. Implementation of MMC in NVT Ensemble
◼ Problems
Simulations are performed typically with a few hundred molecules
arranged in a cubic lattice → computational limitation
• Large fraction of the molecules can be expected in a surface rather
than in the bulk
Simulation require summation over almost infinite interactions
PBC (Periodic Boundary Condition) and MIC (Minimum Image
Convention) are used to avoid this problems
II. Implementation of MMC in NVT Ensemble
◼ Implementing PBC
Decision based : IF statement
Function based : rounding , truncation, modulus
Decision Function
BOXL2 = BOXL/2.0
IF(RX(I).GT.BOXL2) RX(I)=RX(I)-BOXL RX(I) = RX(I) – BOXL * AINT(RX(I)/BOXL)
IF(RX(I).LT.-BOXL2) RX(I) = RX(I) + BOXL
II. Implementation of MMC in NVT Ensemble
X full = X c + X lrc
Elrc = 2pN r 2u (r )dr
rc
For NVT ensemble No. of particle and density (V) are const.
• LRC can be added after simulation
For other ensembles, LRC must be added during the simulation
II. Implementation of MMC in NVT Ensemble
◼ Average of a property
A =
exp − U (r N )
A(r N )dr N = N (r N ) A(r N )dr N = A
N trials ,N ( r N )
Z N (r )
◼ Metropolis Recipe
with probability pmn a trial state j for the move
if n > m accept n as new state
Otherwise, accept n as the new state with probability n > m
• Generate a random number R on (0,1) and accept if R < n /m
If not accepting n as new state, take the present state as the next
one in Markov chain (pmn ≠ 0)
II-6. Implementation
Start
End
II. Implementation of MMC in NVT Ensemble
II-6. Implementation
◼ Equilibration period
The averages are evaluated after “equilibration period”
The equilibration period must be tested : cycle vs. properties
• Ex) 20 000 run :
– 1 to 10 000 : equilibration period
– 10 001 to 20 000 : averages are accumulated
◼ Error estimation
Error estimation based on different simulation runs (with different
initial configurations)
Error estimation dividing total simulation runs into several blocks
→common method
II. Implementation of MMC in NVT Ensemble
( A )
nb
1
= − A
2
b run
Nb b =1
III. Implementation of MMC in other Ensembles
III-1. Introduction
III-1. Introduction
III-1. Introduction
exp − U (r N ) A(i) exp(E (i))
A = A( r N
) dr N
= i
N
Z N (r ) exp(E (i))
i
◼ Weighted average
W (i) = exp(− E (i))
1
A =
N i
A(i)
◼ Thermodynamic properties
exp(− pV )dV A(r N ,V ) exp − U (r N ) dr N
A = 0 V
0
exp(− pV )dV exp − U (r N ) dr N
V
◼ V can change
Particles are confined in fluctuating length L
Scaled coordinate :
αi = ri / L
exp(− pV )dV A((L ) N ,V ) exp − U ((L ) N ,V ) d N
A = 0
0
exp(− pV )dV exp − U ((L ) N ,V ) d N
III. Implementation of MMC in other Ensembles
Y = pV + E((L ) N , L) − NkT ln V
◼ Simple modification of NVT ensemble →Use DY instead of DU
◼ Volume fluctuation
NVT ensemble
• Move 1 molecule at a time
• Calculate energies of remaining N-1 molecules
NPT ensemble
• Change in V affects the coordinates of all atoms
• N*N calculations are required
• Effective strategy : “Scaling Method”
E = E (12) + E (6)
12 6
E = 4 ij −4 ij
L L L
12
L
6
ij ij Etrial = E (12) trial + E (6) trial
L L
III. Implementation of MMC in other Ensembles
◼ Property average
−3 N
n −0 N !
exp(Nm ) A(r N ) exp − U (r N ) dr N
V
A =
Z mVT
exp( N m *
− ln N ! ) A
V
( r N
) exp − U ( r N
) dr N
A = n −0
Z mVT
m * = m ex + kT ln N
III. Implementation of MMC in other Ensembles
Y = −Nm * + kT ln N!+E(r N )