Fast Rust parser, thermochemistry toolkit, and dataset exporter for Gaussian (03/09/16), ORCA (3.x–6.x), Q-Chem (4.x–6.x), Psi4, xTB, Gaussian .fchk, and VASP (OUTCAR / vasprun.xml). Ships as a single zero-dependency Python wheel (pip / uvx), a standalone native CLI binary (kohn-cli), and a Rust library crate (kohn-core).
- 4.96 GB/s parallel throughput (369x faster than
cclib): parses 229 real logs (216.6 MB across Gaussian, ORCA, Q-Chem, Psi4, and xTB) in 44 ms using whole-buffer SIMDAhoCorasickscanning. - Transparent
.gzand.zstarchives plus compound multi-job splitting (--Link1--,$new_job, Q-Chem multi-job). - Constant-memory streaming export to Zstd Parquet (summary or per-step
--trajectories), ASE-compatibleextxyz(with periodicLattice/stressand sign-normalized forces ineV/Å),xyz,jsonl, andcsv, plus direct pure-Rust NumPy.npzandcjsonexport. - Zero-copy Arrow C Data Interface (
__arrow_c_stream__) straight into Polars (pl.DataFrame(batch)) and PyArrow (pa.table(batch)). - Built-in chemistry CLI: Grimme quasi-RRHO thermochemistry and Boltzmann conformer weighting (
kohn thermo), Kabsch all/heavy-atom RMSD comparison (kohn diff), Unicode Braille IR/Raman/UV-Vis spectra (kohn spectrum), and cluster auditing for failures, imaginary modes,<S²>spin contamination, and RMSD duplicates (kohn check). - Parses modern logs that crash
cclib 1.8.1(ORCA 6.0/6.1, Apple Silicon Gaussian 16, Q-Chem 6.1, xTB 6.7.1) while keepingcclibattribute names and units.
# Run CLI directly without installing
uvx kohn inspect molecule.out
# Install Python library + CLI (zero required runtime dependencies)
pip install kohn
# uv add kohn
# Or install the standalone native Rust binary from source (no Python needed)
cargo install --git https://github.com/levimackay/kohn kohn-cliOptional Python adapters .to_numpy() and kohn.ccread() work whenever numpy is installed; pl.DataFrame(batch) and pa.table(batch) work zero-copy with Polars and PyArrow.
| Format | Files | Highlights |
|---|---|---|
| Gaussian (03 / 09 / 16) | .log, .out |
SP, Opt, Freq, HPModes, TD-DFT, ONIOM, --Link1--, Kabsch-rotated forces, <S²>, Raman, NMR, polarizability, solvation |
| ORCA (3.x / 4.x / 5.x / 6.x) | .out, .log |
SCF + DFT-D dispersion, MP2/CCSD(T), UHF, vibrations + IR/Raman, TD-DFT/CASSCF, <S²>, NMR, polarizability, CPCM/SMD |
| Q-Chem (4.x / 5.x / 6.x) | .out |
Opt, multi-block gradients, MP2/RI-MP2/CCSD(T), vibrations + IR/Raman, TD-DFT/RPA, polarizability, Mulliken/Lowdin/Hirshfeld/CHELPG |
| Psi4 (0.5 / 1.x) | .out |
RHF/UHF/ROHF/DFT, DF-MP2, CCSD(T), Opt, Freq, thermochemistry, Mulliken/Lowdin/MBIS charges |
| xTB (6.5 / 6.7) | .out |
GFN0/1/2-xTB & GFN-FF, XYZ/SDF/Turbomole geometries, ALPB/GBSA solvation, orbitals, dipole, polarizability, thermochemistry |
| Gaussian FChk | .fchk, .fch |
Exact double-precision coordinates, multi-step opt geometries/gradients, MOs, charges, dipole, polarizability, Vib-E2/Vib-Modes |
| VASP | OUTCAR, vasprun.xml |
Periodic cells, per-step ionic trajectories, forces (eV/Å), Voigt stress (kBar), Fermi energy, band gap, magnetization |
All formats can be read directly from .gz or .zst compressed files without decompressing to disk. VASP support is currently verified on synthetic VASP 5/6 fixtures; bug reports with real OUTCAR or vasprun.xml files are welcome.
# Inspect any supported log (auto-detected, color + convergence sparkline on TTY)
kohn inspect dvb_ir.out
kohn inspect OUTCAR --json
# Audit a cluster directory for crashes, unconverged opts, imaginary freqs,
# spin contamination (|<S²> - S(S+1)| > 0.1), and RMSD duplicate conformers
kohn check ./calcs/ --recursive --fail-on-imag --max-s2-dev 0.10 --dedup-rmsd 0.05
# Grimme quasi-RRHO (w0 = 100 cm⁻¹) Boltzmann conformer table (with 1 atm -> 1 M shift)
kohn thermo ./conformers/ --recursive --conc 1.0 -T 298.15
# Reaction thermochemistry or Eyring transition-state barrier
kohn thermo --reactants r1.out r2.out --products ts.out --ts -T 298.15
# Compare two calculations: dE, dH, dG_qRRHO, Kabsch all/heavy-atom RMSD
kohn diff conf_a.out conf_b.out
# Plot Lorentzian IR / Raman or Gaussian UV-Vis spectrum in the terminal (or --csv / --json)
kohn spectrum dvb_ir.out --type ir
kohn spectrum tddft.out --type uv --fwhm 0.35
# Query properties across a directory
kohn get formula,functional,basis_set,final_energy_ha,homo_lumo_gap_ev ./calcs/ -r --json
# Stream-export logs to Parquet or ASE extXYZ in constant memory, or write packed NumPy NPZ
kohn export ./calcs/ -o dataset.parquet --recursive
kohn export ./calcs/ -o frames.parquet --trajectories --recursive --chunk-size 256
kohn export ./calcs/ -o mlip.extxyz --trajectories --recursive
kohn export ./calcs/ -o mlip.npz --trajectories --recursive
# Shell completions (bash, zsh, fish, powershell, elvish)
kohn completions zsh > _kohn$ kohn inspect dvb_ir.out
dvb_ir.out [ORCA 4.2.0] status=OK
Method: b3lyp / STO-3G
Formula: C10H10 (20 atoms, 130.19 Da) Charge: 0 Mult: 1 Steps: 1
Final SCF: -382.05075804 Ha (-10396.130743 eV)
HOMO-LUMO: 5.1834 eV
Dipole: 0.0000 Debye
Thermo (Ha): ZPVE=0.177015 H=-381.863892 G=-381.906781 G_qRRHO=-381.907435 T=298.15 K
Vibrations: 54 modes min=45.75 cm^-1 imaginary=0
Wall time: 26.99 s
$ kohn spectrum dvb_ir.out --type ir --width 58 --height 10
IR Spectrum — C10H10 (dvb_ir.out)
94.1 ┤⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
47.1 ┤⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⠀⠀⠀⠀⠀⠀⠀⠀⠀
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠀⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡆⢰⡇⡀⢀⠀⠀⠀⣿⠀⣿⢸⡀⠀⠀⠀⠀⠀⠀⠀
0.0 ┤⣀⣀⣀⣀⣀⣀⣀⣀⡜⠁⠱⣄⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣄⣀⡼⢧⠼⠧⠷⠿⣀⣠⣠⠿⠤⠛⠎⢧⣀⢦⣀⣀⣀⡾⣀
└┬────────────────────────────┬───────────────────────────┬
4000 2200 400
Wavenumber (cm^-1)
Peaks: 3395 (94.1), 977 (36.0), 896 (27.0), 1104 (21.4), 1510 (16.0)
import kohn
import numpy as np
import polars as pl
# Parse any supported log (plain, .gz, or .zst)
calc = kohn.read("molecule.out.gz")
print(calc.package, calc.functional, calc.basis_set, calc.final_energy_ha)
print(calc.s2, calc.s2_deviation, calc.homo_lumo_gap_ev)
# Split compound multi-job files (--Link1-- / $new_job)
jobs = kohn.read_all("opt_then_freq.log")
# Parallel directory parse -> zero-copy Polars DataFrame
batch = kohn.read_dir("./calcs/", recursive=True)
df = pl.DataFrame(batch)
# Per-step MLIP training trajectories (coords, forces, cells, stress)
traj_df = pl.DataFrame(kohn.read_dir("./calcs/", recursive=True, trajectories=True))
# Streaming constant-memory export to Parquet/extXYZ, or packed NumPy NPZ
rows, parsed, errors = kohn.export("./calcs/", "dataset.parquet", recursive=True, chunk_size=256)
kohn.export("./calcs/", "dataset.npz", recursive=True, trajectories=True)
npz = np.load("dataset.npz") # N, ptr, Z, R, E, F (eV/A), Q, optional cell & stress
# Built-in Grimme qRRHO thermochemistry, Boltzmann ensemble, Kabsch RMSD, and spectra
th = kohn.thermo(calc, temperature=298.15, concentration=1.0)
ens = kohn.boltzmann(batch.items(), temperature=298.15)
rmsd = kohn.rmsd(calc_a, calc_b)
ir = kohn.spectrum(calc, kind="ir", fwhm=20.0)
# Drop-in cclib-style namespace (requires numpy)
data = kohn.ccread("molecule.out")Measured with scripts/benchmark_cclib.py on Apple Silicon (M-series, Python 3.13, cclib 1.8.1, kohn 0.1.0) across 229 real logs (216.6 MB total) from cclib-data (Gaussian09, Gaussian16, ORCA4.2, ORCA5.0, QChem4.2–6.0, Psi4-beta5–1.2, XTB6.5.1):
| Workload | cclib 1.8.1 |
kohn 0.1.0 |
Throughput | Speedup |
|---|---|---|---|---|
| 229 files, single-threaded | 16.130 s | 0.147 s | 1,472 MB/s | 109.6x |
229 files, parallel (read_files) |
16.130 s | 0.044 s | 4,958 MB/s | 369.2x |
srtlg.out (Q-Chem, 31.8 MB) |
766.0 ms | 9.08 ms | 3,506 MB/s | 84.4x |
2D-PES-one-unconverged.log (Gaussian, 25.2 MB) |
2,518.4 ms | 17.69 ms | 1,426 MB/s | 142.4x |
g_from_issue_756.log (Gaussian, 17.7 MB) |
270.6 ms | 4.48 ms | 3,944 MB/s | 60.4x |
longer-input.out (ORCA, 17.1 MB) |
1,748.6 ms | 21.61 ms | 790 MB/s | 80.9x |
issue_460.log (Gaussian, 15.0 MB) |
1,379.8 ms | 10.07 ms | 1,493 MB/s | 137.0x |
Verified locally against cclib 1.8.1 across 244 real logs in cclib/cclib-data (Gaussian09/16, ORCA4.2–6.1, QChem4.2–6.1, Psi4-beta5–1.2, XTB6.5–6.7) using scripts/parity_cclib.py, plus all 8 real .fchk files under FChk/:
- 230 files compared directly (
cclib 1.8.1crashed on 13 files across ORCA 6.0/6.1, Apple Silicon Gaussian 16, Q-Chem 6.1, and xTB 6.7.1;kohnparsed all 244 files with 0 errors in 205 ms). - 2,623 / 2,659 attribute checks passed (98.6%), including 100.0% on
atomnos,charge,mult,natom,charge_mulliken,charge_lowdin,charge_hirshfeld,vibfreqs,zpve,entropy,temperature, andpressure. - Psi4: 366 / 366 checks passed (100.0%). FChk: 8 / 8 real files match companion logs within
1e-9 eV. - Most of the 36 remaining raw diffs stem from known
cclib 1.8.1bugs wherekohnis physically exact (ONIOM extrapolated vs MM layer energy, constrained-atom ORCA gradient dropping atom 1, abutting fixed-width Q-Chem MOs turning intoNaN, and SOS-CIS(D0) negative excitation energies). - Physical constants use CODATA 2018 (
1 Ha = 27.211386245988 eV,1 Bohr = 0.529177210903 Å).
| Category | Attributes | Units |
|---|---|---|
| Metadata | package, package_version, functional, basis_set, solvent_model, solvent, success, optdone, formula, molecular_weight, charge, mult, natom, nbasis, nmo, scf_cycles, geovalues, wall_time_s |
Da, seconds |
| Geometry & Forces | atomnos, atomcoords, grads, forces_ev_ang |
Z, Å, Hartree/Bohr (grads), eV/Å (forces_ev_ang, uniform F = -dE/dR) |
| Periodic (VASP) | cell, cells, stress, fermi_energy_ev, band_gap_ev, total_magnetization |
Å, kBar (Voigt), eV, μB |
| Energies | scfenergies, mpenergies, ccenergies, final_energy_ev, final_energy_ha |
eV (final_energy_ha in Hartree) |
| Thermochemistry | zpve, enthalpy, freeenergy, entropy, temperature, pressure |
Hartree, Hartree/K, K, atm |
| Orbitals & Spin | moenergies, homos, homo_lumo_gap_ev, s2, s2_after, expected_s2, s2_deviation |
eV, 0-based index |
| Charges & Response | atomcharges (mulliken, lowdin, hirshfeld, apt, chelpg, esp, npa, cm5, mbis, eeq), dipole, dipole_magnitude, polarizability, isotropic_polarizability, nmr_shielding |
e, Debye, Bohr³, ppm |
| Vibrations | vibfreqs, vibirs, vibramans, vibdisps, min_vibfreq, num_imaginary_freqs |
cm⁻¹, km/mol, Å⁴/amu, ΔÅ |
| Excited States | etenergies, etoscs, etrotats |
cm⁻¹, dimensionless, 10⁻⁴⁰ erg·esu·cm/Gauss |
# Rust tests, formatting, lints, and standalone CLI binary
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace --exclude kohn-py
cargo build -p kohn-cli --release
# Build Python extension & run pytest
uv venv
uv pip install maturin pytest numpy polars pyarrow ruff
uv run --no-project maturin develop --release
uv run --no-project pytest
uv run --no-project ruff check python tests scriptsIf you use kohn in published research, use GitHub's "Cite this repository" button (backed by CITATION.cff) or cite:
@software{mackay2026kohn,
author = {Mackay, Levi},
title = {kohn},
version = {0.1.0},
year = {2026},
url = {https://github.com/levimackay/kohn}
}See CONTRIBUTING.md for local build instructions and parser guidelines, CHANGELOG.md for release history, and SECURITY.md for reporting security issues privately.
Dual-licensed under MIT or Apache-2.0.