Skip to content

Conversation

@IAlibay
Copy link
Member

@IAlibay IAlibay commented Oct 12, 2025

  1. Move the validation to the validate method.
  2. Add a check to disallow net charged ligands.
  3. Fix some tests.

Checklist

  • Added a news entry

Developers certificate of origin

@IAlibay IAlibay changed the title [WIP] Fix validation in AHFE Protocol Fix validation in AHFE Protocol Oct 13, 2025
@codecov
Copy link

codecov bot commented Oct 13, 2025

Codecov Report

❌ Patch coverage is 97.75281% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.40%. Comparing base (78aee37) to head (5ae4d11).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../tests/protocols/openmm_ahfe/test_ahfe_settings.py 86.20% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1572      +/-   ##
==========================================
- Coverage   95.05%   93.40%   -1.66%     
==========================================
  Files         172      174       +2     
  Lines       14492    14537      +45     
==========================================
- Hits        13776    13578     -198     
- Misses        716      959     +243     
Flag Coverage Δ
fast-tests 93.40% <97.75%> (?)
slow-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Copy link
Contributor

@hannahbaumann hannahbaumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @IAlibay , this looks great! Only left two small comments.
Should we adapt the ABFE and SepTop protocols as well?

# Check that there are no protein components
if stateA.contains(ProteinComponent) or stateB.contains(ProteinComponent):
errmsg = ("Protein components are not allowed for "
"absolute solvation free energies")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe are not allowed in the AbsoluteSolvationProtocol to be more specific?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless you feel strongly about this, I would prefer not, couple of reasons:

  1. This entire thing gets subclassed by the ASFEProtocol in pontibus. So I expect it to be shared.
  2. The error will stem from execution of the transformation, so it should (hopefully) be obvious what Protocol is emitting the error.
  3. There are a lot of other warnings/errors all over the place that aren't that specific, especially if the above is untrue, that might need a rethink of how we do errors.

@IAlibay IAlibay requested a review from hannahbaumann October 14, 2025 10:35
@IAlibay
Copy link
Member Author

IAlibay commented Oct 14, 2025

Should we adapt the ABFE and SepTop protocols as well?

The ABFE Protocol also implements _validate (it's why this PR exists, I was fixing things for both at the same time since they share a ton of common components).

For SepTop and HybridTop, yes eventually but not for v1.7. As-in, I don't consider not having it a blocker for SepTop, and the HybridTop one would require more effort / rewritting (validation there is messy because it was our first Protocol).

Copy link
Contributor

@hannahbaumann hannahbaumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @IAlibay , lgtm!

* Solvent must always be present in both end states.
"""
# Check that there are no protein components
if stateA.contains(ProteinComponent) or stateB.contains(ProteinComponent):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love to see the new contains methods out in the wild!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both the contains and diff methods are very convenient!


def test_create_default_settings():
settings = AbsoluteSolvationProtocol.default_settings()
assert settings
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be checking some of these settings in case they are changed accidentally?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field deletion gets checked via serialization tests (under the results check and also the tokenization ones). Field addition (if non-optional) are also checked that way.

Field changes or new defaults aren't (they used to be via testing the GufeTokenizable key, but that wasn't stable). I'm not against testing some settings, but that probably should be done else on a settings by settings manner.

Copy link
Collaborator

@jthorton jthorton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@IAlibay IAlibay enabled auto-merge (squash) October 14, 2025 11:23
@atravitz atravitz added this to the v1.7.0 milestone Oct 14, 2025
@github-actions
Copy link

No API break detected ✅

@IAlibay IAlibay merged commit a2f08ac into main Oct 14, 2025
13 checks passed
@IAlibay IAlibay deleted the ahfe_net_charge branch October 14, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants