Intro to Statistical Ensembles#

What you will learn

  • Statistical Ensembles: Understanding the role of ensembles in statistical mechanics and how they describe macroscopic systems using probability distributions.

  • Microcanonical Ensemble (NVE): Definition, characteristics, and assumptions—fixed energy, volume, and particle number; statistical weight of microstates.

  • Canonical Ensemble (NVT): Definition and significance—fixed temperature, volume, and particle number; derivation of the Boltzmann factor.

  • Equivalence of Ensembles: Conditions under which the microcanonical and canonical ensembles give equivalent thermodynamic predictions in the thermodynamic limit.

  • Partition Function (\(Z\)): Role of the partition function in statistical mechanics, its connection to thermodynamic properties (free energy, entropy, internal energy).

  • Boltzmann Distribution: Probability of a system being in a given energy state at equilibrium, leading to macroscopic observables.

  • Thermodynamic Connections: How ensemble averages link to macroscopic properties such as energy, entropy, and pressure.

  • Fluctuations and Large System Limits: How energy fluctuations in the canonical ensemble become negligible for large systems, reinforcing ensemble equivalence.

Microcanonical Ensemble (NVE)#

  • A collection of all possible microscopic arrangements consistend with an equilibrium thermodynamic state is called statistical ensemble.

  • Ensemble defines sample space over microstates over which we define micro and macro-state probabilities

  • Consider an isolated fluid system with \(N=const\), \(V=const\) and \(E=const\). This is called a microcanonical ensemble

  • In the absence of any physical constraints, no micro state is more probable than any other. This is known as “principle of equal a priory probability”.

../_images/940d937a24d3868dd2a911055ef3bfdca04c59451b03db77100a8430f50c3af3.png

A priori equal probability of microstates with energy \(E\)

\[p_i = \frac{1}{\Omega(N, V, E)}\]
  • \(i=1,2,3,...\) distinct configurations or microstates with energy \(E\)

  • We can use postulate of equal mircro-state probabilities and plug into probabilisti expression of entropy to obtain a simple relationship between number of microstates and entropy:

\[S = -k_B \sum_i p_i log p_i = -k_B \Omega \cdot \frac{1}{\Omega} log \frac{1}{\Omega}\]

Entropy in microcanonical ensemble (Boltzmann equation)

\[S = k_B log \Omega\]
  • \(\Omega\) is the number of micro-states consistent with a macrostate of our system.

  • \(S(N, V, E)\) is the entropy of an isolated system.

  • \(k_B =1.380649\cdot 10^{-23} J/K\), Boltzmann’s constant

Simple example of NVE ensemble

  • Consider a system of three spins where \(\uparrow\) and \(\downarrow\) have the same energy \(\epsilon\). We have microcanonical ensemble defined by \(N=3\) and \(E=3\epsilon\) thermodynamic variables.

\[\boxed{ \uparrow \uparrow \uparrow, \quad \uparrow \uparrow \downarrow, \quad \uparrow \downarrow \uparrow, \quad \downarrow \uparrow \uparrow, \quad \uparrow \downarrow \downarrow, \quad \downarrow \uparrow \downarrow, \quad \downarrow \downarrow \uparrow, \quad \downarrow \downarrow \downarrow} \]
  • There are \(\Omega = 2^3\) microstates with entropy being:

\[ S = k_B \log 2^3 = 3k_B log2 \]
  • For N spins we see that \(\Omega=2^N\) and therefore entropy scales linearly with system size \(N\)

\[ S = Nk_B log2 \]

Exercise

Quantify the number of microstates of three spins given that down spin has energy zero and up spin has energy \(\epsilon\) for the following two systems:

  • Total energy is \(E=2\epsilon\)

  • Total energy is \(E=3\epsilon\)

Microcanonical partition function grows exponentially with system size#

../_images/84c6665d550dd911c9218c4755f4842f8909186ed2216b070a9e4c90329af2fd.png
  • To estimate how the number of microstates behave as a function of system size consider \( N \) particles in a volume \( V \), and particle density \(\rho = \frac{N}{V}\)

  • Dividing the system into \( M \) statistically independent subregions of volume \( M = V/v \) containing \( \Omega_{\text{sub}}\) microstates in each we get:

\[ \Omega(E) = \left( \Omega_{\text{sub}} \right)^M = \left( \Omega^{1/\rho v}_{\text{sub}} \right)^N \]
  • We find that number of mirostates grows exponentially with syste size \(N\). This implies a large deviation property: entropy scales extensively and grows monotonically with energy.

Large deviation propery of \(\Omega\)

\[ \Omega(E) \sim e^{N s(E/N)} \]
\[ S(E) = k_B \log \Omega(E) \sim k_B N s(E/N) \]
  • \(s(E/N)\) is an intensive quantity of entropy per-particle.

  • \(S(E)\) is an extensive quantity of total entropy of N partice system.

