Skip to content

PhreeqcEOS inherits from Phreeqc2026EOS#351

Merged
rkingsbury merged 7 commits intomainfrom
vb/issue329b
Feb 14, 2026
Merged

PhreeqcEOS inherits from Phreeqc2026EOS#351
rkingsbury merged 7 commits intomainfrom
vb/issue329b

Conversation

@vineetbansal
Copy link
Collaborator

This is to address the concern in issue #329:

Also, I realized that the bulk of the equilibrate logic still lives in NativeEOS. Can we please refactor that so that what's currently in NativeEOS.equilibrate moves to PhreeqcEOS.equilibrate, and then NativeEOS.equilibrate() just calls it. That will make it easier to make the switch to Phreeqc2026 on next release.

To do this, the class hierarchy needs to be tweaked so that PhreeqcEOS now descends from Phreeqc2026EOS (and thus doesn't need its own .equilibrate()). The progression of commits should make this clear.

This means a temporary increase in code volume a bit, because NativeEOS and PhreeqcEOS which are now in different branches of the class hierarchy might do similar things for certain methods, but hopefully this is not a concern since PhreeqcEOS will go away.

@vineetbansal
Copy link
Collaborator Author

vineetbansal commented Feb 13, 2026

EDIT: A further change has been made here, where Phreeqc2026EOS inherits from NativeEOS instead of EOS (since their .equilibrate() methods are identical and Phreeqc2026EOS implements everything else it needs). That way we're left with a single concrete implementation of .equilibrate(), and the the entire hierarchy is linear except for IdealEOS which is a special case.

EOS <- IdealEOS
EOS <- NativeEOS <- Phreeqc2026EOS <- PhreeqcEOS

Note that what prompted this initially:

Can we please refactor that so that what's currently in NativeEOS.equilibrate moves to PhreeqcEOS.equilibrate, and then NativeEOS.equilibrate() just calls it. That will make it easier to make the switch to Phreeqc2026 on next release.

I guess you meant effectively:

Can we please refactor that so that what's currently in PhreeqcEOS.equilibrate moves to NativeEOS.equilibrate, and then PhreeqcEOS.equilibrate() just calls it. That will make it easier to make the switch to Phreeqc2026 on next release.

We can only calls methods that are "up" the chain, and cannot easily remove any classes in the future that have any descendants, so this makes it easy going forward.

… are identical). PhreeqcEOS has its own _destroy_ppsol (identical to NativeEOS but differs slightly from Phreeqc2026EOS).
@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 76.47059% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.36%. Comparing base (23fc5fe) to head (806b876).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
src/pyEQL/engines.py 75.75% 13 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #351      +/-   ##
==========================================
- Coverage   86.31%   85.36%   -0.96%     
==========================================
  Files          14       14              
  Lines        1856     1858       +2     
  Branches      322      322              
==========================================
- Hits         1602     1586      -16     
- Misses        208      226      +18     
  Partials       46       46              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants