Skip to content

Commit

Permalink
Reconstruct intrascale matrices using the GroTop parser. [closes #213]
Browse files Browse the repository at this point in the history
  • Loading branch information
lohedges committed Dec 1, 2023
1 parent f5ac207 commit 645ad53
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
25 changes: 23 additions & 2 deletions python/BioSimSpace/IO/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,9 +1100,13 @@ def readPerturbableSystem(top0, coords0, top1, coords1, property_map={}):
# Flag that the molecule is perturbable.
mol.setProperty("is_perturbable", _SireBase.wrap(True))

# Get the two molecules.
mol0 = system0[idx]._sire_object
mol1 = system1[idx]._sire_object

# Add the molecule0 and molecule1 properties.
mol.setProperty("molecule0", system0[idx]._sire_object)
mol.setProperty("molecule1", system1[idx]._sire_object)
mol.setProperty("molecule0", mol0)
mol.setProperty("molecule1", mol1)

# Get the connectivity property name.
conn_prop = property_map.get("connectivity", "connectivity")
Expand All @@ -1121,6 +1125,23 @@ def readPerturbableSystem(top0, coords0, top1, coords1, property_map={}):
mol = mol.removeProperty(conn_prop + "0").molecule()
mol = mol.removeProperty(conn_prop + "1").molecule()

# Reconstruct the intrascale matrices using the GroTop parser.
intra0 = (
_SireIO.GroTop(_Molecule(mol0).toSystem()._sire_object)
.toSystem()[0]
.property("intrascale")
)
intra1 = (
_SireIO.GroTop(_Molecule(mol1).toSystem()._sire_object)
.toSystem()[0]
.property("intrascale")
)

# Set the "intrascale" properties.
intrascale_prop = property_map.get("intrascale", "intrascale")
mol.setProperty(intrascale_prop + "0", intra0)
mol.setProperty(intrascale_prop + "1", intra0)

# Commit the changes.
mol = _Molecule(mol.commit())

Expand Down
25 changes: 23 additions & 2 deletions python/BioSimSpace/Sandpit/Exscientia/IO/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,9 +1100,13 @@ def readPerturbableSystem(top0, coords0, top1, coords1, property_map={}):
# Flag that the molecule is perturbable.
mol.setProperty("is_perturbable", _SireBase.wrap(True))

# Get the two molecules.
mol0 = system0[idx]._sire_object
mol1 = system1[idx]._sire_object

# Add the molecule0 and molecule1 properties.
mol.setProperty("molecule0", system0[idx]._sire_object)
mol.setProperty("molecule1", system1[idx]._sire_object)
mol.setProperty("molecule0", mol0)
mol.setProperty("molecule1", mol1)

# Get the connectivity property name.
conn_prop = property_map.get("connectivity", "connectivity")
Expand All @@ -1121,6 +1125,23 @@ def readPerturbableSystem(top0, coords0, top1, coords1, property_map={}):
mol = mol.removeProperty(conn_prop + "0").molecule()
mol = mol.removeProperty(conn_prop + "1").molecule()

# Reconstruct the intrascale matrices using the GroTop parser.
intra0 = (
_SireIO.GroTop(_Molecule(mol0).toSystem()._sire_object)
.toSystem()[0]
.property("intrascale")
)
intra1 = (
_SireIO.GroTop(_Molecule(mol1).toSystem()._sire_object)
.toSystem()[0]
.property("intrascale")
)

# Set the "intrascale" properties.
intrascale_prop = property_map.get("intrascale", "intrascale")
mol.setProperty(intrascale_prop + "0", intra0)
mol.setProperty(intrascale_prop + "1", intra0)

# Commit the changes.
mol = _Molecule(mol.commit())

Expand Down

0 comments on commit 645ad53

Please sign in to comment.