Skip to content

Membrane support#635

Merged
IAlibay merged 117 commits intomainfrom
membrane_prototype
Feb 12, 2026
Merged

Membrane support#635
IAlibay merged 117 commits intomainfrom
membrane_prototype

Conversation

@hannahbaumann
Copy link
Copy Markdown
Contributor

@hannahbaumann hannahbaumann commented Oct 9, 2025

This PR addresses following issues:

Tips

  • Comment "pre-commit.ci autofix" to have pre-commit.ci atomically format your PR.
    Since this will create a commit, it is best to make this comment when you are finished with your work.

Checklist

  • Added a news entry

Developers certificate of origin

@hannahbaumann hannahbaumann self-assigned this Oct 9, 2025
Comment thread gufe/components/proteincomponent.py Outdated
Comment thread gufe/components/proteincomponent.py Outdated
Comment thread gufe/settings/models.py Outdated
Comment thread gufe/tests/data/181l.pdb
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Example where gziping the PDB would make this diff hard

Comment thread gufe/components/proteincomponent.py Outdated
Comment thread gufe/components/proteincomponent.py Outdated
Comment thread gufe/settings/models.py Outdated
Comment thread gufe/components/proteincomponent.py Outdated
Copy link
Copy Markdown
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

Couple of small things, happy if the [nit] comments don't get addressed / are discarded.
Very close to merge imho.

Comment thread gufe/components/solvatedpdbcomponent.py Outdated

class SolvatedPDBComponent(ProteinComponent, BaseSolventComponent):
"""
Protein component with explicit solvent and box vectors.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Protein component with explicit solvent and box vectors.
Component with explicit solvent and box vectors.

Here and everywhere else, given this class is "SolvatedPDBComponent" maybe we shouldn't be saying Protein?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed this in the relevant places.

Comment thread gufe/components/solvatedpdbcomponent.py Outdated
Comment thread gufe/components/solvatedpdbcomponent.py Outdated
* ``box_vectors`` must be an OpenFF quantity with units.
* Box vectors are serialized and included in equality and hash checks.
* Construction will fail if box vectors cannot be determined as well as
if the RDKit molecule has only one disconnected fragment.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Am I correct in understanding this is no longer true?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, removed this here and elsewhere!

Comment thread gufe/components/solvatedpdbcomponent.py Outdated
* ``box_vectors`` must be an OpenFF quantity with units.
* Box vectors are serialized and included in equality and hash checks.
* Construction will fail if box vectors cannot be determined as well as
if the RDKit molecule has only one disconnected fragment.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Am I correct in understanding this is no longer true?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Remove this!

Comment thread gufe/components/solvatedpdbcomponent.py Outdated
Notes
-----
* ``box_vectors`` must be an OpenFF quantity with units.
* Box vectors are serialized and included in equality and hash checks.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[nit] This bit of the docstring is user facing, it's likely going to be a bit confusing to have this - I would remove this bullet point.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed this!

Comment thread gufe/components/solvatedpdbcomponent.py Outdated
If ``box_vectors`` is not an OpenFF Quantity.
ValueError
If ``box_vectors`` are not valid box vectors.
If the RDKit molecule contains only one disconnected fragment.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See above, is this still being done?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed this.

Comment thread gufe/components/solvatedpdbcomponent.py Outdated
if not _box_vectors_are_in_reduced_form(box):
raise ValueError(f"box_vectors: {box} are not in OpenMM reduced form")

@staticmethod
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[nit] cc @atravitz - given we don't really use these "water" methods in this class directly, thoughts on moving this to the membrane specific one?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm in favor of moving it to the membrane-specific one! Plus, it's easier to upstream something (non-api-breaking) than to make it more specific later (api-breaking)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved the water counting methods to the SolvatedPDBComponent.

<Atom name="H73" alt1="3H5M"/>
</Residue>
<Residue name="HOH" alt1="H20" alt2="WAT" alt3="SOL" alt4="TIP3" alt5="TP3">
<Residue name="HOH" alt1="H20" alt2="WAT" alt3="SOL" alt4="TIP3" alt5="TP3" alt6="T4P" alt7="SPC">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add an issue about this - we should try to get upstream to update this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Raised an issue here: openmm/openmm#5212

Copy link
Copy Markdown
Contributor

@atravitz atravitz left a comment

Choose a reason for hiding this comment

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

Looks good to me, just some non-blockin nits. Including that many of these tests are quite long (3-45 seconds, whereas most gufe unit tests are <1 second), which we've (so far) been able to avoid in gufe. If we want to get this PR merged though, I can work on speeding up the tests in a follow-up PR.

Comment thread gufe/components/solvatedpdbcomponent.py Outdated
if not _box_vectors_are_in_reduced_form(box):
raise ValueError(f"box_vectors: {box} are not in OpenMM reduced form")

@staticmethod
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm in favor of moving it to the membrane-specific one! Plus, it's easier to upstream something (non-api-breaking) than to make it more specific later (api-breaking)

# 3. Infer box vectors if requested
if infer_box_vectors:
box = cls._estimate_box(structure, padding=box_padding)
warnings.warn(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dotsdl - logging question: since this a class method and there is no tokenizable instantiated yet - is this the preferred way to warn?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this makes the most sense, yes. As you said, there is no logger for the GufeTokenizable since it hasn't been instantiated yet, so our best bet is to use warnings here.

Copy link
Copy Markdown
Contributor

@atravitz atravitz left a comment

Choose a reason for hiding this comment

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

added two change suggestions that should fix docs @hannahbaumann!

Comment thread gufe/vendor/openff/interchange/_packmol.py Outdated
Comment thread gufe/components/solvatedpdbcomponent.py Outdated
@hannahbaumann
Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

...

def validate(self, **kwargs):
def validate(self):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the **kwargs to make mypy happy, alternatively I could also add the **kwargs in the validate in the child class, but I'm not sure if it's necessary?

Comment thread gufe/components/solvatedpdbcomponent.py
Copy link
Copy Markdown
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

Just the one last thing.

Comment thread gufe/components/solvatedpdbcomponent.py Outdated
@github-actions
Copy link
Copy Markdown

No API break detected ✅

@IAlibay IAlibay merged commit abc987d into main Feb 12, 2026
14 checks passed
@IAlibay IAlibay deleted the membrane_prototype branch February 12, 2026 19:56
@atravitz atravitz mentioned this pull request Feb 13, 2026
atravitz added a commit that referenced this pull request Mar 2, 2026
* Add an ExplicitPDBComponent and a ProteinMembraneComponent
* Fix the residue names for PDB reading to also include T4P and SPC

---------

Co-authored-by: Alyssa Travitz <31974495+atravitz@users.noreply.github.com>
Co-authored-by: Josh Horton <Josh.Horton@newcastle.ac.uk>
Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com>
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.

Membrane support: User supplied box vectors Create a SolvatedPDBComponent Membrane support: Error handling, e.g. if no solvent is present

6 participants