Applications of NVE#

Particles in a box#

  • For a single quantum particle in a cubical box of side \( L \), the allowed energy levels are:

\[ E_{n_x, n_y, n_z} \sim (n_x^2 + n_y^2 + n_z^2) \]
  • Where \( n_x, n_y, n_z \) are positive integers (quantum numbers).

  • To determine the number of microstates with total energy at most \( E \), we count the number of allowed quantum states \( (n_x, n_y, n_z) \) satisfying:

\[ n_x^2 + n_y^2 + n_z^2 \leq E \]
  • For large \( E \), this corresponds to counting integer lattice points inside a sphere of radius:

\[ R = \sqrt{E} \]
  • Since the number of points inside a sphere scales approximately as the volume of the sphere, we get:

\[ \Omega(E) \approx \frac{4}{3} \pi R^3 \propto E^{3/2} \]
  • Thus, for a single particle, the number of accessible microstates grows as:

\[ \Omega(E) \sim E^{3/2} \]
  • For \( N \) independent particles, each particle contributes an independent set of quantum numbers, meaning we now count lattice points in a \( 3N \)-dimensional hypersphere.

\[ \Omega(E) \sim E^{3N/2} \]
Hide code cell source
# Create a combined figure
fig = plt.figure(figsize=(14, 6))

# ---------------- Plot 1: Scaling of Microstates ----------------
ax1 = fig.add_subplot(131)
E = np.linspace(1, 10, 200)

N=10

Omega = E**(1.5 * N)
ax1.plot(E, Omega, label=f"N = {N}", color='black', lw=3.5)

ax1.set_xlabel("Energy E")
ax1.set_ylabel(r"$\Omega(E) \sim E^{\frac{3N}{2}}$")
ax1.set_title("Scaling of $\Omega(E)$")
ax1.set_yscale('log')  # Logarithmic scale to better display the exponential growth
ax1.grid(True, linestyle='--', alpha=0.7)
ax1.legend()

# ---------------- Plot 2: Growth of Quantum States in 2D ----------------
ax2 = fig.add_subplot(132)
n_max = 15  # Reduce max quantum number for clarity
R_values = [5, 10, 15]
n_x_values = np.arange(1, n_max + 1)
n_y_values = np.arange(1, n_max + 1)

for n_x in n_x_values:
    for n_y in n_y_values:
        energy = n_x**2 + n_y**2
        if energy <= max(R_values)**2:
            ax2.scatter(n_x, n_y, color='black', s=10)

theta = np.linspace(0, 2 * np.pi, 300)
for R in R_values:
    ax2.plot(R * np.cos(theta), R * np.sin(theta), label=f'R = {R}', linewidth=1.5)

ax2.set_xlabel(r'$n_x$')
ax2.set_ylabel(r'$n_y$')
ax2.set_title('Quantum States Growth (2D)')
ax2.legend()
ax2.set_xlim(0, n_max)
ax2.set_ylim(0, n_max)
ax2.grid(True, linestyle='--', alpha=0.5)
ax2.set_aspect('equal')

# ---------------- Plot 3: 3D Representation of Quantum States ----------------
ax3 = fig.add_subplot(133, projection='3d')
n_max_3d = 10  # Reduce quantum number range for clarity

# Generate 3D quantum states
n_z_values = np.arange(1, n_max_3d + 1)
for n_x in np.arange(1, n_max_3d + 1):
    for n_y in np.arange(1, n_max_3d + 1):
        for n_z in np.arange(1, n_max_3d + 1):
            energy = n_x**2 + n_y**2 + n_z**2
            if energy <= max(R_values)**2:
                ax3.scatter(n_x, n_y, n_z, color='black', s=5)

ax3.set_xlabel(r'$n_x$')
ax3.set_ylabel(r'$n_y$')
ax3.set_zlabel(r'$n_z$')
ax3.set_title('Quantum States Growth (3D)')
ax3.view_init(elev=20, azim=45)

# Show the combined figure
plt.tight_layout()
plt.show()
../_images/f97f17881d9c56b2bc910d1a44ba1280ba625ef69e618075fb13655b6fe49766.png

Two state system#

  • Given \(N\) non-interacting spins where each spin can be up (\(\uparrow\)) with energy \( \epsilon \) or down (\(\downarrow\)) with energy \( 0 \). The total energy is:

    \[ E = n\epsilon \]
  • Determine fraction of excited states \(f=\frac{n}{N} = \frac{E}{N\epsilon}\) where \(n\) is number of up spins. Show how this fraciton changes with temperature

\[ log\Omega(E, N) = log \frac{N!}{n! (N-n)!} = \frac{N!}{(E/\epsilon)! (N-E/\epsilon)!} \]
  • Using Striling’s approximation \(logN!=NlogN-N\) we get:

