Skip to content

Commit 42214bd

Browse files
authored
Clean up neighbors.pyx variable name (#4134)
* sort var a bit * rename some internal var for readability * wrap func def for readability * max_r to max_rep to avoid confusion * use unsigned int when we're sure it would never be negative
1 parent 8991e77 commit 42214bd

File tree

2 files changed

+148
-106
lines changed

2 files changed

+148
-106
lines changed

src/pymatgen/core/lattice.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1418,12 +1418,13 @@ def get_points_in_sphere(
14181418
from pymatgen.optimization.neighbors import find_points_in_spheres
14191419
except ImportError:
14201420
return self.get_points_in_sphere_py(frac_points=frac_points, center=center, r=r, zip_results=zip_results)
1421+
14211422
else:
14221423
frac_points = np.ascontiguousarray(frac_points, dtype=float)
1423-
latt_matrix = np.ascontiguousarray(self.matrix, dtype=float)
14241424
cart_coords = np.ascontiguousarray(self.get_cartesian_coords(frac_points), dtype=float)
1425-
pbc = np.ascontiguousarray(self.pbc, dtype=np.int64)
14261425
center_coords = np.ascontiguousarray([center], dtype=float)
1426+
pbc = np.ascontiguousarray(self.pbc, dtype=np.int64)
1427+
latt_matrix = np.ascontiguousarray(self.matrix, dtype=float)
14271428

14281429
_, indices, images, distances = find_points_in_spheres(
14291430
all_coords=cart_coords,
@@ -1433,6 +1434,7 @@ def get_points_in_sphere(
14331434
lattice=latt_matrix,
14341435
tol=1e-8,
14351436
)
1437+
14361438
if len(indices) < 1:
14371439
# Return empty np.array (not list or tuple) to ensure consistent return type
14381440
# whether sphere contains points or not

0 commit comments

Comments
 (0)