Add in-memory thermochemistry from PySCF results - #103
Merged
Conversation
Add pyscf_thermo(mean_field, ...) which reads the geometry (Bohr -> Angstrom) and energy (mf.e_tot) from a converged PySCF mean-field object and runs the RRHO thermochemistry, taking vibrational frequencies directly or deriving them from a Hessian via pyscf.hessian.thermo. Optional pyscf extra; pyscf is imported lazily so the core install is unaffected. Closes #102
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #103 +/- ##
==========================================
+ Coverage 97.19% 97.22% +0.02%
==========================================
Files 30 30
Lines 1852 1872 +20
==========================================
+ Hits 1800 1820 +20
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:
|
harmonic_analysis defaults to imaginary_freq=True (complex wavenumbers), which np.real would flatten to ~0 and silently turn a saddle point into a minimum. Pass imaginary_freq=False so imaginary modes are negative reals, matching the other engines. Add a skippable real-pyscf test validating the harmonic_analysis path returns the 3N-6 real vibrational modes for water.
Intercept the import itself instead of a sys.modules sentinel, which a prior import of pyscf.hessian.thermo (e.g. the real integration test) would defeat via the fromlist hasattr shortcut.
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.
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.hessin #99).mean_field.e_tot) from a converged PySCF mean-field object.frequencies=(cm⁻¹) or are derived fromhessian=viapyscf.hessian.thermo.harmonic_analysis.pyscfextra (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 viasys.modules). Docs + full patch coverage.Closes #102