\[ log\Omega(E, N) \approx N \log N - \frac{E}{\epsilon} \log \frac{E}{\epsilon} - \bigg(N - \frac{E}{\epsilon}\bigg) \log \bigg(N - \frac{E}{\epsilon}\bigg) \]
  • We connect number of excited states to equilibrium temperature via thermodynamics

\[\frac{1}{T} = \frac{dS}{dE} = k_B \frac{d log\Omega}{dE}\]
\[ \frac{1}{k_BT} = - \frac{1}{\epsilon} \log \frac{E}{\epsilon} + \frac{1}{\epsilon} \log \bigg(N - \frac{E}{\epsilon}\bigg) \]
\[ \frac{E}{\epsilon} = \bigg(N - \frac{E}{\epsilon}\bigg) e^{-\frac{\epsilon}{k_B T} } \]
\[ f = \frac{E}{N\epsilon} = \frac{1}{1 + e^{\frac{\epsilon}{k_B T} }} \]
  • This is the well-known Boltzmann factor result for a two-level system in thermal equilibrium. At high temperatures (\( k_B T \gg \epsilon \)), approximately half the particles are excited, while at low temperatures (\( k_B T \ll \epsilon \)).

Hide code cell source
import numpy as np
import scipy.special as sp
import matplotlib.pyplot as plt

# Create a figure with two subplots
fig, axes = plt.subplots(1, 2, figsize=(14, 6))

# Subplot 1: Growth of Ω(E) with Energy for Different Spin System Sizes
N_values = [10, 20, 50]  # Different spin system sizes

for N in N_values:
    energies = np.arange(0, N+1, 1)  # Possible energy levels
    multiplicities = sp.binom(N, energies)  # Compute binomial coefficient
    axes[0].plot(energies, multiplicities, label=f'N = {N}', linestyle='-', marker='o')

# Plot settings for first subplot
axes[0].set_yscale('log')  # Use logarithmic scale to highlight exponential growth
axes[0].set_xlabel(r'Total Energy $E$')
axes[0].set_ylabel(r'$\Omega(E)$ (Number of Microstates)')
axes[0].set_title(r'Growth of $\Omega(E)$ with Energy')
axes[0].legend()
axes[0].grid(True, which='both', linestyle='--')

# Subplot 2: Fraction of Particles in the Excited State vs. Temperature
epsilon = 1.0  # Set energy scale to 1 for simplicity
k_B = 1.0  # Boltzmann constant set to 1 for simplicity
T_values = [0.5, 1.0, 2.0, 5.0]  # Different temperature values

# Define function for fraction of excited particles
def fraction_excited(beta_epsilon):
    return 1 / (1 + np.exp(beta_epsilon))

# Generate beta_epsilon values
beta_epsilon_values = np.linspace(0, 5, 100)

# Plot f for different temperatures
for T in T_values:
    beta_epsilon = epsilon / (k_B * T) * beta_epsilon_values
    f_values = fraction_excited(beta_epsilon)
    axes[1].plot(beta_epsilon_values, f_values, label=f"T = {T}")

# Plot settings for second subplot
axes[1].set_xlabel(r"$\beta \epsilon$")
axes[1].set_ylabel(r"Fraction of Excited Particles $f$")
axes[1].set_title("Fraction of Particles in the Excited State")
axes[1].legend()
axes[1].grid(True, linestyle='--')

# Adjust layout
plt.tight_layout()
plt.show()
../_images/d717ab920389c5a524342c670da909011367acd339cab018386d6d2ebddf97e3.png

Energy partitioning in an isolated system#

../_images/84c67110fe748f9367f4697a05d5235dcdc18c8919f9140e0b93c202301c8043.png
  • \( \Omega_T(E_t) \) is the total number of microstates of the whole isoluate box divided into:

    • \( \Omega(E) \) number of microstates available to the system of interest

    • \( \Omega_R(E_T - E) \) number of microstates available to the Reservoir

  • Since reservoir and system can be considered statistically independent, the probability of finding the system in a macrostate with energy \(E\) is:

    \[ p(E) = \frac{\Omega(E) \Omega_R(E_t - E)}{\Omega_T(E_T)} \]
  • This is a ratio of all microstate where system gets \(E\) and reservoir \(E_t-E\) energies divided by total number of microstates. The latter given as sum of all possible partitionings of energy

    \[ \Omega_t(E_t) = \sum_E \Omega(E) \Omega_R(E_T - E) \]
  • We can see that probability of macrostates is normalized \(\sum_E P(E)=1\). The system is more likely to be in a macrostate \( E \) if there are more microstates that reaalize this partitioning.

../_images/fb56bd226eda89c94a681c6a9e2e455f57c978edecb33b9b26ccf0653cb79d5e.png
Hide code cell source
# Re-import necessary libraries since execution state was reset
import numpy as np
import matplotlib.pyplot as plt

# Define different system sizes
system_sizes = [(5, 10), (10, 20), (20, 40)]

# Define total energy
E_total = 5

# Create figure
plt.figure(figsize=(7, 6))

# Loop over different system sizes and plot
for N1, N2 in system_sizes:
    # Define energy range for system 1 (from 0 to E_total)
    E1_values = np.linspace(0.01, E_total, 50)  # Avoid E=0 to prevent singularities
    E2_values = E_total - E1_values  # Energy remaining for system 2

    # Compute microstates using Omega(E) ~ E^(3N/2)
    Omega1 = E1_values**(3 * N1 / 2)
    Omega2 = E2_values**(3 * N2 / 2)

    # Compute total number of microstates (product of subsystems)
    Omega_total = Omega1 * Omega2 / np.sum(Omega1 * Omega2)  # Normalize to get probability

    # Plot results
    plt.plot(E1_values, Omega_total, label=rf'$N_1={N1}, N_2={N2}$')

    # Draw vertical line at the peak (mean energy E = U)
    E_peak = E1_values[np.argmax(Omega_total)]
    plt.axvline(E_peak, color='black', linestyle=':', linewidth=2)

# Plot settings
plt.xlabel(r"Energy given to System: $E_1$")
plt.ylabel(r"$P(E_1)$")
plt.title("Probability Distribution of Energy Partitioning")
plt.legend()
plt.grid(True)

# Show plot
plt.show()
../_images/5537f9797f532ab87552667b3d858d5f3e5141255e1afe5b4bf1e52f227b6da2.png

Temperature is the driver of energy partitioning#

  • Which paritioning is most likely? For two systems exchanging energy we can write down probability of macrostate and find its maxima with respect to \(E\)

\[ \frac{d }{dE}logP(E) = \frac{d }{dE} \bigg[ log\Omega(E)\Omega_2(E_{T}-E) \bigg]= 0 \]
\[\frac{d}{dE}logP(E) = \bigg[ \frac{d }{dE} log\Omega_1 - \frac{d}{dE}log\Omega_2 \bigg]= 0\]
  • Since \(logP(E)\sim S(E)+S_R(E_T-E)\) we note that Maximizing probability of a macrostate is the same as maximizing entropy of macrostate!

  • We also come to appreacite that inverse temperature \(\beta=\frac{1}{k_BT}\), quantifies rate of growth of microstates.

  • At lower temperatures \(\beta\) is larger indicating faster growth of microstates. At higher temperatures \(\beta\) is smaller indicating slower groth of microstates with addition of energy.

Inverse Temperature \(\beta\)

\[\frac{d log\Omega}{dE}=\frac{1}{k_B}\frac{dS}{dE}=\frac{1}{k_BT} = \beta\]
  • \(\beta\) has units of inverse energy, e.g \(J^{-1}\)

Thermal Equilibrium in Ideal Gases#

  • For a system of non-interacting particles in a box, the number of microstates follows \(\Omega \sim E^{\frac{3}{2}N}\). The entropy is defined as:

    \[ S_{\text{total}} \sim k_B \log \Omega_1(E_1)\Omega_2(E_{tot}-E_1) = \frac{3}{2} Nk_BlogE_1 + \frac{3}{2} Nk_Blog(E-E_1) \]
  • Maximizing entropy with respect to energy exchange between two subsystems \(E_1\) gives use the equilibrium value \(U_1\) that system gets.

    \[ \frac{\partial S_{\text{total}}}{\partial E_1}\bigg|_{E_1=U_1} = \frac{3}{2} k_B \frac{N_1}{U_1} - \frac{3}{2} k_B \frac{N_2}{E-U_1} = 0. \]
  • Plugging the definition of temperature on left hand side which in equilibrium we see is equal for two systems exchangeing energy:

    \[ \frac{1}{k_B T} = \frac{3}{2} \frac{N_1}{U_1} = \frac{3}{2} \frac{N_2}{U_2}. \]
  • This leads to the well-known result that each degree of freedom receives \(\frac{1}{2} k_B T\) of thermal energy:

    \[ U = \frac{3}{2} N k_B T. \]
  • Solving for \(U_1\) we also see that each system gets energy proportionate to its size

    \[ U_1 = \frac{N_1}{N_1 + N_2} E_{tot} \]

Constant temperature ensemble (NVT)#

../_images/320234124970dda01bbe049cb524930d1cc26572ce04ebf024d71982303e1de0.png
  • We start by considering an islolated box (\(NVE\) ensemble) inside which there is a system of interest which is exchanging energy with much larger reserovoir or heat bath.

  • Using the fact that reservoir is much larger than the system \( E \ll E_t \) we can taylor expand log of microstates (entropy) around \(E_t\)

