From 006ba39f33e6e17ab1672d26b4bb19240e2cc89d Mon Sep 17 00:00:00 2001 From: Lauri Himanen <lauri.himanen@gmail.com> Date: Fri, 22 Jan 2021 15:42:58 +0200 Subject: [PATCH] Updated Crystal parser and fixed small issue in system wrapping. --- dependencies/parsers/crystal | 2 +- nomad/atomutils.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dependencies/parsers/crystal b/dependencies/parsers/crystal index df1175fab8..b31800d887 160000 --- a/dependencies/parsers/crystal +++ b/dependencies/parsers/crystal @@ -1 +1 @@ -Subproject commit df1175fab88a5216da20b75f81c7374d8df938df +Subproject commit b31800d887ce99d21a7a4048fdfbfe9aff8df33b diff --git a/nomad/atomutils.py b/nomad/atomutils.py index c64ee1ba49..4895da1713 100644 --- a/nomad/atomutils.py +++ b/nomad/atomutils.py @@ -65,7 +65,7 @@ def wrap_positions( cell: np.ndarray = None, pbc: Union[bool, np.ndarray] = True, 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 cell is given, scaled positions are assumed. For wrapping cartesian positions you also need to provide the cell. @@ -93,13 +93,14 @@ def wrap_positions( if cell is None: fractional = positions else: - fractional = to_scaled(positions) - shift + fractional = to_scaled(positions, cell) + fractional -= shift for i, periodic in enumerate(pbc): if periodic: fractional[:, i] %= 1.0 - fractional[:, i] += shift[i] - if cell: + fractional[:, i] += shift[i] + if cell is not None: return np.dot(fractional, cell) else: return fractional -- GitLab