diff --git a/pycgtool/frame.py b/pycgtool/frame.py index e7ede1c6f8b34eb9faf73d843ab12480775d6c97..8aa727576916d4dd1abcbf1e41017737cb0a3ff0 100644 --- a/pycgtool/frame.py +++ b/pycgtool/frame.py @@ -119,6 +119,10 @@ class Frame: self.time = traj.time + # Cast unitcell vectors to float32 to avoid warning - they're currently float64 + if traj.unitcell_vectors is not None: + traj.unitcell_vectors = traj.unitcell_vectors.astype(np.float32) + @property def residues(self): """Residues in the frame topology.""" @@ -204,7 +208,7 @@ class Frame: def build_trajectory(self) -> None: """Build an MDTraj trajectory from atom coordinates and the values stored as attributes on this frame.""" - xyz = np.array([atom.coords for atom in self._topology.atoms]) + xyz = np.array([atom.coords for atom in self._topology.atoms], dtype=np.float32) # We currently have axes: 0 - each atom, 1 - timestep, 2 - xyz coords # Need to convert to axes: 0 - timestep, 1 - each atom, 2 - xyz coords diff --git a/test/test_bondset.py b/test/test_bondset.py index aa34785b9403dc91d49d76a6f71c6762cf3f0ba0..d990b52a0ed5adda04e2ae5dec1bcb8dda606134 100644 --- a/test/test_bondset.py +++ b/test/test_bondset.py @@ -1,9 +1,9 @@ -import unittest import math import os import pathlib import tempfile +import unittest from pycgtool.bondset import BondSet from pycgtool.frame import Frame