\[ p(E) = \frac{\Omega(E) \Omega_r(E_t - E)}{\Omega_t(E_t)} \]
\[log\Omega_r(E_t-E) \approx log\Omega_r(E_t) - \bigg(\frac{\partial log \Omega_r}{\partial E} \bigg) E = const - \beta E\]
  • The first factor is a constant independent of energy the second factor in front of energy is recognize as inverse temperature \(\beta = \frac{dlog\Omega}{dE}=\frac{1}{k_BT}\)

  • We have now have an ensemble of microstates of systems specified by \(NVT\) variables and and reservoir influence enters through temperature!

  • Ensemble of \(NVT\) microstates has different energies that are exponentially distributed (price for borrowing energy from the bath).

\[ \Omega_r(E_t - E) \sim e^{- \beta E} \]

Boltzmann distribution (NVT)

Probability of a Macrostate

\[ p(E) = \frac{\Omega(E) e^{-\beta E}}{Z} \]

Probability of a Microstate

\[ p_i = \frac{e^{-\beta E_i}}{Z} \]

Partition Function

\[ Z = \sum_E \Omega(E) e^{-\beta E} = \sum_i e^{-\beta E_i} \]

Partition Functions and Thermodynamic limit#

\[Z = \sum_E \Omega(E) e^{-\beta E} = \int \sum \Omega(E) e^{-\beta E} dE\]
  • We find that microcanonical and canonical ensebles are linked via Laplace transform. Recall that \(E\) and free energy \(F\) via Legendre transform

  • This shows that when going from \(NVE\) to \(NVT\) ensemble we are adopting a conveneint variable \(\beta\) by replacing \(E\).

  • The number of states grows exponentially with system size \( N \), \( \Omega(E) = e^{\frac{S}{k_B}} \sim e^{N}\) while the Boltzmann factor decays exponentially with energy \(e^{-\beta E} \sim e^{-N}\)

  • The dominant contribution to the partition function comes from narrow region around ensemble average or equilibrium value of energy \(U=\langle E\rangle\). Deviations from average are xponentially negligble!

Legendre vs Laplace Transoforms

\[ Z =\int e^{-\beta (E-TS)}dE \approx e^{\min_E [-\beta (E - TS)]} = e^{-\beta(U - TS)} = e^{-\beta F} \]
\[F = U - TS \]
  • \( U = \langle E \rangle \) is the average energy, with fluctuations of order \( O(N^{1/2}) \).

  • \(F\) is the Helmholtz free energy.

Hide code cell source
import numpy as np
import matplotlib.pyplot as plt

# Define energy range
E = np.linspace(0, 10, 100)

# Define parameters
beta = 1.0  # Inverse temperature (1/kT)

# Compute the Boltzmann factor
Boltzmann_factor = np.exp(-beta * E)

# Increase the entropy prefactor to shift the peak to the right
S_prefactor_new = 2.5  # Larger prefactor makes entropy increase faster

# Recalculate entropy and probability density
S_new = S_prefactor_new * np.log(1 + E)
Probability_density_new = np.exp(S_new) * Boltzmann_factor

# Create the updated plot
plt.figure(figsize=(8, 6))

# Plot entropy (scaled for visualization)
plt.plot(E, S_new / max(S_new), label=r"Entropy $S(E)$ (scaled)", color="blue", linestyle="--")

# Plot Boltzmann factor (scaled for visualization)
plt.plot(E, Boltzmann_factor / max(Boltzmann_factor), label=r"Boltzmann Factor $e^{-\beta E}$ (scaled)", color="red", linestyle="--")

# Plot updated probability density (product of both)
plt.plot(E, Probability_density_new / max(Probability_density_new), label=r"Probability Density $\Omega(E) e^{-\beta E}$", color="black")

# Highlight new peak region
E_peak_new = E[np.argmax(Probability_density_new)]
plt.axvline(E_peak_new, color="green", linestyle=":", label="New Peak Region")

# Labels and title
plt.xlabel("Energy $E$")
plt.ylabel("Scaled Functions")
plt.title("Shifted Peak: Entropy Growth, Boltzmann Factor Decay, and Probability Density")
plt.legend()
plt.grid(True, linestyle="--", alpha=0.6)

# Show plot
plt.show()
../_images/e9af104601dea02b51610f51d9cc351d067170b61f1823766d81c534df986d61.png

Examples of using NVT#

non-interacting spins#

  • Consider an ensemble of three non-interaacting spins under constant temperature. The up spin has \(\epsilon\) and down spin \(0\) energy.

Microstate

Configuration

Total Energy \(E\)

Degeneracy \(\Omega(E)\)

1

\(\downarrow \downarrow \downarrow\)

\(0\)

1

2

\(\downarrow \downarrow \uparrow\)

\(\epsilon\)

3

3

\(\downarrow \uparrow \downarrow\)

\(\epsilon\)

3

4

\(\uparrow \downarrow \downarrow\)

\(\epsilon\)

3

5

\(\downarrow \uparrow \uparrow\)

