Merge branch 'main' into default_atom_mapper

This commit is contained in:
Josh Horton
2025-10-08 09:41:41 +01:00
committed by GitHub
8 changed files with 291 additions and 6 deletions

View File

@@ -87,17 +87,17 @@ jobs:
- name: "Install"
run: python -m pip install --no-deps -e .
- name: "Test imports"
run: |
# if we add more to this, consider changing to for + env vars
python -Ic "import openfe; print(openfe.__version__)"
- name: "Environment Information"
run: |
micromamba info
micromamba list
pip list
- name: "Test imports"
run: |
# if we add more to this, consider changing to for + env vars
python -Ic "import openfe; print(openfe.__version__)"
- name: "Run tests"
env:
# Set the OFE_SLOW_TESTS to True if running a Cron job

View File

@@ -21,7 +21,7 @@ specs:
- pytest-xdist
# python needs to match https://github.com/googlecolab/backend-info/blob/main/os-info.txt
# until colab pushes a fix
- python 3.11.12
- python 3.12.11
# Not building an .exe for windows or a .pkg for macOS
installer_type: sh

View File

@@ -4,6 +4,25 @@ Changelog
.. current developments
v1.6.1
====================
This release includes minor fixes and updates to tests.
**Added:**
* Added a cookbook for using ``jq`` to inspect JSON files.
**Changed:**
* Remove unnecessary limit on residues ids (``resids``) when getting mappings from topology in ``topology_helpers.py`` utility module.
* The relative hybrid topology protocol no longer runs the FIRE minimizer when ``dry=True``.
**Fixed:**
* Updated tests to expect to find NAGL, now that it is supported.
v1.6.0
====================
This release adds support for OpenMM 8.3.0 and Python 3.13.

View File

@@ -0,0 +1,23 @@
**Added:**
* <news item>
**Changed:**
* An improved error message is now shown when a mapping involving a changing constraint length cannot be fixed (PR `#1529 <https://github.com/OpenFreeEnergy/openfe/pull/1529>`_).
**Deprecated:**
* <news item>
**Removed:**
* <news item>
**Fixed:**
* <news item>
**Security:**
* <news item>

View File

