mirror of
https://github.com/OpenFreeEnergy/openfe.git
synced 2026-06-04 14:14:22 +08:00
Expose geometry objects as the BoreschRestraintGeometry objects (#1578)
* Expose geometry objects as the BoreschRestraintGeometry objects
This commit is contained in:
@@ -710,7 +710,7 @@ class SepTopProtocolResult(gufe.ProtocolResult):
|
||||
|
||||
return production_lengths
|
||||
|
||||
def restraint_geometries(self) -> tuple[list[dict[str, Any]], list[dict[str, Any]]]:
|
||||
def restraint_geometries(self) -> tuple[list[BoreschRestraintGeometry], list[BoreschRestraintGeometry]]:
|
||||
"""
|
||||
Get a list of the restraint geometries for the
|
||||
complex simulations. These define the atoms that have
|
||||
@@ -726,11 +726,15 @@ class SepTopProtocolResult(gufe.ProtocolResult):
|
||||
in the system that are involved in the restraint of ligand B.
|
||||
"""
|
||||
geometry_A = [
|
||||
pus[0].outputs["restraint_geometry_A"]
|
||||
BoreschRestraintGeometry.model_validate(
|
||||
pus[0].outputs["restraint_geometry_A"]
|
||||
)
|
||||
for pus in self.data["complex_setup"].values()
|
||||
]
|
||||
geometry_B = [
|
||||
pus[0].outputs["restraint_geometry_B"]
|
||||
BoreschRestraintGeometry.model_validate(
|
||||
pus[0].outputs["restraint_geometry_B"]
|
||||
)
|
||||
for pus in self.data["complex_setup"].values()
|
||||
]
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ from openfe.protocols.openmm_septop.equil_septop_method import (
|
||||
)
|
||||
from openfe.protocols.openmm_septop.utils import deserialize
|
||||
from openfe.protocols.openmm_utils import system_validation
|
||||
from openfe.protocols.restraint_utils.geometry.boresch import BoreschRestraintGeometry
|
||||
from openfe.tests.protocols.conftest import compute_energy
|
||||
from openff.units import unit as offunit
|
||||
from openff.units.openmm import ensure_quantity, from_openmm
|
||||
@@ -1434,7 +1435,12 @@ class TestProtocolResult:
|
||||
assert isinstance(geom, tuple)
|
||||
assert len(geom) == 2
|
||||
assert isinstance(geom[0], list)
|
||||
assert isinstance(geom[0][0], dict)
|
||||
assert list(geom[0][0].keys()) == [
|
||||
'guest_atoms', 'host_atoms', 'r_aA0', 'theta_A0', 'theta_B0', 'phi_A0', 'phi_B0', 'phi_C0',
|
||||
]
|
||||
assert isinstance(geom[0][0], BoreschRestraintGeometry)
|
||||
assert geom[0][0].guest_atoms == [1779, 1778, 1777]
|
||||
assert geom[0][0].host_atoms == [802, 801, 800]
|
||||
assert pytest.approx(geom[0][0].r_aA0) == 0.774170 * offunit.nanometer
|
||||
assert pytest.approx(geom[0][0].theta_A0) == 1.793181 * offunit.radian
|
||||
assert pytest.approx(geom[0][0].theta_B0) == 1.501008 * offunit.radian
|
||||
assert pytest.approx(geom[0][0].phi_A0) == 0.939174 * offunit.radian
|
||||
assert pytest.approx(geom[0][0].phi_B0) == -1.504071 * offunit.radian
|
||||
assert pytest.approx(geom[0][0].phi_C0) == -0.745093 * offunit.radian
|
||||
|
||||
Reference in New Issue
Block a user