\(2\epsilon\)

3

6

\(\uparrow \downarrow \uparrow\)

\(2\epsilon\)

3

7

\(\uparrow \uparrow \downarrow\)

\(2\epsilon\)

3

8

\(\uparrow \uparrow \uparrow\)

\(3\epsilon\)

1

  • The partition function would be sum over all \(2^3=8\) microstaes.

\[Z = 1+3e^{-\beta \epsilon}+ 3e^{-2\beta \epsilon}+e^{-3\beta \epsilon}\]
  • Probability of a microstate \(\downarrow \downarrow \uparrow\) is:

\[p_2 = \frac{e^{-\beta \epsilon}}{Z}\]
  • Probability of a macrostate \(E=\epsilon\) is

\[P(E=\epsilon) = \frac{3e^{-\beta \epsilon}}{Z}\]

non-interacting indentical spins

  • Consider three spins where up and down orientations have equal energy \(\epsilon\).

  • Show that sum over microstates and sum over macrostates leads to same expression of parition function.

  • Write down free energy for the system and identify entropic and energetic parts.

Solution

Sum over macrostates

\[Z = \sum_E \Omega(E)e^{-\beta E} = 8e^{-3\beta\epsilon }\]

Sum over microstates

\[ Z = \sum_i e^{-\beta E_i} \]
  • Since each spin is independent, \(E=E_1+E_2+E_3\) the sum factorizes!

\[ Z = \sum_{s_1} e^{-\beta E_1} \sum_{s_2} e^{-\beta E_2} \sum_{s_3} e^{-\beta E_3} \]
  • Each sum runs over the two possible spin orientations (\(\uparrow\), \(\downarrow\)), both of which have the same energy \( \epsilon \), so:

\[ \sum_{s_i} e^{-\beta E_i} = e^{-\beta \epsilon} + e^{-\beta \epsilon} = 2 e^{-\beta \epsilon} \]
  • Thus, for three spins:

\[ Z = \left( 2 e^{-\beta \epsilon} \right)^3 = 8 e^{-\beta \epsilon} \]

Free energy

\[F = -k_BTlogZ = -k_BT\epsilon log 8 + \epsilon\]

Two-state particles (NVT)#

  • Consider a simple two-level system where lower level has energy \(0\) and upper level \(\epsilon\). Determine how the fraction of excited states \(f=\frac{n}{N}\) changes with temperature.

  • Solving a two-state particle system in an NVT ensemble is much easier because the partition function decouples into single particle contributions.

\[Z = \sum^{n=N}_{n=0} e^{-\beta E_n} = (1+e^{-\beta \epsilon})^N\]
\[F= -k_B T log Z = -k_BT N log(1+e^{-\beta \epsilon})\]
\[\langle E \rangle = \frac{\partial log Z}{\partial (-\beta)} = \frac{N\epsilon}{1+e^{\beta \epsilon}}\]
\[f = \frac{E}{N\epsilon} = \frac{1}{1+e^{\beta \epsilon}}\]
  • We obtained same expression we got when using NVE but it tooks us less number of steps!

Free energy and macrostate probabilities#

  1. Microstates: The relative population of microstates is dictated by the ratio of Boltzmann weights which depends on energy difference \(\Delta E\)

\[p_1 = \frac{e^{-\beta E_1}}{Z} = \frac{e^{-\beta E_1}}{e^{-\beta F}}\]
\[{\frac{p_2}{p_1} = e^{-\beta (E_2-E_1)}}\]
  1. Macrostates: Probability of macrostates with energy \(E_A\) is obtained by summing over all microstates with energy E_A or simply by multiplying by \(\Omega_A\). The latter is related to entropy, which ends up turning the numerator into the free energy of a macrostate \(A\): \(F_A = E_A-TS_A\)

\[p_A =\frac{\Omega (E_A) e^{-\beta E_A}}{Z_A} = \frac{e^{-\beta F_A}}{e^{-\beta F}}\]
  • The relative population of macrostates is dictated by the ratio of entropic term times Boltzmann weights which depends on free energy difference \(\Delta F\)

\[{\frac{p_B}{p_A} = e^{-\beta (F_B-F_A)}}\]

Log of macrostate probability is free energy

  • Free energy of macrostate or a continuous coordinate \(X\) with resepct to some reference state.

\[F(X) = -k_BT log P(X)+const\]
Hide code cell source
# Define reaction coordinate
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(-2, 2, 400)

# Define a tilted asymmetric double-well free energy profile
F_x = 3 * (x**4 - 1.2*x**2) + 2 + 0.5*x  # Added tilt to shift one minimum

# Identify macrostates A and B based on regions left and right of the transition state (x=0)
x_A_region = x[x < 0]  # Left basin (macrostate A)
x_B_region = x[x > 0]  # Right basin (macrostate B)
F_A = np.min(F_x[x < 0])  # Free energy of macrostate A (left well minimum)
F_B = np.min(F_x[x > 0])  # Free energy of macrostate B (right well minimum)
ΔF = F_B - F_A  # Free energy difference

