Monte Carlo Methods Ensembles (Chapter 5) Biased Sampling (Chapter 14) Practical Aspects
Lecture 1 2
Lecture 1&2 3
Lecture 1&3 4
Different Ensembles Ensemble ame Constant (Imposed) VT Canonical,V,T P PT Isobaric-isothermal,P,T V µvt Grand-canonical µ,v,t Fluctuating (Measured) 5
VT Liquids Equation of State of Liquid Carbon Imposed 6
if force PT is difficult to calculate e.g. carbon force field Liquids Equation of State of Liquid Carbon Imposed 7
PT on-isotropic Systems e.g. Solids Structure and Transformation of Carbon anotube Arrays 8
µvt Adsorption Adsorption in Carbon anostructues Schwegler et al. 9
Partition function Q VT Statistical Thermodynamics 1 = Λ! dr exp β 3 Ensemble average 1 1 A = VT Q Λ! VT [ U( r )] ( ) [ ( )] r exp U r dr A β 3 Probability to find a particular configuration ( ) 1 1 r dr' ( r' r ) exp ( r' ) exp ( = δ βu βu r ) 3 Q Λ! VT Lecture 2 Free energy βf = ln ( ) Q VT 10
Ensemble average Lecture 2 A VT 1 = Q Λ VT = dr = dr 1 dr A( r ) exp[ βu ( r )] 3! ( ) ( dr A( r ) P( r ) r P r ) = dr P( r ) ( r ) C exp[ U ( r )] dr A = C exp[ βu ( r )] dr A A dr Generate configuration using MC: {,r,r,r,r } P MC ( ) [ ( )] MC r = C exp βu r β ( r ) exp[ βu ( r )] exp[ βu ( r )] M 1 r1 2 3 4! A = A( ri ) M M i= 1 Weighted Distribution with = = = dr dr dr A dr MC ( r ) P ( r ) MC P ( r ) A dr A dr MC ( r ) C exp[ βu ( r )] MC C exp[ βu ( r )] ( r ) exp[ βu ( r )] exp[ βu ( r )]
Monte Carlo: Detailed balance Lecture 2 o n Ko ( n) = Kn ( o) Ko ( n) = o ( ) α( o n) acc( o n) Kn ( o) = n ( ) α( n o) acc( n o) acc(o n) acc(n o) (n) α(n o) = (o) α(o n) = (n) (o)
Lecture 2 VT-ensemble n () exp acc( o n) ( n) = acc( n o) ( o) ( ) βu n acc( o n) acc( n o) = exp β U n ( ) U( o) 13
PT ensemble We control the Temperature (T) Pressure (P) umber of particles () 14
Scaled coordinates Intermezzo Partition function Q VT 1 = Λ! Scaled coordinates dr exp β 3 si = ri / L [ U( r )] This gives for the partition function 3 L QVT = ds exp βu 3 Λ! s ; L V = ds exp βu 3 Λ! s ; ( ) ( L) The energy depends on the real coordinates 15
The PT ensemble Here they are an ideal gas V 0 : total volume M : total number of particles in volume V Here they interact M- in volume V 0 -V V 0 is fixed V varies from 0 to V 0 What is the statistical thermodynamics of this ensemble?
The PT ensemble: Fixed V partition function V QVT = ds exp βu s ; L 3 Λ! Q MV0,V,T = Q MV0,V,T = ( V 0 V ) M 3(M ) Λ M ( )! ( V 0 V ) M 3(M ) Λ M ( )! ( )! " ( ) ds M exp βu 0 s M ; L V Λ 3! ds ds V # $ Λ 3! exp! " βu s ; L exp$ % βu s ; L ( ) ( ) & ' 17 # $
Q MV0,V,T = ( V 0 V ) M 3(M ) Λ M ( )! V Λ 3! ds exp$ % βu s ; L ( ) To get the Partition Function of this system, we have to integrate over all possible volumes: ( ) M Q = dv V 0 V V MV0,,T 3(M ) Λ ( M )! Λ 3! ow let us take the following limits: ds & ' exp$ % βu s ; L ( ) M M ρ = constant V0 V As the particles are an ideal gas in the big reservoir we have: & ' ρ = βp 18
( ) M Q = dv V 0 V V MV0,,T 3(M ) Λ ( M )! Λ 3! We have ds exp$ % βu s ; L ( ) & ' M M V V = V 1 V V V exp M V V ( ) M ( ) M ( ) 0 0 0 0 0 M M M 0 0 0 ( V V) V exp[ ρv] = V exp[ βpv] This gives: To make the partition function dimensionless (see Frenkel/Smit for more info) β P QPT = dvexp PV V ds exp U s ; L 3! Λ [ ] ( β β ) 19
Partition function: PT Ensemble β P QPT = dvexp PV V ds exp U s ; L 3! Λ [ ] ( β β ) Probability to find a particular configuration: (, s ) exp[ β ] exp β ( s ; ) PT V V PV U L Sample a particular configuration: change of volume change of reduced coordinates Acceptance rules?? Detailed balance 20
Detailed balance o n Ko ( n) = Kn ( o) Ko ( n) = o ( ) α( o n) acc( o n) Kn ( o) = n ( ) α( n o) acc( n o) acc( o n) ( n) α( n o) ( n) = = acc( n o) ( o) α( o n) ( o) 21
acc( o n) ( n) = acc( n o) ( o) PT-ensemble (, s ) exp[ ] exp ( s ; ) PT V V βpv βu L Suppose we change the position of a randomly selected particle acc( o n) V exp PV exp U s ; L = acc( n o) [ ] ( V exp βpv exp βu s ) o ; L ( exp βu s ) n ; L = = exp β U n U o ( exp βu s ) o ; L 22 [ ] ( β β ) n { ( ) ( ) }
acc( o n) ( n) = acc( n o) ( o) PT-ensemble (, s ) exp[ ] exp ( s ; ) PT V V βpv βu L Suppose we change the volume of the system acc( o n) Vn exp PVn exp U s ; L n = acc( n o) [ ] ( V exp exp s ; ) o βpv o βu L o [ ] ( β β ) V n = exp βpv ( ) exp ( ) ( 0) n Vo U n U V o 23 { β }
Algorithm: PT Randomly change the position of a particle Randomly change the volume 24
25
26
27
PT simulations Equation of State of Lennard Jones System 28
Measured and Imposed Pressure Imposed pressure P Measured pressure <P> from virial P = < F dvv e βpv ds e βu (s ) # F % # & $ V % ( >,T = $ V ' dvv e βpv ds e βu (s ) exp*+ β ( F(V )+ PV ), - p(v ) = Q PT = βp Q PT dv exp*+ β ( F(V )+ PV ), - & ( ',T 29
# P = < F & % ( >,T = $ V ' P = P = βp Q(PT ) βp Q(PT ) # dv F & % ( $ V ' dv dvv e βpv ds e βu (s ) # F % $ V dvv e βpv ds e βu (s ),T exp[ βpv ] β exp* + β F V ( ) + PV ( ) exp*+ βf V, - V ( ), - & ( ',T 30
Measured and Imposed Pressure Partial integration For V=0 and V= b a fdg = [ ] b fg a exp" # β F V b a gdf ( ( ) + PV ) $ % = 0 Therefore, P = P = βp Q(PT ) βp Q(PT ) = dv exp[ βpv ] β dvp exp! " β F V ( ) exp!" βf V # $ V ( ( ) + PV ) # $ = P 31
Grand-canonical ensemble What are the equilibrium conditions? 32
Grand-canonical ensemble We impose: Temperature (T) Chemical potential (µ) Volume (V) But OT pressure 33
The ensemble of the total system Here they are an ideal gas Here they interact What is the statistical thermodynamics of this ensemble? 34
The ensemble: partition function V QVT = ds exp βu s ; L 3 Λ! Q MV0,V,T = ( V 0 V ) M 3(M ) Λ M ( )! ( ) M V0 V V MV V T M ( ) ( )! " ( ) ds M V exp βu 0 s M ; L ds V # $ Λ 3! exp! " βu s ; L ( ) Q 0,, = ds exp βu s ; L 3 3 Λ M! Λ! ( ) 35 # $
Q = ( V 0 V ) M V MV0 ds exp$ βu ( s ; L) &,V,T 3(M ) Λ ( M )! Λ 3! % ' To get the Partition Function of this system, we have to sum over all possible number of particles Q = ( V 0 V ) =M M V MV0 ds exp$ βu ( s ; L) &,,T 3(M ) Λ ( M )! Λ 3! % ' =0 ow let us take the following limits: M M ρ = constant V0 V As the particles are an ideal gas in the big reservoir we have: ( 3 ) µ = ktln Λ ρ B = exp( ) βµ V Qµ VT = ds exp βu s ; L 3 Λ! = 0 ( ) 36
Partition function: µvt Ensemble = ( ) exp βµ V Qµ VT = ds exp βu s ; L 3 = 0 Λ! Probability to find a particular configuration: ( ) ( ) ( exp βµ V, ) µ VT V s exp βu s ; L 3 Λ! Sample a particular configuration: Change of the number of particles Change of reduced coordinates Acceptance rules?? Detailed balance ( ) 37
Detailed balance o n Ko ( n) = Kn ( o) Ko ( n) = o ( ) α( o n) acc( o n) Kn ( o) = n ( ) α( n o) acc( n o) acc( o n) ( n) α( n o) ( n) = = acc( n o) ( o) α( o n) ( o) 38
acc( o n) ( n) = acc( n o) ( o) µvt-ensemble ( ) ( exp βµ V, ) µ VT V s exp βu s ; L 3 Λ! Suppose we change the position of a randomly selected particle exp ( ) acc( o n) 3 Λ! acc( n o) = exp βµ V βµ V ( ) Λ 3! ( ) n L exp βu s ; ( ) o L exp βu s ; { β U( n) U( ) } = exp 0 ( ) 39
acc( o n) ( n) = acc( n o) ( o) µvt-ensemble ( ) ( exp βµ V, ) µ VT V s exp βu s ; L 3 Λ! Suppose we change the number of particles of the system ( βµ ( + )) 3 + 3 Λ ( + ) exp( βµ ) V ( ) + 1 exp 1 V exp βu s ; acc( o n) 1! = acc( n o) ( exp βu s ; L ) 3 o Λ! exp( βµ ) V = exp[ βδu ] 3 Λ + 1 ( ) ( +1 L ) n 40
41
42
Application: equation of state of Lennard-Jones 43
Application: adsorption in zeolites 44
Summary Ensemble Constant (Imposed) Fluctuating (Measured) Function VT,V,T P βf=-lnq(,v,t) PT,P,T V βg=-lnq(,p,t) µvt µ,v,t βω=-lnq(µ,v,t)=-βpv 45
Practical Points Boundaries CPU saving methods Reduced units Long ranged forces
Boundary effects In small systems, boundary effects are always large. 1000 atoms in a simple cubic crystal 488 boundary atoms. 1000000 atoms in a simple cubic crystal still 6% boundary atoms.
Periodic boundary conditions
ener(x,en) energies)
Energy evaluation costs! The most time-consuming part of any simulation is the evaluation of all the interactions between the molecules. In general: (-1)/2 = O( 2 ) But often, intermolecular forces have a short range: Therefore, we do not have to consider interactions with far- away atoms.
Saving CPU Cell list Verlet List Han sur Lesse
Application: Lennard Jones u LJ u r *# σ & ( r) = 4ε $ % r ' ( +, " # $ ( ) = u LJ potential The Lennard-Jones potential 12 # σ $ % r ( r) r r c 0 r > r c 6 & ' ( The truncated Lennard-Jones potential The truncated and shifted Lennard-Jones potential -./ ( ) = u LJ u r # $ % ( r) u LJ ( r ) c r r c 0 r > r c
ener(x,en) energies)
Phase diagrams of Lennard Jones fluids
Long ranged interactions Long-ranged forces require special techniques. Coulomb interaction (1/r in 3D) Dipolar interaction (1/r 3 in 3D)...and, in a different context: Interactions through elastic stresses (1/r in 3D) Hydrodynamic interactions (1/r in 3D)
Reduced units Example: Particles with mass m and pair potential: Unit of length: Unit of energy: σ ε Unit of time:
Beyond standard MC on Boltzmann Sampling Lecture 2 Parallel tempering More to Come Tomorrow (Daan Frenkel)
Parallel tempering/replica Exchange Ergodicity problems can occur, especially in glassy systems: biomolecules, molecular glasses, gels, etc. The solution: go to high temperature High barriers in energy landscape: difficult to sample E low T Barriers effectively low: easy to sample E phase space high T phase space
Parallel tempering/replica Exchange Simulate two systems simultaneously system 1 system 2 temperature T 1 temperature T 2 e 1U 1 (r ) e 2U 2 (r ) total Boltzmann weight: e 1U 1 (r ) e 2U 2 (r )
Swap move Allow two systems to swap system 2 system 1 temperature T 1 temperature T 2 e 1U 2 (r ) e 2U 1 (r ) total Boltzmann weight: e 1U 2 (r ) e 2U 1 (r )
Acceptance rule The ratio of the new Boltzmann factor over the old one is (n) (o) = e( 2 1)[U 2 (r ) U 2 1(r )] The swap acceptance ratio is acc(1 2) = min 1,e ( 2 1)[U 2 (r ) U 1 (r )]
More replicas Consider M replica s in the VT ensemble at a different temperature. A swap between two systems of different temperatures (T i,t j ) is accepted if their potential energies are near. other parameters can be used: Hamiltonian exchange
Questions Lunch 63