Repository navigation
Allow reading of legacy restraint settings for SepTop #2237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| SepTopProtocol, | ||
| ) | ||
| from openfe.protocols.openmm_septop.equil_septop_settings import SepTopSettings | ||
| from openfe.protocols.restraint_utils.settings import BoreschRestraintSettings | ||
|
|
||
|
|
||
| @pytest.fixture() | ||
|
|
@@ -137,3 +138,29 @@ def test_adaptive_settings_with_protein_membrane(a2a_protein_membrane_component, | |
| assert isinstance(settings, SepTopSettings) | ||
| # Barostat should have been updated | ||
| assert settings.complex_integrator_settings.barostat == "MonteCarloMembraneBarostat" | ||
|
|
||
|
|
||
| def test_legacy_complex_restraint_settings(default_settings): | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might also make sense to just have a test somewhere that tries to load some legacy serialilzed Protocol?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think that could be useful, but maybe not blocking for this PR?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since opening this PR, our aim has changed from "concretely being able to support previous versions" to "just a shim to reduce the amount of work for this release". In that case, my view has changed to the following: adding the regression check isn't worth the time (edit: for a shim) - we can revisit this after the release if our strategy changes. |
||
| # Settings created before per-ligand complex restraints were introduced (openfe v1.13) | ||
| # used a single `complex_restraint_settings` field | ||
| legacy = dict(default_settings) | ||
| legacy.pop("complex_restraint_settings_A") | ||
| legacy.pop("complex_restraint_settings_B") | ||
| legacy["complex_restraint_settings"] = BoreschRestraintSettings(host_selection="name CA") | ||
|
|
||
| with pytest.warns(FutureWarning, match="complex_restraint_settings"): | ||
| settings = SepTopSettings(**legacy) | ||
|
|
||
| assert settings.complex_restraint_settings_A.host_selection == "name CA" | ||
| assert settings.complex_restraint_settings_B.host_selection == "name CA" | ||
| # A and B must not share the same object | ||
| assert settings.complex_restraint_settings_A is not settings.complex_restraint_settings_B | ||
|
|
||
|
|
||
| def test_legacy_complex_restraint_settings_mixed(default_settings): | ||
| # Mixing the legacy field with the new ones is not allowed | ||
| mixed = dict(default_settings) | ||
| mixed["complex_restraint_settings"] = BoreschRestraintSettings() | ||
|
|
||
| with pytest.raises(ValueError, match="complex_restraint_settings"): | ||
| SepTopSettings(**mixed) | ||
Uh oh!
There was an error while loading. Please reload this page.