From 0eaf08c18f3cd7621447e1dc49d518cb036f5feb Mon Sep 17 00:00:00 2001 From: ajdittmann Date: Tue, 26 Nov 2024 00:15:08 -0500 Subject: [PATCH] fixed periodic parameter indexing issues --- nautilus/bounds/periodic.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nautilus/bounds/periodic.py b/nautilus/bounds/periodic.py index f77c84f..6d2ae18 100644 --- a/nautilus/bounds/periodic.py +++ b/nautilus/bounds/periodic.py @@ -39,10 +39,10 @@ def compute(cls, points, periodic): bound.periodic = periodic bound.centers = np.zeros(len(periodic)) - for dim in periodic: + for i, dim in enumerate(periodic): x = np.sort(points[:, dim]) dx = np.append(np.diff(x), x[0] - (x[-1] - 1)) - bound.centers[dim] = ( + bound.centers[i] = ( x[np.argmax(dx)] + np.amax(dx) / 2.0 + 0.5) % 1 return bound @@ -66,9 +66,9 @@ def transform(self, points, inverse=False): """ points_t = np.copy(points) - for dim in self.periodic: + for i, dim in enumerate(self.periodic): points_t[:, dim] = (points_t[:, dim] + (-1 if inverse else +1) * - (-self.centers[dim] + 0.5)) % 1 + (-self.centers[i] + 0.5)) % 1 return points_t def write(self, group):