Changed pbc_points to allow to shift the box in the other direction for shear simulations.

This commit is contained in:
sebastiankloth 2023-06-28 13:53:37 +02:00
parent 8146a9b270
commit 76e44dde49

View File

@ -241,9 +241,7 @@ def nojump(frame, usecache=True):
return frame - delta
def pbc_points(
coordinates, box, thickness=0, index=False, shear=False, extra_image=False
):
def pbc_points(coordinates, box, thickness=0, index=False, shear=False):
"""
Returns the points their first periodic images. Does not fold
them back into the box.
@ -253,22 +251,14 @@ def pbc_points(
originals values.
"""
if shear:
box[2, 0] = box[2, 0] % box[0, 0]
if shear or extra_image:
grid = np.array(
[
[i, j, k]
for k in [-2, -1, 0, 1, 2]
for j in [2, 1, 0, -1, -2]
for i in [-2, -1, 0, 1, 2]
]
)
indices = np.tile(np.arange(len(coordinates)), 125)
else:
grid = np.array(
[[i, j, k] for k in [-1, 0, 1] for j in [1, 0, -1] for i in [-1, 0, 1]]
)
indices = np.tile(np.arange(len(coordinates)), 27)
box[2, 0] = box[2, 0] % box[2, 2]
if box[2, 0] > box[2, 2]:
box[2, 0] = box[2, 0] - box[2, 2]
grid = np.array(
[[i, j, k] for k in [-1, 0, 1] for j in [1, 0, -1] for i in [-1, 0, 1]]
)
indices = np.tile(np.arange(len(coordinates)), 27)
coordinates_pbc = np.concatenate([coordinates + v @ box for v in grid], axis=0)
size = np.diag(box)