Skip to content

Commit 2d5043c

Browse files
committed
Make sure not to connect zeroed bonds.
1 parent 13d0fc0 commit 2d5043c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

python/BioSimSpace/Align/_merge.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def merge(
8989
merged : Sire.Mol.Molecule
9090
The merged molecule.
9191
"""
92+
from sire.legacy import CAS as _SireCAS
9293
from sire.legacy import Mol as _SireMol
9394
from sire.legacy import Base as _SireBase
9495
from sire.legacy import MM as _SireMM
@@ -1033,10 +1034,16 @@ def merge(
10331034

10341035
# Connect the bonded atoms in both end states.
10351036
for bond in edit_mol.property("bond0").potentials():
1036-
conn0.connect(bond.atom0(), bond.atom1())
1037+
# Only connect bonds with non-zero force constants.
1038+
ab = _SireMM.AmberBond(bond.function(), _SireCAS.Symbol("r"))
1039+
if ab.k() != 0.0:
1040+
conn0.connect(bond.atom0(), bond.atom1())
10371041
conn0 = conn0.commit()
10381042
for bond in edit_mol.property("bond1").potentials():
1039-
conn1.connect(bond.atom0(), bond.atom1())
1043+
# Only connect bonds with non-zero force constants.
1044+
ab = _SireMM.AmberBond(bond.function(), _SireCAS.Symbol("r"))
1045+
if ab.k() != 0.0:
1046+
conn1.connect(bond.atom0(), bond.atom1())
10401047
conn1 = conn1.commit()
10411048

10421049
# Get the original connectivity of the two molecules.

0 commit comments

Comments
 (0)