Two-state system#

import matplotlib.pyplot as plt
import numpy as np

Calculate fraction of excited states#

  • You have a two state system. Consider difference between energy levels \(\Delta \epsilon\) between units of \(0, 5\) kj/mol

  • Calculate how \(N_1/N_2\) changes as a function of \(\Delta \epsilon\) at temperature \(kT= 1\) kj/mol

  • Repeat calculation for a few temperatures \(kT=1, 10, 100\)

delta_Es = np.arange(0, 5, 0.1) 

Compute average energy and heat capacity as a function of temperature#

# Define the energy levels and set kB=1 to simplfy units
E0, E1 = 0, 1

# Define a range of temperatures (avoiding zero) 
T = np.linspace(0.1, 5, 100)

# Calculate the internal energy U

# Calculate the heat capacity C
C = np.diff(U) / np.diff(T)
# Plotting
#fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))

# Internal energy plot
#ax1.plot(kbT, U, label='Internal Energy (U)')
ax1.set_xlabel('Temperature (T)')
ax1.set_ylabel('Internal Energy (U)')
ax1.set_title('Internal Energy vs Temperature')
ax1.legend()

# Heat capacity plot
# Skip the first temperature value since we used np.diff
#ax2.plot(kbT[1:], C, label='Heat Capacity (C)', color='r')
ax2.set_xlabel('Temperature (T)')
ax2.set_ylabel('Heat Capacity (C)')
ax2.set_title('Heat Capacity vs Temperature')
ax2.legend()

plt.tight_layout()
No artists with labels found to put in legend.  Note that artists whose label start with an underscore are ignored when legend() is called with no argument.
No artists with labels found to put in legend.  Note that artists whose label start with an underscore are ignored when legend() is called with no argument.
<Figure size 640x480 with 0 Axes>