Unverified Commit c5760245 authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Use deepcopy for cloning positions (#3241)

parent 609fc413
...@@ -520,7 +520,7 @@ class Modeller(object): ...@@ -520,7 +520,7 @@ class Modeller(object):
if len(self.positions) == 0: if len(self.positions) == 0:
positions = [] positions = []
else: else:
positions = self.positions.value_in_unit(nanometer)[:] positions = deepcopy(self.positions.value_in_unit(nanometer))
cells = _CellList(positions, maxCutoff, vectors, True) cells = _CellList(positions, maxCutoff, vectors, True)
# Create a function to compute the distance between two points, taking periodic boundary conditions into account. # Create a function to compute the distance between two points, taking periodic boundary conditions into account.
...@@ -1540,7 +1540,7 @@ class _CellList(object): ...@@ -1540,7 +1540,7 @@ class _CellList(object):
"""This class organizes atom positions into cells, so the neighbors of a point can be quickly retrieved""" """This class organizes atom positions into cells, so the neighbors of a point can be quickly retrieved"""
def __init__(self, positions, maxCutoff, vectors, periodic): def __init__(self, positions, maxCutoff, vectors, periodic):
self.positions = positions[:] self.positions = deepcopy(positions)
self.cells = {} self.cells = {}
self.numCells = tuple((max(1, int(floor(vectors[i][i]/maxCutoff))) for i in range(3))) self.numCells = tuple((max(1, int(floor(vectors[i][i]/maxCutoff))) for i in range(3)))
self.cellSize = tuple((vectors[i][i]/self.numCells[i] for i in range(3))) self.cellSize = tuple((vectors[i][i]/self.numCells[i] for i in range(3)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment