Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change type of viewer.shift #187

Merged
merged 2 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/py4vasp/_calculation/exciton_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion src/py4vasp/_third_party/view/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading