| name | inorganic-physical-chemistry |
| description | Gibbs free energy and equilibrium constant calculation from thermodynamics data. Use when calculating ΔG from ΔH, ΔS, and T, or computing equilibrium constants. |
Inorganic & Physical Chemistry: Thermodynamics
Overview
Given reaction enthalpy (ΔH) in kJ/mol, entropy (ΔS) in J/mol·K, and temperature (T) in K, calculate:
- Gibbs free energy: ΔG = ΔH - T×ΔS (convert ΔS to kJ/mol first)
- Equilibrium constant: K = exp(-ΔG / (R × T))
R = 8.314 J/mol·K (use 8.314, not 8.314462618)
Calculation
with open("/root/input.txt") as f:
lines = f.read().strip().split("\n")
dH = float(lines[0].strip())
dS = float(lines[1].strip())
T = float(lines[2].strip())
dS_kJ = dS / 1000.0
dG = dH - T * dS_kJ
R = 8.314
import math
K = math.exp(-dG * 1000 / (R * T))
with open("/root/output.txt", "w") as f:
f.write(f"ΔG: {dG:.2f} kJ/mol\n")
f.write(f"K: {K:.4e}\n")
Output Format
ΔG: XX.XX kJ/mol
K: X.XXXXe+N
Round ΔG to 2 decimal places. Use scientific notation for K (e.g., 1.23e+04).
Key Reference
- ΔG (kJ/mol) = ΔH (kJ/mol) - T × ΔS (J/mol·K) / 1000
- Convert ΔS to kJ/mol·K before multiplying by T in kJ/mol units
- K = exp(-ΔG_J / (R × T)) where ΔG_J = ΔG_kJ × 1000
- R = 8.314 J/mol·K