# Compute probability distribution P(X) from free energy F(X)
P_x = np.exp(-F_x)  # Exponential of negative free energy
P_x /= np.trapz(P_x, x)  # Normalize probability

# Create figure with side-by-side subplots: Free Energy and Probability Distribution
fig, axes = plt.subplots(1, 2, figsize=(12, 5), sharex=True)

# --- Free Energy Profile ---
axes[0].plot(x, F_x, label=r'Free Energy $F(X)$', color='b', linewidth=2)
axes[0].fill_between(x_A_region, F_x[x < 0], max(F_x), color='red', alpha=0.3, label="Macrostate A")
axes[0].fill_between(x_B_region, F_x[x > 0], max(F_x), color='green', alpha=0.3, label="Macrostate B")
axes[0].axhline(F_A, color='red', linestyle='--', label=r'$F_A$')
axes[0].axhline(F_B, color='green', linestyle='--', label=r'$F_B$')

# Indicate ΔF with an arrow
axes[0].annotate("", xy=(1.1, F_B), xytext=(1.1, F_A),
                 arrowprops=dict(arrowstyle="<->", color='black', linewidth=1.5))
axes[0].text(1.15, (F_A + F_B) / 2, r'$\Delta F$', va='center', fontsize=12, color='black')

axes[0].set_xlabel("Reaction Coordinate X")
axes[0].set_ylabel("Free Energy $F(X)$")
axes[0].set_title("Free Energy Profile of Macrostates A and B")
axes[0].legend()
axes[0].grid(True, linestyle="--", alpha=0.5)
axes[0].set_xlim([-1.5, 1.5])
axes[0].set_ylim([0, 5])

# --- Probability Distribution ---
axes[1].plot(x, P_x, label=r'Probability $P(X) \propto e^{-F(X)}$', color='black', linewidth=2)
axes[1].fill_between(x_A_region, P_x[x < 0], 0, color='red', alpha=0.3, label="Macrostate A")
axes[1].fill_between(x_B_region, P_x[x > 0], 0, color='green', alpha=0.3, label="Macrostate B")

axes[1].set_xlabel("Reaction Coordinate X")
axes[1].set_ylabel("Probability $P(X)$")
axes[1].set_title("Probability Distribution of Macrostates A and B")
axes[1].legend()
axes[1].grid(True, linestyle="--", alpha=0.5)

# Adjust layout and show the plots
plt.tight_layout()
plt.show()
../_images/570dcd4be7428e8e4e55b6ca4e8cbba94db2b3d1256391c9885e5d3845edc527.png

Exercise

  • Consider state A has 3 energy levels \(0, \epsilon, 2\epsilon\) and state B has four energy levels with \(0, 2\epsilon, 3\epsilon, 4\epsilon\)

  • For state B all excited states have degenercy of 10.

  • Compute how probability of state A vs B changes with temperature.

Energy Fluctuations#

  • Log of canonical parition function \(logZ\) has some interesting mathematical properties.

  • We are going to show that first and second derivatives yield average and fluctuations of energy.

\[P_i = \frac{e^{-\beta E_i}}{Z}, \quad Z = \sum_i e^{-\beta E_i}\]
  • The ensemble average energy can be related to the derivative of log of partition function:

\[ \langle E \rangle = \sum_i P_i E_i = \frac{1}{Z} \sum_i E_i e^{-\beta E_i} = -\frac{1}{Z} \frac{\partial Z}{\partial \beta} = -\frac{\partial \ln Z}{\partial \beta} \]
  • To quantify fluctuations, we define the variance of energy and proceed to show that this is equal to second erivative of logZ

\[ \langle (\Delta E)^2 \rangle = \langle E^2 \rangle - \langle E \rangle^2 \]
  • Taking first derivative:

\[ \frac{\partial \ln Z}{\partial \beta} = -\frac{1}{Z} \sum_i E_i e^{-\beta E_i} = -\langle E \rangle \]
  • Taking the second derivative:

\[ \frac{\partial^2 \ln Z}{\partial \beta^2} = \frac{1}{Z} \sum_i E_i^2 e^{-\beta E_i} - \left(\frac{1}{Z} \sum_i E_i e^{-\beta E_i} \right)^2 \]
\[ \frac{\partial^2 \ln Z}{\partial \beta^2} = \langle E^2 \rangle - \langle E \rangle^2 = \langle (\Delta E)^2 \rangle \]
  • Since \( \beta = \frac{1}{k_B T} \), we can use chain rule and express this in terms of temperature:

\[ \langle (\Delta E)^2 \rangle = k_B T^2 \frac{\partial \langle E \rangle}{\partial T} = k_B T^2C_v \]
  • Where in the last line we used definition of heat capacity \(C_V = \frac{d\langle E\rangle}{dT}\)

