This project calculates and visualizes the equilibrium distribution of hydrofluoric acid (HF) and fluoride ion (F⁻) as a function of pH.
Core dependencies:
To compute and plot the percentage of:
- HF (undissociated acid)
- F⁻ (fluoride ion)
across a pH range (0–14) using equilibrium thermodynamics.
The system is governed by the acid dissociation equilibrium:
HF ⇌ H⁺ + F⁻
Using:
- Ka (HF dissociation constant) = 6.6 × 10⁻⁴
- pH-dependent hydrogen ion concentration
Fractions are computed as:
-
Fraction of F⁻:
F⁻ = Ka / (Ka + [H⁺])
-
Fraction of HF:
HF = [H⁺] / (Ka + [H⁺])
Running the script generates:
-
hf_speciation.csv
→ Tabulated pH vs HF (%) and F⁻ (%) -
hf_speciation_plot.png
→ Plot of HF and F⁻ percentage vs pH
cd "path\to\HF Speciation Plot"