Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
0aa83f3
Membrane support prototype
hannahbaumann Oct 9, 2025
ceba9b1
Some test fixes
hannahbaumann Oct 9, 2025
425be62
Remove unnecessary import
hannahbaumann Oct 10, 2025
b5ea786
Merge branch 'main' into membrane_prototype
hannahbaumann Oct 13, 2025
83ba020
Merge branch 'main' into membrane_prototype
hannahbaumann Oct 20, 2025
a220ced
Test out changes to pdbstructure for maestro compatibility
hannahbaumann Oct 23, 2025
4ee605b
Merge branch 'main' into membrane_prototype
hannahbaumann Oct 29, 2025
b86b2da
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 29, 2025
042f0a6
Merge branch 'main' into membrane_prototype
hannahbaumann Oct 31, 2025
1d27e15
Add unknown ions
hannahbaumann Oct 31, 2025
a89bc19
Merge branch 'main' into membrane_prototype
hannahbaumann Nov 26, 2025
9c3ce0a
Add infer_box_vectors
hannahbaumann Dec 12, 2025
ca4766b
Small fix
hannahbaumann Dec 12, 2025
9662b3e
Deserialize box
hannahbaumann Dec 12, 2025
8fd337a
Make box vectors non-optional
hannahbaumann Dec 12, 2025
840ac35
Add mdtraj to env
hannahbaumann Dec 12, 2025
5950398
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 12, 2025
4ef38a7
mypy fix
hannahbaumann Dec 12, 2025
ffd7883
Merge branch 'membrane_prototype' of github.com:OpenFreeEnergy/gufe i…
hannahbaumann Dec 12, 2025
f3a3964
Try fixing mypy again
hannahbaumann Dec 12, 2025
f74750c
Merge branch 'main' into modify_pdbstructure
hannahbaumann Dec 15, 2025
5fae83e
Merge branch 'membrane_prototype' into modify_pdbstructure
hannahbaumann Dec 15, 2025
f3cda78
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 15, 2025
a547062
Remove unnecessary wrapping
hannahbaumann Jan 6, 2026
b731143
Merge branch 'main' into membrane_prototype
hannahbaumann Jan 6, 2026
bb142d8
Add a BaseSolventComponent
hannahbaumann Jan 8, 2026
38d2d7d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 8, 2026
ac062bb
Merge BaseSolventComponent
hannahbaumann Jan 8, 2026
20a5c08
Add SolvatedPDBComponent
hannahbaumann Jan 8, 2026
3e9237f
Remove membrane settings in thermosettings
hannahbaumann Jan 9, 2026
027fbe7
Small fix
hannahbaumann Jan 9, 2026
7cbc27c
Add to init
hannahbaumann Jan 9, 2026
acd737e
Update test
hannahbaumann Jan 12, 2026
ebbbca7
Small fix
hannahbaumann Jan 12, 2026
a76ee19
Small fix2
hannahbaumann Jan 12, 2026
dcfb355
Adding more tests
hannahbaumann Jan 12, 2026
6ad338d
Add more tests
hannahbaumann Jan 12, 2026
3832453
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 12, 2026
4bcea73
Adding more tests and refactoring SOlvatedPDBComponent
hannahbaumann Jan 13, 2026
fbffc98
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 13, 2026
58ee35b
Refactor box_vectors to be openff units instead
hannahbaumann Jan 13, 2026
9592af6
Rename periodic_box_vectors to box_vectors
hannahbaumann Jan 13, 2026
5323908
Add validation
hannahbaumann Jan 13, 2026
0461a33
Test out vendoring box check
hannahbaumann Jan 13, 2026
793ced4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 13, 2026
dc36336
Fix tests and add more tests
hannahbaumann Jan 13, 2026
f18b9d2
Try to make tests faster
hannahbaumann Jan 13, 2026
c1ab249
use openff units codec (#706)
atravitz Jan 14, 2026
ac085a6
Remove mdtraj dependency
hannahbaumann Jan 14, 2026
6310b98
add reference to openmm docs for reduced box comment
hannahbaumann Jan 14, 2026
1ca2ef4
Add helper method for pdb/pdbx loading
hannahbaumann Jan 14, 2026
154ba94
Change from_openmmPDBFile
hannahbaumann Jan 14, 2026
2d7cd19
Handle cryo-em box special case
hannahbaumann Jan 14, 2026
1a3490f
Add more explanation to the doc string
hannahbaumann Jan 14, 2026
22aeb9c
Merge remote-tracking branch 'origin/base_solvent_component' into mem…
hannahbaumann Jan 14, 2026
c9d04fd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 14, 2026
04ed4fd
Add and update tests
hannahbaumann Jan 14, 2026
66ed92f
Small fix
hannahbaumann Jan 14, 2026
47d50cd
Fail if structure only contains a single fragment
hannahbaumann Jan 14, 2026
77f411b
Update doc string
hannahbaumann Jan 14, 2026
20d0dcd
Add warning for ignoring 1 A^3 case box vectors file
hannahbaumann Jan 14, 2026
07ccc81
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 14, 2026
c766096
Add warning inferred box
hannahbaumann Jan 14, 2026
07bced8
Update warning message
hannahbaumann Jan 14, 2026
7a8966e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 14, 2026
ec13568
Merge branch 'main' into membrane_prototype
hannahbaumann Jan 22, 2026
bd5989c
Merge branch 'main' into membrane_prototype
hannahbaumann Jan 23, 2026
aea6f83
Add doc string ProteinMembraneComponent
hannahbaumann Jan 23, 2026
e2f5931
Merge branch 'membrane_prototype' of github.com:OpenFreeEnergy/gufe i…
hannahbaumann Jan 23, 2026
07f0387
Add density validation check
hannahbaumann Jan 23, 2026
32c3055
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 23, 2026
99782b7
Mypy stuff
hannahbaumann Jan 23, 2026
fb12f90
Merge branch 'membrane_prototype' of github.com:OpenFreeEnergy/gufe i…
hannahbaumann Jan 23, 2026
78b10c1
Merge branch 'main' into membrane_prototype
hannahbaumann Jan 26, 2026
52a8d16
gzip a2a test files
hannahbaumann Jan 26, 2026
f16a508
Merge branch 'membrane_prototype' of github.com:OpenFreeEnergy/gufe i…
hannahbaumann Jan 26, 2026
35aa82e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 26, 2026
7ce298f
Test removing circ import
hannahbaumann Jan 26, 2026
511de64
Put SolvatedPDBComponent into separate file
hannahbaumann Jan 26, 2026
d4e5948
Add files
hannahbaumann Jan 26, 2026
66eda24
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 26, 2026
00de01b
Update gufe/components/solvatedpdbcomponent.py
hannahbaumann Jan 28, 2026
216f3b4
Add quantity type
hannahbaumann Jan 28, 2026
8d5166b
Merge branch 'membrane_prototype' of github.com:OpenFreeEnergy/gufe i…
hannahbaumann Jan 28, 2026
0a4a5a7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 29, 2026
882716d
Add warnings for low number of water molecules
hannahbaumann Feb 2, 2026
b0e5c95
Merge branch 'membrane_prototype' of github.com:OpenFreeEnergy/gufe i…
hannahbaumann Feb 2, 2026
36d3225
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2026
133811b
Test counting waters
hannahbaumann Feb 2, 2026
d473138
use case instead
hannahbaumann Feb 2, 2026
e0019d3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2026
b766d5c
Merge branch 'main' into membrane_prototype
hannahbaumann Feb 3, 2026
436d3cf
add test for three atoms, no water case
hannahbaumann Feb 3, 2026
0812fdf
Merge branch 'membrane_prototype' of github.com:OpenFreeEnergy/gufe i…
hannahbaumann Feb 3, 2026
5e8918b
Add missing import
hannahbaumann Feb 3, 2026
a0e46e2
Add box padding
hannahbaumann Feb 3, 2026
2186d47
Add addtional water resnames
hannahbaumann Feb 4, 2026
e9892a4
Format
hannahbaumann Feb 4, 2026
73ebdc5
Merge branch 'membrane_prototype' into modify_pdbstructure
hannahbaumann Feb 4, 2026
28fce52
handle maestro hex36
hannahbaumann Feb 4, 2026
313d302
Some fixes
hannahbaumann Feb 4, 2026
907448c
Another fix
hannahbaumann Feb 4, 2026
ecc6219
some more changes
hannahbaumann Feb 6, 2026
2a52600
Merge branch 'main' into modify_pdbstructure
hannahbaumann Mar 16, 2026
eeda36f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions gufe/tests/test_pdbstructure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from io import StringIO

from gufe.vendor.pdb_file.pdbstructure import PdbStructure, _parse_atom_index


def test_hex_conect_parsing():
pdb_snippet = """ATOM 99999 C LIG A 1 0.000 0.000 0.000 1.00 0.00 C
ATOM A000F N LIG A 2 1.000 0.000 0.000 1.00 0.00 N
ATOM A000G O LIG A 3 0.000 1.000 0.000 1.00 0.00 O
CONECT99999A000FA000G"""

f = StringIO(pdb_snippet)
pdb = PdbStructure(f, load_all_models=True)

# Collect all atom serial numbers, including Maestro-style
atom_serials = [atom.serial_number for atom in pdb.iter_atoms(use_all_models=True)]

# There should be 3 atoms
assert len(atom_serials) == 3

# All serial numbers should be integers and unique
for serial in atom_serials:
assert isinstance(serial, int)
assert len(set(atom_serials)) == 3

# Convert the known Maestro-style indices to integers
a000f_serial = _parse_atom_index("A000F")
a000g_serial = _parse_atom_index("A000G")
assert a000f_serial in atom_serials
assert a000g_serial in atom_serials

# Check that CONECT records refer to the correct integers
conects = pdb._current_model.connects
assert len(conects) == 1
central, bonded1, bonded2 = conects[0]
assert central == 99999
# The bonded atoms match the converted Maestro-style serials
assert bonded1 in [a000f_serial, a000g_serial]
assert bonded2 in [a000f_serial, a000g_serial]
assert bonded1 != bonded2

known_hex_serials = ["A000G", "A000F"]
for hex_serial in known_hex_serials:
idx = _parse_atom_index(hex_serial)
assert isinstance(idx, int)
assert idx >= 100000
44 changes: 31 additions & 13 deletions gufe/vendor/pdb_file/pdbstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,16 @@ def _load(self, input_stream):
if command == "ATOM " or command == "HETATM":
self._add_atom(Atom(pdb_line, self, self.extraParticleIdentifier))
elif command == "CONECT":
atoms = [_parse_atom_index(pdb_line[6:11])]
for pos in (11, 16, 21, 26):
try:
atoms.append(_parse_atom_index(pdb_line[pos : pos + 5]))
except:
pass
self._current_model.connects.append(atoms)
try:
atoms = [_parse_atom_index(pdb_line[6:11])]
for pos in (11, 16, 21, 26):
try:
atoms.append(_parse_atom_index(pdb_line[pos : pos + 5]))
except:

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.

We should catch an exception here

pass
self._current_model.connects.append(atoms)
except:

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.

We should catch an exception here

pass
# Notice MODEL punctuation, for the next level of detail
# in the structure->model->chain->residue->atom->position hierarchy
elif pdb_line[:5] == "MODEL":
Expand Down Expand Up @@ -1060,12 +1063,27 @@ def __str__(self):
return str(self.position)


def _parse_atom_index(index):
"""Parse the string containing an atom index, which might be either decimal or hex."""
try:
return int(index)
except:
return int(index, 16) - 0xA0000 + 100000
def _parse_atom_index(index: str) -> int:

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'd rather this function raise a custom exception that we then catch when we call it instead of a bare except

"""
Parse an atom serial index from a PDB file, supporting:
- Decimal numbers (e.g., 12345)
- Standard hex (0–9, A–F)
- Maestro-style extended hex (letters beyond F, e.g., A000G)
"""
index = index.strip()

# Try decimal, then hex, then Maestro base36

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.

MH: check for a G to see what base we are using, and then use the same base for the entire file and we should be fine

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.

Just to add a bit more from slack:
It is possible that a base36 might not have a G, in which case the decimal value we convert when we use base16 would be "wrong" but if we use the same base to convert everything into decimal, then things will be internally consistent (for things like CONNECT records).

It also might be nice to have the parsing function take in a base as an argument, so that if a user supplies us a base, we can just use that value.

We can then use another function to guess the base if a user doesn't give us one, then pass that base to the parsing function.

for base in (10, 16, 36):
try:
val = int(index, base)
if val >= 0xA0000:
val = val - 0xA0000 + 100000

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.

Can we add some ( )to make it more clear the order of operations here?

return val
except ValueError:
continue

raise ValueError(f"Unable to parse atom index: '{index}'")



# run module directly for testing
Expand Down
Loading