diff --git a/src/py4vasp/_calculation/exciton_density.py b/src/py4vasp/_calculation/exciton_density.py index 03e701c7..3840c7e2 100644 --- a/src/py4vasp/_calculation/exciton_density.py +++ b/src/py4vasp/_calculation/exciton_density.py @@ -106,7 +106,7 @@ def to_view(self, selection=None, supercell=None, center=False, **user_options): for selection in tree.selections() ] if center: - viewer.shift = (0.5, 0.5, 0.5) + viewer.shift = np.array([0.5, 0.5, 0.5]) return viewer def _create_map(self): diff --git a/src/py4vasp/_third_party/view/view.py b/src/py4vasp/_third_party/view/view.py index d7a3135e..17092fbd 100644 --- a/src/py4vasp/_third_party/view/view.py +++ b/src/py4vasp/_third_party/view/view.py @@ -251,7 +251,8 @@ def _show_isosurface(self, widget, trajectory): def _shift_quantity(self, quantity): if self.shift is None: return quantity - shift_indices = np.round(quantity.shape * self.shift).astype(np.int32) + new_grid_center = np.multiply(quantity.shape, self.shift) + shift_indices = np.round(new_grid_center).astype(np.int32) return np.roll(quantity, shift_indices, axis=(0, 1, 2)) def _show_arrows_at_atoms(self, widget, trajectory):