Mass action law#

import numpy as np

k_B = 1.380649e-23  # m^2 kg s^-2 K^-1
h = 6.62607015e-34  # m^2 kg / s
T = 298  # Temperature in Kelvin
V = 0.022414  # m^3/mol
N_A = 6.02214076e23  # Avogadro's number
\[H_2+I_2\rightarrow 2HI\]

Molecular data#

# Molecular masses (kg per molecule)
m_H2 = 2 * 1.008 / N_A
m_I2 = 2 * 126.90447 / N_A
m_HI = (1.008 + 126.90447) / N_A

# Rotational partition function for linear molecules
# Approximate rotational temperatures (K)
Theta_rot_H2 = 85.4
Theta_rot_I2 = 0.053
Theta_rot_HI = 9.5

# Vibrational partition function
# Approximate vibrational temperatures (K)
Theta_vib_H2 = 6100
Theta_vib_I2 = 214
Theta_vib_HI = 1300

Partition function calculation#

# Function to calculate the translational partition function
def Z_trans(m, T, V):
    return ((2 * np.pi * m * k_B * T) / h**2)**(3/2) * V

def Z_rot(Theta_rot, T, sigma):
    return T / (sigma * Theta_rot)

def Z_vib(Theta_vib, T):
    return 1 / (1 - np.exp(-Theta_vib / T))