Canonical Ensemble: 4.1. Averages and The Partition Function
Canonical Ensemble: 4.1. Averages and The Partition Function
Canonical ensemble
In this chapter we will formulate statistical physics for subsystems
that are held at constant temperature. In the next chapter we will
work at constant temperature and constant chemical potential. The
calculations are dierent from those we have done so far, and often
far simpler. For systems at fixed temperature there are very useful
numerical techniques, Monte Carlo methods, that we will explain.
We can find the probability distribution for that variable (the distri-
bution for p1 in this case) by considering it as a marginal distribution.
We will use the relation from probability theory that if P (AB) is the
probability of A and B, then:
P (A) = P (AB).
B
Here, {q, p} denotes all the other variables. Then, in the same way as
in Eq. (4.4) we have:
2
2
dQ CQ2 eCQ dq dp eH
CQ =
dQeCQ2 dq dp eH
2
dQ CQ2 eCQ
=
dQeCQ2
2
= ln[ dQeCQ ]
kB T
= . (4.5)
2
This theorem quickly gives many results. For example, the average
internal energy of the ideal gas is:
N
E= p2i /2m = 3N kB T /2.
1
applies as well. The reason is this: in the Einstein model each atom
is thought to vibrate independently. In fact, all of them are coupled
so that the real excitations are waves of vibration, e.g. sound waves.
The Hamiltonian is quadratic in the amplitude and momentum of the
waves, and we have as many dierent waves as we have degrees of
freedom. How this works out the normal mode transformation will
be treated in Chapter 6.
lim CV = 0,
T 0
Z = eF ; F = kB T ln Z. (4.8)
1
F = E Tr S = (Ei + kB Tr ln P (Ei ))eEi
Z i
1
= (Ei kB Tr [Ei + ln Z])eEi
Z i
= kB Tr ln Z. (4.9)
It is interesting to derive Eq. (4.8) another way. Note that for a large
system we can expect that the energy levels will be close together (or,
in a classical system, the energy is continuous). We can convert the
sum in Z into an integral by introducing the many-particle density of
states, i.e. the number of states per energy interval:
(E) = (E Ei ). (4.10)
i
Clearly:
i
Z= e = dE (E)eE . (4.11)
i
Thus:
S = kB ln() (4.13)
Now we use this result to deal with the integral in Eq. (4.11).
(ETr S(E))
Z = dEe / = dEeF (E) /. (4.14)
on E; the width is E = 2kB T 2 CV . The gaussian is very narrow:
E/E = O(N 1/2 ) 1010 for a macroscopic system. This shows
that the canonical ensemble will give the same results as the micro-
canonical: the energy fluctuations are very small.
4.4.1. Recipe
Here are the steps to do a calculation:
1. For a quantum system calculate:
Z(T, X, N ) = eEi .
i
2. Calculate F (T, X, N ) = kB T ln Z.
3. Calculate S = (F/T )X,N , f = (F/X)T,N . For example,
for a fluid:
S = (F/T )V,N , p = (F/V )T,N .
These are the equations of state.
4. To average any quantity of interest, R(q, p) in a classical system
compute:
3N
d q d3N p eH(q,p) R(q, p)
R = .
d3N q d3N p eH(q,p)
In a quantum system,
for any operator, R we need its diagonal
matrix elements, i|R|i . Then the average is:
i i| R|i eEi
R = E .
ie
i
101 CHAPTER 4. CANONICAL ENSEMBLE
1 eH(r,p)
c (q, p) = . (4.17)
N !h3N Z
The density matrix is:
eEj
j,k
c = j,k . (4.18)
Z
e H
= (4.19)
Tr(e H )
Averages are, as usual:
R = Tr(R). (4.20)
4.5. Examples
With the recipe we can do a large number of very interesting compu-
tations. Here are a few examples.
{i =1}
= eh1 eh2 . . .
1 =1 2 =1
h N
= eh + e . (4.21)
F = N kB T ln(eh + eh ). (4.22)
4.5. EXAMPLES 102
as in Eq. (3.7).
For small field we have:
M N
M N h; N = = . (4.24)
h kB T
This is the Curie law. In more conventional units the Curie law reads
(for spin-1/2 particles):
N 2
M H. (4.25)
kB T
Here M is the magnetic moment, and the magnetic moment per
particle.
Rotations
To give a scale for the energies here we define the rotational tempera-
ture, TR , by kB TR = 2 /2I. For O2 TR = 2.1K, N2 , 2.9K, well below
the boiling point of these gases and very far below room temperature.
The largest TR s are for H2 , 85.4K, and HD (D stands for Deuterium),
64K.
4.5. EXAMPLES 104
Now the free energy is Frot = N kB T ln(2kB T I/2 ), and the heat
capacity is:
Cvrot = T ( 2 Frot /T 2 ) = N kB ,
as above.
For T < TR we have a dierent situation. As a practical matter
this only applies to HD. Now the sum in Eq. (4.31) is dominated by
the first few terms, Z 1 + 3e2TR /T , and the heat capacity vanishes
exponentially.
For a homo-nuclear molecule all this isnt quite right because of
symmetry requirements. There results an interesting behavior for the
heat capacity of H2 for low temperatures, an eect first explained by
D. Dennison; see Problem 7.
Vibrations:
Virial expansion
all the possible pairs that could be close, and take e(rj,k ) = 1 for
all the rest. Thus:
1 N (N 1)
3N
d r(e 1) dr1 dr2 (e(r1,2 ) 1)
VN 2V 2
N2
ds(e(s) 1). (4.40)
2V
In the last line we have gone to the center of mass frame of the two
atoms.
Now we can expand the logarithm, assuming the correction is small:
N2
F = Ftrans kB T ds(e(s) 1) (4.41)
2V
To get the pressure we dierentiate:
F N kB T N 2 kB T
p= = + ds(1 e(s) ) (4.42)
V T V 2V 2
Comparing to Eq. (4.37) gives:
1
B2 = ds(1 e(s) ). (4.43)
2
However, this is likely to give very bad estimates. For example, at low
T most of the states we pick will have very small Boltzmann factors
and will be essentially discarded from the sum.
The trick which Metropolis et al. devised is to use a set {} which
prefers more important states. As a result, the method is called im-
portance sampling. We will see, in a moment, how to generate the s.
109 CHAPTER 4. CANONICAL ENSEMBLE
Now the P ()s are at our disposal. The best choice is to make every
term in the sum equally important: presumably it will take computer
resources to generate a term in the sum, so we want to use all of them.
A nice choice will be: P () eE . In this case we have, for a
sample of size N :
R()
R = . (4.48)
N
Our sample is the simple numerical average over the sequence of s.
This is not the only choice for P which has proven useful. We may
want to emphasize regions of the state space where R has values we
are interested in. Methods like this are called umbrella sampling: see
Chandler (1987). We will only discuss the simplest method.
We need to pick the set {}. This sounds hard since the important
states might be a very small fraction of all the possibilities. However,
we know that the problem of finding the high probability regions of
the state space cannot be too hard, since real dynamics does go to
equilibrium in the real world. The strategy is to impose a simplified
dynamics on the system. That is, {} will be generated as a sequence
of states arising from a fictitious dynamics. The equilibrium attained
will be real; the way we get there need not be.
We will choose the as states of a Markov chain. A Markov chain
is a sequence that is generated by picking states one after another at
discrete time steps according to prescribed time-independent transi-
tion probabilities, W. If we are in at step t the probability of being
in state at t + 1 is W( ). (We will usually abbreviate this to
W(, ).) Since we pick new states according to a probability, if we
rerun the process we will, in general, get a dierent sequence. These
dierent sequences are called sample paths.
4.6. SIMULATIONS IN THE CANONICAL ENSEMBLE 110
It is quite possible for the state to stay the same at a step: that
is W(, ) = 0. We do not require that the matrix of the W be
symmetric. Note that the transition probabilities at a given step do
not depend on how the path got to state . Markov processes have no
memory.
Master equation
Approach to equilibrium
Our first goal must be to find out under what conditions the process
we invent actually does go to equilibrium. This discussion is a bit
technical.
111 CHAPTER 4. CANONICAL ENSEMBLE
In the last line we summed over and used Eq. (4.49). Thus || 1.
Thus equilibrium exists, the remaining question is whether it is
unique, and whether we approach it properly. Ergodicity guarantees
uniqueness. However, in the general case there is the possibility of
limit cycles, namely states where we cycle through some set:
1 2 . . . k 1 . (4.54)
Detailed balance
Let us return to the master equation, Eq. (4.51), and note that for Pe
we must have:
W(, )Pe (, t) = W(, )Pe (, t)
Since the eigenvalues obey |i | < 1 the sum becomes negligible for large
n, and we must have c1 = 1, P(t + n) Pe . If we write i = ei we
identify the s as relaxation rates.
113 CHAPTER 4. CANONICAL ENSEMBLE
There are many algorithms that satisfy this equation. The most
popular and most ecient (see Newman & Barkema (1999)) is that of
Metropolis et al. (1953). It involves several steps.
1. Start in state n, and try a move to state m.
2. Compute = Em En .
3. If 0 accept the move, i.e. put the system in state m.
4. If > 0 accept the move with probability e . That is, choose
a random number u [0, 1] and if u < e move to state m,
otherwise do nothing.
This does satisfy Eq. (4.59) because if > 0, Em > En the probability
of moving n m is e(Em En ) and the probability of moving m n
is 1.
Figure 4.2.: Monte Carlo results for a two level system: n as a function
of T . The solid line is the exact result.
n=1
nsum=0.
w=exp(-1./T)
for j in arange(maxsteps):
if n==1: nn=0
if n==0:
u=random()
if u <= w:
nn=1
else:
nn=0
n=nn
nsum=nsum+n
nave=nsum/maxsteps
move, in this case, simply pick another place for one of the atoms,
e.g. at random. Then compute and proceed as above. It is wise to
monitor the energy to guess if the system has approached equilibrium,
and then start to average. To get the pressure use the virial equation,
Eq. (2.11). A program that does this is in Appendix B. We will use
this method in Chapter 8.
For the Ising model the procedure is still simpler. Start with an
arbitrary arrangement of spins. Pick a spin at random, and flip it
according to the Metropolis scheme. After relaxation has occurred
monitor the energy and magnetic moment. From problem 2, below,
compute the heat capacity and magnetic susceptibility. This is the
subject of problem 5.
Suggested reading
The canonical ensemble is treated in all the general references, e.g.:
Huang (1987)
The rotational and vibrational heat capacities and the low temperature
behavior of H2 see:
Pathria & Beale (2011)
Landau & Lifshitz (1980)
For the Mayer expansion the original source is
Mayer & Mayer (1940)
The modern treatment in
Pathria & Beale (2011)
is particularly detailed. For a quick treatment of B2 alone, see
Landau & Lifshitz (1980)
Monte Carlo methods are in:
Newman & Barkema (1999)
Gould et al. (2006)
Chandler (1987)
Gould & Tobochnik (2010)
For Markov chains see:
Sethna (2006)
Van Kampen (2007)
PROBLEMS 116
Problems
1. Consider a tall cylinder with a classical ideal gas of N parti-
cles inside. Because of gravity, the gas is denser at the bottom.
Figure out the partition function, the free energy, and the heat
capacity.
2. Derive the formula for the vibrational heat capacity, Eq. (4.34).
Plot it as a function of T /Tv . It should resemble Figure 4.1.
3. a). Prove that V ar(E) = kB T 2 C, where C is the heat capacity.
b.) Prove for the Ising system that the magnetic susceptibility,
(1/N )M/h|T is given by:
1
N = V ar(M ).
kB T
c.) Show that for the zero-field susceptibility for the Ising model
in the disordered phase you can write:
1
= j 0 0 .
kB T j
p1 p2
Figure 4.3.: The Joule-Thomson eect. Gas is forced through a porous plug
(center); p1 > p2 . The flow is slow enough that both sides of
the system can be considered to be in equilibrium.
Also prove that, for small density, from the virial expansion
V N kBT /p + N B2 .
c.) Show that for B2 = b a/kB T , Eq. (4.44), the gas cools at
low T and heats for high T .
5. a.) Write Metropolis Monte Carlo code for the 1d Ising model,
and verify the result in Eq. (4.23).
b.) Write a 2d code and use the result of Problem (4.3)a to find
the heat capacity as a function of T . Be sure you go through the
phase transition.
6. Use detailed balance to prove that V is symmetric and that
Eq. (4.56) is correct.
7. An interesting application of quantum statistics is to the rota-
tional states of H2 gas (see Landau & Lifshitz (1980)).
a.) The two nuclei protons in this case are identical and have
spin 1/2. Quantum mechanics says that if the total nuclear spin
is 1 (othohydrogen) then only odd J are allowed in the rotations,
and for spin 0 (parahydrogen) then only even J are allowed.
Explain this from quantum theory.
b.) Show that the equilibrium ratio of othro (o) to para (p) is: