Skip to content

Commit e2f0b9a

Browse files
committed
Handle intrascale merging for GLYCAM molecules.
1 parent 99cef0d commit e2f0b9a

2 files changed

Lines changed: 28 additions & 14 deletions

File tree

src/BioSimSpace/Align/_merge.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def merge(
9090
The merged molecule.
9191
"""
9292
from sire.legacy import CAS as _SireCAS
93+
from sire.legacy import IO as _SireIO
9394
from sire.legacy import MM as _SireMM
9495
from sire.legacy import Base as _SireBase
9596
from sire.legacy import Mol as _SireMol
@@ -1178,23 +1179,22 @@ def merge(
11781179
edit_mol.set_property("connectivity0", conn0)
11791180
edit_mol.set_property("connectivity1", conn1)
11801181

1181-
# Create the CLJNBPairs matrices.
1182-
ff = molecule0.property(ff0)
1183-
1184-
# Create the new intrascale matrices.
1185-
scale_factor_14 = _SireMM.CLJScaleFactor(
1186-
ff.electrostatic14_scale_factor(), ff.vdw14_scale_factor()
1182+
# Merge the intrascale properties of the two molecules.
1183+
merged_intrascale = _SireIO.mergeIntrascale(
1184+
molecule0.property("intrascale"),
1185+
molecule1.property("intrascale"),
1186+
edit_mol.info(),
1187+
mol0_merged_mapping,
1188+
mol1_merged_mapping,
11871189
)
1188-
clj_nb_pairs0 = _SireMM.CLJNBPairs(conn0, scale_factor_14)
1189-
clj_nb_pairs1 = _SireMM.CLJNBPairs(conn1, scale_factor_14)
11901190

11911191
# Store the two molecular components.
11921192
edit_mol.set_property("molecule0", molecule0)
11931193
edit_mol.set_property("molecule1", molecule1)
11941194

11951195
# Set the "intrascale" properties.
1196-
edit_mol.set_property("intrascale0", clj_nb_pairs0)
1197-
edit_mol.set_property("intrascale1", clj_nb_pairs1)
1196+
edit_mol.set_property("intrascale0", merged_intrascale[0])
1197+
edit_mol.set_property("intrascale1", merged_intrascale[1])
11981198

11991199
# Set the "forcefield" properties.
12001200
edit_mol.set_property("forcefield0", molecule0.property(ff0))

tests/Align/test_align.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,24 @@ def test_invalid_prematch(system0, system1, prematch):
7474
)
7575

7676

77-
def test_merge():
78-
# Load the ligands.
79-
s0 = BSS.IO.readMolecules([f"{url}/ligand31.prm7.bz2", f"{url}/ligand31.rst7.bz2"])
80-
s1 = BSS.IO.readMolecules([f"{url}/ligand38.prm7.bz2", f"{url}/ligand38.rst7.bz2"])
77+
@pytest.mark.parametrize(
78+
"s0_files,s1_files",
79+
[
80+
(
81+
[f"{url}/ligand31.prm7.bz2", f"{url}/ligand31.rst7.bz2"],
82+
[f"{url}/ligand38.prm7.bz2", f"{url}/ligand38.rst7.bz2"],
83+
),
84+
pytest.param(
85+
[f"{url}/glycam_M5.gro.bz2", f"{url}/glycam_M5.top.bz2"],
86+
[f"{url}/glycam_M5G0.gro.bz2", f"{url}/glycam_M5G0.top.bz2"],
87+
marks=pytest.mark.slow,
88+
),
89+
],
90+
)
91+
def test_merge(s0_files, s1_files):
92+
# Load the molecules.
93+
s0 = BSS.IO.readMolecules(s0_files)
94+
s1 = BSS.IO.readMolecules(s1_files)
8195

8296
# Extract the molecules.
8397
m0 = s0.getMolecules()[0]

0 commit comments

Comments
 (0)