Moments of Energy in NVT ensemble

\[ \langle E\rangle = -\frac{\partial \ln Z}{\partial \beta} \]
\[ \sigma_E^2 = \langle E^2 \rangle - \langle E \rangle^2 = \frac{\partial^2 \ln Z}{\partial \beta^2} \]

Fluctuation-Response Theorem

\[\langle (\Delta E)^2 \rangle = k_B T^2 C_V \]
  • The probability distribution of energy, \(P(E)\), follows a Gaussian distribution in equilibrium:

    \[ P(E) \propto \exp\left(-\frac{(E - \langle E \rangle)^2}{2 k_B T^2 C_V} \right) \]
  • Relative energy fluctuations decrease with \(N\). In the thermodynamic limit \(N\rightarrow \infty \), fluctuations become negligible, justifying ensemble equivalence.

    \[ \frac{\sigma_E}{\langle E \rangle} \sim \frac{C_V^{1/2}}{\langle E \rangle} \sim O(N^{-1/2}) \]

Statistical nature of irreversibility#

  • From the perspective of the NVE ensemble, we can state that if the number of accessible microstates increases upon the removal of a constraint, then reinstating the constraint will not spontaneously reduce it. This reflects the fundamental irreversibility of spontaneous processes in an isolated system:

\[ \Delta S = \log \frac{\Omega_{B}}{\Omega_{A}} \geq 0. \]
  • A similar conclusion holds in the NVT ensemble: Under constant temperature, the number of microstates, represented by the partition function \(Z\), increases during a spontaneous process when a system is in contact with a heat bath.

    \[ -\beta \Delta F = \log \frac{Z_{B}}{Z_{A}} \geq 0. \]
  • This formulation underscores the irreversibility of thermodynamic processes and highlights the natural tendency of a system to evolve towards configurations with higher entropy (in the microcanonical ensemble) or lower free energy (in the canonical ensemble).

Problems#

Problem 1 Shottky defects#

Schotky defects are vacancies in a lattice of atoms. Creating a single vacancy costs an energy \(\epsilon\). Consider a lattice with \(N\) atoms and \(n\) vacacnies. In this model the total energy is solely a function of defects: \(E=n\epsilon\)

  • Write down number of states and compute the entropy via Boltzmann formula. Plot number of states as a function of energy. You can use log of number of states for plotting.

  • Compute how the temperature would affect the fraction of vacancies on the lattice. Plot fraction of vacancies as a function of temperature.

  • How would the total energy depend on temperature \(T\). Derive expression for the high temeprature limit (\(\frac{\epsilon}{k_b T} \gg 1\)).

  • Plot total energy as a function of temperature E(T)

Problem 2 Lattice gas#

Consider \(N\) particles distributed among \(V\) cells (with \(N\ll V\)). This is a lattice model of a dilute gas. Suppose that each cell may be either empty or occupied by a single particle. The number of microscopic states of this syste will be given by:

\[\Omega (N, V) = \frac{V!}{N! (V-N)!}\]
  • Obtain an expression for the entropy per particle \(s(v)=\frac{1}{N} \cdot S(N,V)\) where \(v=\frac{V}{N}\).

  • From this simple fundamental equation, obtain an expression of equation of state \(p/T\).

    • Write an expansion of \(p/T\) in terms of density \(1/v\). Show that the first term gives Boyle law of ideal gases.

  • Sketch a graph of \(\mu/T\), where \(\mu(\rho)\) is a chemical potential as a function of density. Comment on \(\rho\rightarrow 0\) and \(\rho\rightarrow 1\) limits.

Problem 3 Polymer Elasticity#

Solve the problem 2.7 from the book.

Problem 4#

Consider a system of N classical and non-interacting particles in contact with a thermal reservoir at a temperature \(T\). Each particle can have be in three states with energy \(0\), \(\epsilon\) or \(3\epsilon\) where \(\epsilon>0\).

  • Obtain an expression for \(Z\) then compute the average and fluctuation of energy.

  • Plot the heat capacity as a function of temperature \(C_v(T)\)

  • Plot the average enegy as a function of temperature \(U(T)\)

  • Plot the entropy as a function of temperature \(S(T)\).

Problem 5#

Consider \(N\) lattice sites which have quantum spins \(s=1\) (not to be confused with entropy) with a mangnetic moment \(\mu\). Spins are subject to a uniform mangeitc field in z direction \(B=B_z\) making the energy of each spin \(-\mu B m \) where \(m\) is the magnetic quantum number thattakes on three possible values \(m=0, \pm 1\).

  • Compute the entropy \(S\) and the mangeitzation of the system \(M\)

  • Plot entropy as a function of temperatures and study the limit of low temperatures \(S(T\rightarrow 0)\)