Skip to content

Commit

Permalink
fixed periodic parameter indexing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ajdittmann committed Nov 26, 2024
1 parent 6a5c230 commit 0eaf08c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nautilus/bounds/periodic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down

0 comments on commit 0eaf08c

Please sign in to comment.