equilibrate: exclude H and O from missing element check#355
Merged
rkingsbury merged 3 commits intomainfrom Feb 16, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #355 +/- ##
==========================================
- Coverage 86.27% 86.10% -0.17%
==========================================
Files 14 14
Lines 1821 1821
Branches 313 313
==========================================
- Hits 1571 1568 -3
- Misses 207 209 +2
- Partials 43 44 +1 ☔ View full report in Codecov by Sentry. 🚀 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.
Summary
This PR exempts elementsHandOfrom the "missing element" check that is performed inequilibrate, because PHREEQC may not necessarily includeH2O(aq)in its list of solutes, and thus could generate a false positive error when comparing the original and new total amounts of H and O.WIP - I am still trying to understand the source of this behavior. The numbers in the error message highlighted in #329 suggest that it's just a matter ofH2Onot being counted, but that doesn't seem to be the case from the tests I'm running so far.UPDATE: I found a cleaner solution. The cause was in fact that
phreeqc2026doesn't includeH2O(aq)in its returned list of components; howeverpyEQLwas already adding this back in as part of the volume rescaling logic; it was just doing so after the missing elements check. It actually makes sense to do it before the missing elements check anyway, and moving the volume rescaling up also prevents the false positive errors onHandOelements.