Skip to content

Commit 0b9b29f

Browse files
committed
Rotate perturbable and non-perturbable molecules independently.
[closes #354]
1 parent 37ec978 commit 0b9b29f

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_system.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,8 +1238,9 @@ def rotateBoxVectors(
12381238

12391239
from sire.system import System
12401240

1241-
# Create a cursor.
1242-
cursor = System(self._sire_object).cursor()
1241+
# Create a cursor for the non-perturbable molecules.
1242+
system = System(self._sire_object)
1243+
cursor = system["not property is_perturbable"].cursor()
12431244

12441245
# Rotate all vector properties.
12451246

@@ -1267,8 +1268,15 @@ def rotateBoxVectors(
12671268
except:
12681269
pass
12691270

1271+
# Update the molecules in the system.
1272+
system.update(cursor.commit())
1273+
self._sire_object = system._system
1274+
12701275
# Now deal with any perturbable molecules.
12711276
if self.nPerturbableMolecules() > 0:
1277+
# Create a cursor for the perturbable molecules.
1278+
cursor = system["property is_perturbable"].cursor()
1279+
12721280
# Coordinates.
12731281
try:
12741282
prop_name = property_map.get("coordinates", "coordinates") + "0"
@@ -1307,8 +1315,9 @@ def rotateBoxVectors(
13071315
except:
13081316
pass
13091317

1310-
# Commit the changes.
1311-
self._sire_object = cursor.commit()._system
1318+
# Update the perturbable molecules in the system.
1319+
system.update(cursor.commit())
1320+
self._sire_object = system._system
13121321

13131322
def reduceBoxVectors(self, bias=0, property_map={}):
13141323
"""

python/BioSimSpace/_SireWrappers/_system.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,8 +1186,9 @@ def rotateBoxVectors(
11861186

11871187
from sire.system import System
11881188

1189-
# Create a cursor.
1190-
cursor = System(self._sire_object).cursor()
1189+
# Create a cursor for the non-perturbable molecules.
1190+
system = System(self._sire_object)
1191+
cursor = system["not property is_perturbable"].cursor()
11911192

11921193
# Rotate all vector properties.
11931194

@@ -1215,8 +1216,15 @@ def rotateBoxVectors(
12151216
except:
12161217
pass
12171218

1219+
# Update the molecules in the system.
1220+
system.update(cursor.commit())
1221+
self._sire_object = system._system
1222+
12181223
# Now deal with any perturbable molecules.
12191224
if self.nPerturbableMolecules() > 0:
1225+
# Create a cursor for the perturbable molecules.
1226+
cursor = system["property is_perturbable"].cursor()
1227+
12201228
# Coordinates.
12211229
try:
12221230
prop_name = property_map.get("coordinates", "coordinates") + "0"
@@ -1255,8 +1263,9 @@ def rotateBoxVectors(
12551263
except:
12561264
pass
12571265

1258-
# Commit the changes.
1259-
self._sire_object = cursor.commit()._system
1266+
# Update the perturbable molecules in the system.
1267+
system.update(cursor.commit())
1268+
self._sire_object = system._system
12601269

12611270
def reduceBoxVectors(self, bias=0, property_map={}):
12621271
"""

0 commit comments

Comments
 (0)