Let pKa/redox helpers consume conformer ensembles via EnsembleThermo - #119
Merged
Conversation
pKa, calibrate_proton_reference, reduction_potential, and reaction_free_energy all duck-type on total_EeGtot() -- EnsembleThermo wraps ensemble_free_energy() behind that same method, so a conformer ensemble can be passed directly instead of picking a single conformer. Verified end-to-end with real xtb-cli GFN2-xTB calculations on 4-hydroxybutanoic acid, which (unlike smaller/more rigid acids) RDKit generates several genuinely distinct conformers for.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #119 +/- ##
=======================================
Coverage 97.31% 97.31%
=======================================
Files 32 32
Lines 1935 1940 +5
=======================================
+ Hits 1883 1888 +5
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:
|
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.
`pKa`, `calibrate_proton_reference`, `reduction_potential`, and `reaction_free_energy` all duck-type on a single argument's `total_EeGtot()` -- they never inspect the type, just call that one method. `ensemble.py` already has proper Boltzmann-weighting (`boltzmann_weights`, `ensemble_free_energy`, `lowest_gibbs`), but `ensemble_free_energy` returns a bare float, so there was no way to plug a conformer ensemble directly into those helpers -- today's usage docs pick a single conformer (`generate(..., max_conformers=1)`) for exactly that reason.
The fix
`EnsembleThermo(thermos, temperature=298.15)` wraps `ensemble_free_energy` behind a `.total_EeGtot()` method, so it duck-types as a `Thermo` and can be passed anywhere a single `Thermo` is expected today -- no changes needed to pka.py or reactions.py themselves.
Verification
Closes #118