@@ -430,6 +430,8 @@ def _remove_constraints(old_to_new_atom_map, old_system, old_topology,
* Very slow, needs refactoring
* Can we drop having topologies as inputs here?
"""
from collections import Counter
no_const_old_to_new_atom_map = deepcopy(old_to_new_atom_map)
h_elem = app.Element.getByAtomicNumber(1)
@@ -499,6 +501,18 @@ def _remove_constraints(old_to_new_atom_map, old_system, old_topology,
to_del.append(pick_H(i, j, x, y))
# count the number of times each atom appears
to_del_counts = Counter(to_del)
# if a H-atom appears more than once, it means it was involved in
# multiple different constraints at the end states but that the atom is in the core region
# this should not happen
for idx, count in to_del_counts.items():
if count > 1:
# this is raised before we hit the KeyError below
raise ValueError(f"Atom {idx} was involved in {count} unique constraints "
f" that changed between the two end-states. This should not happen for core "
f"atoms, please check your atom mapping. Please raise an issue on the openfe github with "
f"the steps to reproduce this error for more help.")
for idx in to_del:
del no_const_old_to_new_atom_map[idx]

View File

@@ -0,0 +1,99 @@
1832577-09-9
RDKit 3D
42 44 0 0 0 0 0 0 0 0999 V2000
-10.5334 -24.7004 10.8465 C 0 0 0 0 0 0 0 0 0 0 0 0
-12.2375 -23.4317 11.9659 C 0 0 0 0 0 0 0 0 0 0 0 0
-8.0781 -15.7676 14.8202 C 0 0 0 0 0 0 0 0 0 0 0 0
-11.4686 -25.7088 10.6839 C 0 0 0 0 0 0 0 0 0 0 0 0
-10.9226 -23.5382 11.5125 C 0 0 0 0 0 0 0 0 0 0 0 0
-13.1112 -24.4951 11.7511 C 0 0 0 0 0 0 0 0 0 0 0 0
-7.6176 -15.0858 13.6901 C 0 0 0 0 0 0 0 0 0 0 0 0
-8.3276 -17.0469 14.3752 C 0 0 0 0 0 0 0 0 0 0 0 0
-8.9990 -19.1925 14.2702 C 0 0 0 0 0 0 0 0 0 0 0 0
-8.7389 -19.3130 12.8049 C 0 0 0 0 0 0 0 0 0 0 0 0
-8.1967 -18.2212 12.2237 C 0 0 0 0 0 0 0 0 0 0 0 0
-10.0695 -21.3590 12.4332 C 0 0 0 0 0 0 0 0 0 0 0 0
-6.6229 -18.7823 10.3075 C 0 0 0 0 0 0 0 0 0 0 0 0
-9.4574 -17.7523 8.9592 C 0 0 0 0 0 0 0 0 0 0 0 0
-7.9112 -18.0842 10.7331 C 0 0 1 0 0 0 0 0 0 0 0 0
-14.5419 -24.4050 12.1861 C 0 0 0 0 0 0 0 0 0 0 0 0
-12.7444 -25.6344 11.1183 N 0 0 0 0 0 0 0 0 0 0 0 0
-7.5397 -15.8574 12.6119 N 0 0 0 0 0 0 0 0 0 0 0 0
-8.8095 -18.1459 15.0128 N 0 0 0 0 0 0 0 0 0 0 0 0
-8.0014 -17.0717 13.0171 N 0 0 0 0 0 0 0 0 0 0 0 0
-9.9582 -22.5164 11.6556 N 0 0 0 0 0 0 0 0 0 0 0 0
-9.0189 -20.4821 12.1403 N 0 0 0 0 0 0 0 0 0 0 0 0
-10.9683 -21.1116 13.2336 O 0 0 0 0 0 0 0 0 0 0 0 0
-9.0133 -18.6233 9.9903 O 0 0 0 0 0 0 0 0 0 0 0 0
-14.8129 -23.3365 12.9853 F 0 0 0 0 0 0 0 0 0 0 0 0
-15.3944 -24.3052 11.1299 F 0 0 0 0 0 0 0 0 0 0 0 0
-14.9390 -25.5006 12.8886 F 0 0 0 0 0 0 0 0 0 0 0 0
-7.1927 -13.4497 13.6054 Cl 0 0 0 0 0 0 0 0 0 0 0 0
-9.5246 -24.8290 10.4673 H 0 0 0 0 0 0 0 0 0 0 0 0
-12.6096 -22.5382 12.4512 H 0 0 0 0 0 0 0 0 0 0 0 0
-8.2318 -15.3930 15.8221 H 0 0 0 0 0 0 0 0 0 0 0 0
-11.2061 -26.6332 10.1807 H 0 0 0 0 0 0 0 0 0 0 0 0
-9.3567 -20.1035 14.7754 H 0 0 0 0 0 0 0 0 0 0 0 0
-6.6919 -19.8701 10.4066 H 0 0 0 0 0 0 0 0 0 0 0 0
-5.7650 -18.4293 10.8885 H 0 0 0 0 0 0 0 0 0 0 0 0
-6.4262 -18.5845 9.2476 H 0 0 0 0 0 0 0 0 0 0 0 0
-10.2928 -18.2284 8.4403 H 0 0 0 0 0 0 0 0 0 0 0 0
-8.6511 -17.5717 8.2429 H 0 0 0 0 0 0 0 0 0 0 0 0
-9.8072 -16.8053 9.3830 H 0 0 0 0 0 0 0 0 0 0 0 0
-7.8052 -17.0236 10.4761 H 0 0 0 0 0 0 0 0 0 0 0 0
-9.0700 -22.6660 11.1835 H 0 0 0 0 0 0 0 0 0 0 0 0
-8.5590 -20.6256 11.2464 H 0 0 0 0 0 0 0 0 0 0 0 0
1 4 2 0
1 5 1 0
2 5 2 0
2 6 1 0
3 7 1 0
3 8 2 0
4 17 1 0
5 21 1 0
6 16 1 0
6 17 2 0
7 18 2 0
7 28 1 0
8 19 1 0
8 20 1 0
9 10 1 0
9 19 2 0
10 11 2 0
10 22 1 0
11 15 1 0
11 20 1 0
12 21 1 0
12 22 1 0
12 23 2 0
13 15 1 0
14 24 1 0
15 24 1 0
16 25 1 0
16 26 1 0
16 27 1 0
18 20 1 0
1 29 1 0
2 30 1 0
3 31 1 0
4 32 1 0
9 33 1 0
13 34 1 0
13 35 1 0
13 36 1 0
14 37 1 0
14 38 1 0
14 39 1 0
15 40 1 6
21 41 1 0
22 42 1 0
M END
> <atom.dprop.PartialCharge> (1)
-0.28232385714285713 -0.21832385714285713 -0.27862385714285715 0.42117614285714289 0.10657614285714286 0.34757614285714289 0.39957614285714288 0.34647614285714284 0.41317614285714288
-0.16672385714285712 0.064376142857142854 0.75507614285714286 -0.10212385714285714 0.10967614285714286 0.19037614285714288 0.59957614285714289 -0.63702385714285714 -0.51012385714285713
-0.61002385714285712 0.054176142857142853 -0.46912385714285715 -0.43812385714285712 -0.58612385714285709 -0.38862385714285713 -0.22632385714285713 -0.22632385714285713 -0.22632385714285713
-0.042323857142857142 0.14797614285714286 0.19997614285714288 0.19197614285714287 0.036076142857142855 0.032076142857142852 0.06534314285714285 0.06534314285714285 0.06534314285714285
0.036343142857142852 0.036343142857142852 0.036343142857142852 0.063676142857142862 0.31947614285714288 0.30447614285714286
$$$$

View File

@@ -0,0 +1,97 @@
Pfizer-01-01
RDKit 3D
41 43 0 0 0 0 0 0 0 0999 V2000
-10.4516 -24.7374 10.8592 C 0 0 0 0 0 0 0 0 0 0 0 0
-8.0415 -15.7554 14.6861 C 0 0 0 0 0 0 0 0 0 0 0 0
-12.1995 -23.5068 11.9598 C 0 0 0 0 0 0 0 0 0 0 0 0
-11.3650 -25.7538 10.6519 C 0 0 0 0 0 0 0 0 0 0 0 0
-7.6252 -15.0904 13.5309 C 0 0 0 0 0 0 0 0 0 0 0 0
-10.8751 -23.5938 11.5374 C 0 0 0 0 0 0 0 0 0 0 0 0
-13.0474 -24.5795 11.6985 C 0 0 0 0 0 0 0 0 0 0 0 0
-8.3405 -17.0307 14.2671 C 0 0 0 0 0 0 0 0 0 0 0 0
-9.0021 -19.1792 14.2556 C 0 0 0 0 0 0 0 0 0 0 0 0
-8.7289 -19.3573 12.8025 C 0 0 0 0 0 0 0 0 0 0 0 0
-8.2349 -18.2799 12.1537 C 0 0 0 0 0 0 0 0 0 0 0 0
-10.0585 -21.4037 12.4667 C 0 0 0 0 0 0 0 0 0 0 0 0
-9.1650 -17.7186 9.8701 C 0 0 0 0 0 0 0 0 0 0 0 0
-6.6506 -17.6895 10.1921 C 0 0 0 0 0 0 0 0 0 0 0 0
-7.9771 -18.2985 10.6433 C 0 0 0 0 0 0 0 0 0 0 0 0
-14.4786 -24.5193 12.1303 C 0 0 0 0 0 0 0 0 0 0 0 0
-12.6493 -25.7028 11.0565 N 0 0 0 0 0 0 0 0 0 0 0 0
-7.6436 -15.8678 12.4511 N 0 0 0 0 0 0 0 0 0 0 0 0
-8.8156 -18.1033 14.9523 N 0 0 0 0 0 0 0 0 0 0 0 0
-8.0598 -17.0872 12.8947 N 0 0 0 0 0 0 0 0 0 0 0 0
-9.9191 -22.5788 11.7247 N 0 0 0 0 0 0 0 0 0 0 0 0
-8.9690 -20.5680 12.2086 N 0 0 0 0 0 0 0 0 0 0 0 0
-11.0007 -21.1080 13.1964 O 0 0 0 0 0 0 0 0 0 0 0 0
-15.1528 -23.4749 11.5765 F 0 0 0 0 0 0 0 0 0 0 0 0
-15.1768 -25.6365 11.7900 F 0 0 0 0 0 0 0 0 0 0 0 0
-14.6164 -24.3881 13.4776 F 0 0 0 0 0 0 0 0 0 0 0 0
-9.4316 -24.8426 10.5033 H 0 0 0 0 0 0 0 0 0 0 0 0
-8.1283 -15.3694 15.6916 H 0 0 0 0 0 0 0 0 0 0 0 0
-12.5978 -22.6339 12.4625 H 0 0 0 0 0 0 0 0 0 0 0 0
-11.0765 -26.6639 10.1381 H 0 0 0 0 0 0 0 0 0 0 0 0
-7.3103 -14.0623 13.4264 H 0 0 0 0 0 0 0 0 0 0 0 0
-9.3639 -20.0703 14.7933 H 0 0 0 0 0 0 0 0 0 0 0 0
-9.3154 -16.6559 10.0803 H 0 0 0 0 0 0 0 0 0 0 0 0
-10.0909 -18.2494 10.1233 H 0 0 0 0 0 0 0 0 0 0 0 0
-9.0120 -17.8326 8.7910 H 0 0 0 0 0 0 0 0 0 0 0 0
-6.6454 -16.5986 10.2486 H 0 0 0 0 0 0 0 0 0 0 0 0
-6.4604 -17.9536 9.1452 H 0 0 0 0 0 0 0 0 0 0 0 0
-5.8198 -18.0816 10.7876 H 0 0 0 0 0 0 0 0 0 0 0 0
-7.9000 -19.3380 10.3085 H 0 0 0 0 0 0 0 0 0 0 0 0
-9.0114 -22.7367 11.2938 H 0 0 0 0 0 0 0 0 0 0 0 0
-8.4315 -20.8010 11.3813 H 0 0 0 0 0 0 0 0 0 0 0 0
1 4 2 0
1 6 1 0
2 5 1 0
2 8 2 0
3 6 2 0
3 7 1 0
4 17 1 0
5 18 2 0
6 21 1 0
7 16 1 0
7 17 2 0
8 19 1 0
8 20 1 0
9 10 1 0
9 19 2 0
10 11 2 0
10 22 1 0
11 15 1 0
11 20 1 0
12 21 1 0
12 22 1 0
12 23 2 0
13 15 1 0
14 15 1 0
16 24 1 0
16 25 1 0
16 26 1 0
18 20 1 0
1 27 1 0
2 28 1 0
3 29 1 0
4 30 1 0
5 31 1 0
9 32 1 0
13 33 1 0
13 34 1 0
13 35 1 0
14 36 1 0
14 37 1 0
14 38 1 0
15 39 1 0
21 40 1 0
22 41 1 0
M END
> <atom.dprop.PartialCharge> (1)
-0.24122690243902437 -0.29752690243902435 -0.26022690243902435 0.41927309756097564 0.37157309756097562 0.10867309756097562 0.35167309756097564 0.3465730975609756 0.45327309756097561
-0.13062690243902439 0.019473097560975618 0.77017309756097563 -0.094026902439024382 -0.094026902439024382 -0.016326902439024384 0.59867309756097564 -0.63792690243902439
-0.56402690243902442 -0.61792690243902437 0.051273097560975624 -0.4700269024390244 -0.44502690243902437 -0.59702690243902434 -0.22855990243902438 -0.22855990243902438 -0.22855990243902438
0.19107309756097562 0.18307309756097562 0.16007309756097562 0.039173097560975624 0.055873097560975624 0.059173097560975621 0.048940097560975622 0.048940097560975622 0.048940097560975622
0.048940097560975622 0.048940097560975622 0.048940097560975622 0.045773097560975619 0.32057309756097563 0.31257309756097562
$$$$

View File

@@ -1451,6 +1451,39 @@ class TestConstraintRemoval:
else:
assert 'A: 1-6 B: 2-8' in str(e)
def test_double_constraint_fail(self):
# make sure catch cases where a H is involved with two different unique constraints in the end states
# see <https://github.com/OpenFreeEnergy/openfe/issues/1093>
with resources.as_file(resources.files('openfe.tests.data.openmm_rfe')) as d:
fn1 = str(d / 'malt1_shapefit_Pfizer-01-01.sdf')
fn2 = str(d / 'malt1_shapefit_1832577-09-9.sdf')
lig1 = openfe.SmallMoleculeComponent.from_sdf_file(fn1)
lig2 = openfe.SmallMoleculeComponent.from_sdf_file(fn2)
# mapping taken from issue
mapping = setup.LigandAtomMapping(
componentA=lig1,
componentB=lig2,
componentA_to_componentB={
26: 28, 27: 30, 28: 29, 29: 31, 30: 27, 31: 32, 32: 38, 34: 13, 39: 40, 40: 41, 0: 0, 1: 2, 2: 1, 3: 3,
4: 6, 5: 4, 6: 5, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 23, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18,
19: 19, 20: 20, 21: 21, 22: 22
}
)
stateA_topology, stateA_system, stateB_topology, stateB_system = self.make_systems(
lig1, lig2, constraints=app.HBonds
)
with pytest.raises(ValueError, match="Atom 34 was involved in 2 unique constraints"):
_ = openmm_rfe._rfe_utils.topologyhelpers._remove_constraints(
mapping.componentA_to_componentB,
stateA_system, stateA_topology,
stateB_system, stateB_topology,
)
@pytest.fixture(scope='session')
def tyk2_xml(tmp_path_factory):