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

Fix NumPy array indexing in 32-bit system in analysis.chemenv.coordination_environments #4194

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ def points_wcs_csc(self, permutation=None):
"""
if permutation is None:
return self._points_wcs_csc
return np.concatenate((self._points_wcs_csc[:1], self._points_wocs_csc.take(permutation, axis=0)))
return np.concatenate(
(self._points_wcs_csc[:1], self._points_wocs_csc.take(np.array(permutation, dtype=np.intp), axis=0))
)

def points_wocs_csc(self, permutation=None):
"""
Expand All @@ -227,7 +229,7 @@ def points_wocs_csc(self, permutation=None):
"""
if permutation is None:
return self._points_wocs_csc
return self._points_wocs_csc.take(permutation, axis=0)
return self._points_wocs_csc.take(np.array(permutation, dtype=np.intp), axis=0)

def points_wcs_ctwcc(self, permutation=None):
"""
Expand All @@ -239,7 +241,7 @@ def points_wcs_ctwcc(self, permutation=None):
return np.concatenate(
(
self._points_wcs_ctwcc[:1],
self._points_wocs_ctwcc.take(permutation, axis=0),
self._points_wocs_ctwcc.take(np.array(permutation, dtype=np.intp), axis=0),
)
)

Expand All @@ -250,7 +252,7 @@ def points_wocs_ctwcc(self, permutation=None):
"""
if permutation is None:
return self._points_wocs_ctwcc
return self._points_wocs_ctwcc.take(permutation, axis=0)
return self._points_wocs_ctwcc.take(np.array(permutation, dtype=np.intp), axis=0)

def points_wcs_ctwocc(self, permutation=None):
"""
Expand All @@ -262,7 +264,7 @@ def points_wcs_ctwocc(self, permutation=None):
return np.concatenate(
(
self._points_wcs_ctwocc[:1],
self._points_wocs_ctwocc.take(permutation, axis=0),
self._points_wocs_ctwocc.take(np.array(permutation, dtype=np.intp), axis=0),
)
)

Expand All @@ -273,7 +275,7 @@ def points_wocs_ctwocc(self, permutation=None):
"""
if permutation is None:
return self._points_wocs_ctwocc
return self._points_wocs_ctwocc.take(permutation, axis=0)
return self._points_wocs_ctwocc.take(np.array(permutation, dtype=np.intp), axis=0)

@property
def cn(self):
Expand Down Expand Up @@ -1976,6 +1978,7 @@ def _cg_csm_separation_plane_optim2(
stop_search = False
# TODO: do not do that several times ... also keep in memory
if sepplane.ordered_plane:
separation_indices = [arr.astype(np.intp) for arr in separation_indices]
inp = self.local_geometry.coords.take(separation_indices[1], axis=0)
if sepplane.ordered_point_groups[0]:
pp_s0 = self.local_geometry.coords.take(separation_indices[0], axis=0)
Expand Down
Loading