From 954c5459c5808e192343fabf0850f77354a901e2 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Tue, 14 Nov 2023 09:52:18 +0000 Subject: [PATCH] Backport fixes from PR #203. [ci skip] --- .../Sandpit/Exscientia/Trajectory/_trajectory.py | 5 ++--- .../Sandpit/Exscientia/_SireWrappers/_system.py | 14 ++++++++++++-- python/BioSimSpace/Trajectory/_trajectory.py | 5 ++--- python/BioSimSpace/_SireWrappers/_system.py | 14 ++++++++++++-- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/python/BioSimSpace/Sandpit/Exscientia/Trajectory/_trajectory.py b/python/BioSimSpace/Sandpit/Exscientia/Trajectory/_trajectory.py index e3d747ca0..b49a05d7d 100644 --- a/python/BioSimSpace/Sandpit/Exscientia/Trajectory/_trajectory.py +++ b/python/BioSimSpace/Sandpit/Exscientia/Trajectory/_trajectory.py @@ -1120,11 +1120,10 @@ def _split_molecules(frame, pdb, reference, work_dir, property_map={}): # Create a triclinic space from the information in the frame file. if isinstance(frame, _SireIO.AmberRst7): - # Get the box dimensions and angles. Take the values, since the - # units are wrong. + # Get the box dimensions and angles. degree = _SireUnits.degree dimensions = [x.value() for x in frame.box_dimensions()] - angles = [x.value() * degree for x in frame.box_angles()] + angles = [x.to(degree) * degree for x in frame.box_angles()] box = _SireVol.TriclinicBox(*dimensions, *angles) else: box = _SireVol.TriclinicBox(frame.box_v1(), frame.box_v2(), frame.box_v3()) diff --git a/python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_system.py b/python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_system.py index 72c3cd4be..cafb3dde0 100644 --- a/python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_system.py +++ b/python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_system.py @@ -1218,7 +1218,10 @@ def rotateBoxVectors( try: prop_name = property_map.get("coordinates", "coordinates") cursor = cursor.rotate( - center=center, matrix=rotation_matrix, map={"coordinates": prop_name} + center=center, + matrix=rotation_matrix, + rotate_velocities=False, + map={"coordinates": prop_name}, ) except: pass @@ -1227,7 +1230,10 @@ def rotateBoxVectors( try: prop_name = property_map.get("velocity", "velocity") cursor = cursor.rotate( - center=center, matrix=rotation_matrix, map={"coordinates": prop_name} + center=center, + matrix=rotation_matrix, + rotate_velocities=False, + map={"coordinates": prop_name}, ) except: pass @@ -1240,12 +1246,14 @@ def rotateBoxVectors( cursor = cursor.rotate( center=center, matrix=rotation_matrix, + rotate_velocities=False, map={"coordinates": prop_name}, ) prop_name = property_map.get("coordinates", "coordinates") + "1" cursor = cursor.rotate( center=center, matrix=rotation_matrix, + rotate_velocities=False, map={"coordinates": prop_name}, ) except: @@ -1257,12 +1265,14 @@ def rotateBoxVectors( cursor = cursor.rotate( center=center, matrix=rotation_matrix, + rotate_velocities=False, map={"coordinates": prop_name}, ) prop_name = property_map.get("velocity", "velocity") + "1" cursor = cursor.rotate( center=center, matrix=rotation_matrix, + rotate_velocities=False, map={"coordinates": prop_name}, ) except: diff --git a/python/BioSimSpace/Trajectory/_trajectory.py b/python/BioSimSpace/Trajectory/_trajectory.py index e3d747ca0..b49a05d7d 100644 --- a/python/BioSimSpace/Trajectory/_trajectory.py +++ b/python/BioSimSpace/Trajectory/_trajectory.py @@ -1120,11 +1120,10 @@ def _split_molecules(frame, pdb, reference, work_dir, property_map={}): # Create a triclinic space from the information in the frame file. if isinstance(frame, _SireIO.AmberRst7): - # Get the box dimensions and angles. Take the values, since the - # units are wrong. + # Get the box dimensions and angles. degree = _SireUnits.degree dimensions = [x.value() for x in frame.box_dimensions()] - angles = [x.value() * degree for x in frame.box_angles()] + angles = [x.to(degree) * degree for x in frame.box_angles()] box = _SireVol.TriclinicBox(*dimensions, *angles) else: box = _SireVol.TriclinicBox(frame.box_v1(), frame.box_v2(), frame.box_v3()) diff --git a/python/BioSimSpace/_SireWrappers/_system.py b/python/BioSimSpace/_SireWrappers/_system.py index c6f0e52ed..0a5bf5157 100644 --- a/python/BioSimSpace/_SireWrappers/_system.py +++ b/python/BioSimSpace/_SireWrappers/_system.py @@ -1166,7 +1166,10 @@ def rotateBoxVectors( try: prop_name = property_map.get("coordinates", "coordinates") cursor = cursor.rotate( - center=center, matrix=rotation_matrix, map={"coordinates": prop_name} + center=center, + matrix=rotation_matrix, + rotate_velocities=False, + map={"coordinates": prop_name}, ) except: pass @@ -1175,7 +1178,10 @@ def rotateBoxVectors( try: prop_name = property_map.get("velocity", "velocity") cursor = cursor.rotate( - center=center, matrix=rotation_matrix, map={"coordinates": prop_name} + center=center, + matrix=rotation_matrix, + rotate_velocities=False, + map={"coordinates": prop_name}, ) except: pass @@ -1188,12 +1194,14 @@ def rotateBoxVectors( cursor = cursor.rotate( center=center, matrix=rotation_matrix, + rotate_velocities=False, map={"coordinates": prop_name}, ) prop_name = property_map.get("coordinates", "coordinates") + "1" cursor = cursor.rotate( center=center, matrix=rotation_matrix, + rotate_velocities=False, map={"coordinates": prop_name}, ) except: @@ -1205,12 +1213,14 @@ def rotateBoxVectors( cursor = cursor.rotate( center=center, matrix=rotation_matrix, + rotate_velocities=False, map={"coordinates": prop_name}, ) prop_name = property_map.get("velocity", "velocity") + "1" cursor = cursor.rotate( center=center, matrix=rotation_matrix, + rotate_velocities=False, map={"coordinates": prop_name}, ) except: