Introduction to (Statistical) Thermodynamics
2
Molecular Simulations
Molecular dynamics: solve equations of motion
Monte Carlo: importance sampling
r1
MD
MC
r2rn
r1
r2
rn
3
4
5
Questions
• How can we prove that this scheme generates the desired distribution of configurations?
• Why make a random selection of the particle to be displaced?
• Why do we need to take the old configuration again?
• How large should we take: delx?
What is the desired distribution?
6
SummaryThermodynamics
– First law: conservation of energy– Second law: in a closed system entropy increase
and takes its maximum value at equilibrium
System at constant temperature and volume– Helmholtz free energy decrease and takes its
minimum value at equilibrium
Equilibrium:– Equal temperature, pressure, and chemical
potential
7
Entropy
Closed system:•1st law: total energy remains constant•2nd law: entropy increases
dE =TdS-pdV + μidNii=1
M
∑
T =∂E∂S
⎛⎝⎜
⎞⎠⎟V ,Ni
Temperature
E,V
dS ≥0
E =E(S,V,Ni )
or1
T=
∂S∂E
⎛⎝⎜
⎞⎠⎟V ,Ni
8
Helmholtz free energy
F ≡E −TS dE =TdS-pdV + μidNii=1
n
∑dF =−SdT−pdV + μidNi
i=1
n
∑
Pressure: p=-∂F∂V
⎛⎝⎜
⎞⎠⎟T ,Ni
Energy: E =∂F T∂1 T
⎛
⎝⎜⎞
⎠⎟V ,Ni
F =F T,V,Ni( ) dF ≤0
Chemical potential: μi =∂F
∂Ni
⎛
⎝⎜⎞
⎠⎟T ,V ,N j
9
Statistical Thermodynamics
System of N molecules: r1K r
N,v
1K v
N
But how do we obtain themacroscopic properties of this system from this microscopic information?
10
Outline (2)Statistical Thermodynamics
– Basic Assumption• micro-canonical ensemble• relation to thermodynamics
– Canonical ensemble• free energy• thermodynamic properties
– Other ensembles• constant pressure• grand-canonical ensemble
11
Statistical Thermodynamics:the basics
• Nature is quantum-mechanical• Consequence:
– Systems have discrete quantum states.– For finite “closed” systems, the number of states is
finite (but usually very large)
• Hypothesis: In a closed system, every state is equally likely to be observed.
• Consequence: ALL of equilibrium Statistical Mechanics and Thermodynamics
12
Basic assumptionEach individual
microstate is equally probable
…, but there are not many microstates that
give these extreme results
If the number of particles is large (>10)
these functions are sharply peaked
13
Does the basis assumption lead to something that is consistent with classical
thermodynamics?
1ESystems 1 and 2 are weakly coupled such that they can exchange energy.
What will be E1?
( ) ( ) ( )1 1 1 1 2 1,E E E E E EΩ − = Ω ×Ω −
BA: each configuration is equally probable; but the number of states that give an energy E1 is not know.
2 1E E E= −
14
( ) ( ) ( )1 1 1 1 2 1,E E E E E EΩ − = Ω ×Ω −
( ) ( ) ( )1 1 1 1 2 1ln , ln lnE E E E E EΩ − = Ω + Ω −
( )1 1
1 1
1 ,
ln ,0
N V
E E E
E
⎛ ⎞∂ Ω −=⎜ ⎟
∂⎝ ⎠
∂lnΩ1 E1( )∂E1
⎛
⎝⎜
⎞
⎠⎟
N1 ,V1
+∂lnΩ2 E −E1( )
∂E1
⎛
⎝⎜
⎞
⎠⎟
N2 ,V2
=0
( ) ( )1 1 2 2
1 1 2 1
1 2, ,
ln ln
N V N V
E E E
E E
⎛ ⎞ ⎛ ⎞∂ Ω ∂ Ω −=⎜ ⎟ ⎜ ⎟
∂ ∂⎝ ⎠ ⎝ ⎠
Energy is conserved!dE1=-dE2
This can be seen as an equilibrium
condition
( ),
ln
N V
E
Eβ
⎛ ⎞∂ Ω≡ ⎜ ⎟
∂⎝ ⎠
1 2β β=
15
Conjecture:
Almost right.
•Good features:
•Extensivity
•Third law of thermodynamics comes for free•Bad feature:
•It assumes that entropy is dimensionless but (for unfortunate, historical reasons, it is not…)
Entropy and number of configurations
lnS = Ω
16
We have to live with the past, therefore
With kB= 1.380662 10-23 J/K
In thermodynamics, the absolute (Kelvin) temperature scale was defined such that
But we found (defined):
( )lnBS k E= Ω
,
1
N V
S
E T
∂⎛ ⎞ =⎜ ⎟∂⎝ ⎠
( ),
ln
N V
E
Eβ
⎛ ⎞∂ Ω≡ ⎜ ⎟
∂⎝ ⎠
dE =TdS-pdV + μidNii=1
n
∑
17
And this gives the “statistical” definition of temperature:
In short:
Entropy and temperature are both related to the fact that we can COUNT states.
( ),
ln1B
N V
Ek
T E
⎛ ⎞∂ Ω≡ ⎜ ⎟
∂⎝ ⎠
Basic assumption:1. leads to an equilibrium condition: equal temperatures2. leads to a maximum of entropy3. leads to the third law of thermodynamics
18
How large is Ω?
•For macroscopic systems, super-astronomically large.
•For instance, for a glass of water at room temperature:
•Macroscopic deviations from the second law of thermodynamics are not forbidden, but they are extremely unlikely.
Number of configurations
252 1010 ×Ω ≈
19
Canonical ensemble
Consider a small system that can exchange heat with a big reservoir
iE iE E− ( ) ( ) lnln lni iE E E E
E
∂ ΩΩ − = Ω − +
∂L
( )( )
ln i i
B
E E E
E k T
Ω −= −
Ω
1/kBT
Hence, the probability to find Ei:
( ) ( )( )
( )( )
exp
expi i B
i
j j Bj j
E E E k TP E
E E E k T
Ω − −= =
Ω − −∑ ∑( ) ( )expi i BP E E k T∝ −
Boltzmann distribution
20
Thermodynamics
What is the average energy of the system?
( ) ( )( )
exp
exp
i iii ii
jj
E EE E P E
E
β
β
−≡ =
−
∑∑∑
( )ln exp iiEβ
β
∂ −= −
∂∑
, ,ln N V TQ
β∂
=−∂Compare:
1
F TE
T
⎛ ⎞∂=⎜ ⎟∂⎝ ⎠
Hence: , ,ln N V T
B
FQ
k T=−
Thermo recall (2)
d d dE T S p V= −
First law of thermodynamics
Helmholtz Free energy:
1
1 1
F T F FF F T
T T T T
⎛ ⎞∂ ∂ ∂= + = −⎜ ⎟∂ ∂ ∂⎝ ⎠
F E TS≡ −d d dF S T p V=− −
F TS E= + =
21
Remarks (1)We have assume quantum mechanics (discrete states) butwe are interested in the classical limit
( ) ( )2
3
1exp d d exp
! 2N N Ni
ii ii
pE U r
h N mβ β
⎧ ⎫⎡ ⎤⎪ ⎪− → − +⎨ ⎬⎢ ⎥
⎪ ⎪⎣ ⎦⎩ ⎭∑ ∑∫∫ p r
3
1
h→ Volume of phase space (particle in a box)
1
!N→ Particles are indistinguishable
332 2 22
d exp dp exp2 2
N N
N ii
i
p p m
m m
πβ ββ
⎧ ⎫ ⎡ ⎤⎡ ⎤ ⎧ ⎫ ⎛ ⎞⎪ ⎪− = − =⎨ ⎬ ⎨ ⎬⎢ ⎥⎢ ⎥ ⎜ ⎟⎪ ⎪ ⎝ ⎠⎩ ⎭⎣ ⎦ ⎣ ⎦⎩ ⎭
∑∫ ∫p
Integration over the momenta can be carried out for most systems:
22
Remarks (2)
Define de Broglie wave length:1
2 2
2
h
m
βπ
⎛ ⎞Λ ≡⎜ ⎟
⎝ ⎠
Partition function:
( ) ( )3
1, , d exp
!N N
NQ N V T U r
Nβ⎡ ⎤= −⎣ ⎦Λ ∫ r
23
Example: ideal gas( ) ( )3
1, , d exp
!N N
NQ N V T U r
Nβ⎡ ⎤= −⎣ ⎦Λ ∫ r
3 3
1d 1
! !
NN
N N
V
N N= =
Λ Λ∫ r
Free energy:
3
3 3
ln!
ln ln ln ln
N
N
VF
N
NN N N N
V
β
ρ
⎛ ⎞=− ⎜ ⎟Λ⎝ ⎠
⎛ ⎞≈ Λ + = Λ +⎜ ⎟⎝ ⎠Pressure:
T
F NP
V Vβ∂⎛ ⎞=− =⎜ ⎟∂⎝ ⎠
Energy:
3 3
2 B
F NE Nk T
ββ β
⎛ ⎞∂ ∂Λ= = =⎜ ⎟∂ Λ ∂⎝ ⎠
Thermo recall (3)
Helmholtz Free energy:
T
FP
V
∂⎛ ⎞ =−⎜ ⎟∂⎝ ⎠
d d dF S T p V=− −
1
F T FE
T
ββ
⎛ ⎞ ⎛ ⎞∂ ∂= =⎜ ⎟ ⎜ ⎟∂ ∂⎝ ⎠⎝ ⎠
Energy:
Pressure
24
Ideal gas (2)
Chemical potential: μi =∂F
∂Ni
⎛
⎝⎜⎞
⎠⎟T ,V ,N j
βF =NlnΛ3 + Nln
NV
⎛
⎝⎜⎞
⎠⎟
βμ =lnΛ3 + lnρ +1
βμIG =βμ0 + lnρ
25
Summary:Canonical ensemble (N,V,T)
Partition function:
Probability to find a particular configuration
Free energy
( ) ( )3
1, , d exp
!N N
NQ N V T U r
Nβ⎡ ⎤= −⎣ ⎦Λ ∫ r
( ) ( )expP Uβ⎡ ⎤Γ ∝ − Γ⎣ ⎦
, ,ln N V TF Qβ =−
26
Summary:micro-canonical ensemble (N,V,E)
Partition function:
Probability to find a particular configuration
Free energy
( ) 1P Γ ∝
, ,ln N V ES Qβ =
( ) ( )( )3
1, , d d ,
!N N N N
NQ N V E H E
h Nδ= −∫∫ p r p r
27
Thermodynamic properties
For many properties the momenta do not matter: only
the configurational part
Probability to find a configuration: { }1 2, , , NΓ = r r rK
( ) ( )expP Uβ⎡ ⎤Γ ∝ − Γ⎣ ⎦
Ensemble average:
( ) ( )1expA d A U
Qβ⎡ ⎤= Γ Γ − Γ⎣ ⎦∫
28
Other ensembles?In the thermodynamic limit the thermodynamic properties areindependent of the ensemble: so buy a bigger computer …
However, it is most of the times much better to think and to carefullyselect an appropriate ensemble.
For this it is important to know how to simulate in the variousensembles.
But for doing this wee need to know the Statistical Thermodynamicsof the various ensembles.
COURSE: MD and MC
different ensembles
29
Example (1): vapour-liquid equilibrium mixture
Measure the composition of the coexisting vapour and liquid phases if we start with a homogeneous liquid of two different compositions:– How to mimic this with the
N,V,T ensemble?– What is a better ensemble?
composition
T
L
V
L+V
30
Example (2):swelling of clays
Deep in the earth clay layers can swell upon adsorption of water:– How to mimic this in the N,V,T
ensemble?– What is a better ensemble to
use?
31
Ensembles
• Micro-canonical ensemble: E,V,N
• Canonical ensemble: T,V,N
• Constant pressure ensemble: T,P,N
• Grand-canonical ensemble: T,V,μ
32
Constant pressure simulations: N,P,T ensemble
Consider a small system that can exchange volume and energy with a big reservoir
( ) ( ),
ln lnln ln ,i i i i
V E
V V E E V E E VE V
∂ Ω ∂ Ω⎛ ⎞ ⎛ ⎞Ω − − = Ω − − +⎜ ⎟ ⎜ ⎟∂ ∂⎝ ⎠ ⎝ ⎠
L
( )( )
,ln
,i i i i
B B
E E V V E pV
E V k T k T
Ω − −= − −
Ω
1/kBT
Hence, the probability to find Ei,Vi:
( ) ( )( )
( )( )
( ), ,
exp,,
, exp
exp
i ii ii i
j k j kj k j k
i i
E pVE E V VP E V
E E V V E pV
E pV
β
β
β
⎡ ⎤− +Ω − − ⎣ ⎦= =⎡ ⎤Ω − − − +⎣ ⎦
⎡ ⎤∝ − +⎣ ⎦
∑ ∑
,i iV E ,i
i
E E
V V
−−
p/kBTThermo recall (4)
d d d + di iiE T S p V Nμ= − ∑
First law of thermodynamics
Hence
,T N
S p
V T
∂⎛ ⎞ =⎜ ⎟∂⎝ ⎠
,
1=
V N
S
T E
∂⎛ ⎞⎜ ⎟∂⎝ ⎠
and
33
N,P,T ensemble (2)
In the classical limit, the partition function becomes
( ) ( ) ( )3
1, , exp d exp
!N N
NQ N P T dV PV U r
Nβ β⎡ ⎤= − −⎣ ⎦Λ ∫ ∫ r
The probability to find a particular configuration: ,N Vr
( ) ( )( ), expN NP V PV U rβ⎡ ⎤∝ − +⎣ ⎦r
34
Grand-canonical simulations: μ,V,T ensemble
Consider a small system that can exchange particles and energy with a big reservoir
( ) ( ),
lnlnln ln ,i i i i
N E
N N E E N E E NE N
∂ Ω∂ Ω ⎛ ⎞⎛ ⎞Ω − − = Ω − − +⎜ ⎟ ⎜ ⎟∂ ∂⎝ ⎠ ⎝ ⎠
L
( )( )
,ln
,i i i i i
B B
E E N N E N
E N k T k T
μΩ − −= − +
Ω
1/kBT
Hence, the probability to find Ei,Ni:
( ) ( )( )
( )( )
( ), ,
exp,,
, exp
exp
i i ii ii i
j k j k kj k j k
i i i
E NE E N NP E N
E E N N E N
E N
β μ
β μ
β μ
⎡ ⎤− −Ω − − ⎣ ⎦= =⎡ ⎤Ω − − − −⎣ ⎦
⎡ ⎤∝ − −⎣ ⎦
∑ ∑
,i iN E ,i
i
E E
N N
−−
-μ/kBTThermo recall (5)
d d d + di iiE T S p V Nμ= − ∑
First law of thermodynamics
Hence
,
i
i T V
S
N T
μ⎛ ⎞∂=−⎜ ⎟∂⎝ ⎠
,
1=
V N
S
T E
∂⎛ ⎞⎜ ⎟∂⎝ ⎠
and
35
μ,V,T ensemble (2)
In the classical limit, the partition function becomes
( ) ( ) ( )31
exp, , d exp
!N N
NN
NQ V T U r
N
βμμ β
∞
=
⎡ ⎤= −⎣ ⎦Λ∑ ∫ r
The probability to find a particular configuration: , NN r
( ) ( ), expN NP N N U rβμ β⎡ ⎤∝ −⎣ ⎦r