Import QM outputs (Gaussian, Turbomole, ORCA, ...) via cclib - #101
Merged
Conversation
Add an optional `qm` extra (cclib) and a cclib-backed reader that consumes a frequency calculation from any cclib-supported program (Gaussian, Turbomole, ORCA, Psi4, NWChem, ...): - read_cclib(path) -> (ase.Atoms, frequencies cm^-1, energy Hartree), using cclib's atomcoords (Angstrom), vibfreqs (cm^-1) and best available energy (ccenergies/mpenergies/scfenergies, converted eV -> Hartree). - cclib_thermo(output_file, energy=None, ...) runs the RRHO thermochemistry via run_thermo (energy defaults to cclib's, overridable). cclib is imported lazily, so the core install (and the conda-forge recipe) is unchanged; a clear error asks for `thermoscreening[qm]` when it's absent. Closes #100
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #101 +/- ##
==========================================
+ Coverage 97.12% 97.19% +0.06%
==========================================
Files 29 30 +1
Lines 1811 1852 +41
==========================================
+ Hits 1759 1800 +41
Misses 52 52
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cclib 2.0 is a breaking rearchitecture (data model / units); cap the qm (and test) extra below it since the reader targets the 1.x model. Note in read_cclib that cclib supplies only the real modes, so the geometry's linearity classification must match the QM program's mode count.
galjos
added a commit
that referenced
this pull request
Jul 7, 2026
PySCF is a Python library, so its results are in memory rather than a file. This adds `pyscf_thermo(mean_field, ...)` to complete the QM-import set (Gaussian/Turbomole/ORCA via cclib in #101; ORCA `.hess` in #99). - Reads the geometry (Bohr → Å) and energy (`mean_field.e_tot`) from a converged PySCF mean-field object. - Vibrational frequencies come from `frequencies=` (cm⁻¹) or are derived from `hessian=` via `pyscf.hessian.thermo.harmonic_analysis`. - Optional `pyscf` extra (`pip install thermoscreening[pyscf]`); **pyscf is imported lazily** so the core install and conda-forge recipe are unaffected, with a clear error when it's needed but missing. So `reduction_potential(pyscf_thermo(mf_ox, hessian=h_ox), pyscf_thermo(mf_red, hessian=h_red))` works for a PySCF redox pair. Tested with a duck-typed fake mean field (no real pyscf needed): frequencies path + energy-from-`e_tot`, energy override, the hessian branch (helper mocked), the requires-frequencies-or-hessian error, and the missing-pyscf error (forced via `sys.modules`). Docs + full patch coverage. Closes #102
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Consume DFT frequency calculations from many programs through cclib, which auto-detects the format — so Gaussian and Turbomole (and ORCA, Psi4, NWChem, …) are covered by one reader.
qmextra (pip install thermoscreening[qm]→ cclib). cclib is imported lazily, soimport ThermoScreening, the core deps, and the conda-forge recipe are all unchanged; a clear error asks for the extra when it's missing.read_cclib(path)→(ase.Atoms, frequencies cm⁻¹, energy Hartree)using cclib'satomcoords(Å),vibfreqs(cm⁻¹) and the best available energy (ccenergies→mpenergies→scfenergies, converted eV → Hartree).cclib_thermo(output_file, energy=None, ...)runs the RRHO thermochemistry viarun_thermo(energy defaults to cclib's, overridable).So
reduction_potential(cclib_thermo("ox.log"), cclib_thermo("red.log"))works for a Gaussian (or Turbomole/ORCA/…) redox pair on DFT energetics.Verified against cclib 1.8.1's documented units (
atomcoordsÅ,vibfreqscm⁻¹,scfenergieseV). Tested (parse + eV→Hartree, energy priority cc/mp/scf, unparseable/no-frequency/missing-dependency errors, end-to-endcclib_thermo+ override + requires-energy). Docs + full patch coverage on the new code.Closes #100