Commit 006ba39f authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Updated Crystal parser and fixed small issue in system wrapping.

parent c2810c34
Pipeline #91958 passed with stages
in 20 minutes and 42 seconds
Subproject commit df1175fab88a5216da20b75f81c7374d8df938df Subproject commit b31800d887ce99d21a7a4048fdfbfe9aff8df33b
...@@ -65,7 +65,7 @@ def wrap_positions( ...@@ -65,7 +65,7 @@ def wrap_positions(
cell: np.ndarray = None, cell: np.ndarray = None,
pbc: Union[bool, np.ndarray] = True, pbc: Union[bool, np.ndarray] = True,
center: np.ndarray = [0.5, 0.5, 0.5], center: np.ndarray = [0.5, 0.5, 0.5],
eps: float = 1e-7) -> np.ndarray: eps: float = 1e-12) -> np.ndarray:
"""Wraps the given position so that they are within the unit cell. If no """Wraps the given position so that they are within the unit cell. If no
cell is given, scaled positions are assumed. For wrapping cartesian cell is given, scaled positions are assumed. For wrapping cartesian
positions you also need to provide the cell. positions you also need to provide the cell.
...@@ -93,13 +93,14 @@ def wrap_positions( ...@@ -93,13 +93,14 @@ def wrap_positions(
if cell is None: if cell is None:
fractional = positions fractional = positions
else: else:
fractional = to_scaled(positions) - shift fractional = to_scaled(positions, cell)
fractional -= shift
for i, periodic in enumerate(pbc): for i, periodic in enumerate(pbc):
if periodic: if periodic:
fractional[:, i] %= 1.0 fractional[:, i] %= 1.0
fractional[:, i] += shift[i] fractional[:, i] += shift[i]
if cell: if cell is not None:
return np.dot(fractional, cell) return np.dot(fractional, cell)
else: else:
return fractional return fractional
......
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