Skip to content

Commit

Permalink
added comment for the design choice.
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Papior <nickpapior@gmail.com>
  • Loading branch information
zerothi committed Oct 17, 2024
1 parent 5b9584b commit e7723f3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/sisl/_core/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3763,6 +3763,9 @@ def sphere_grid_index(grid, center, R):
sh = grid.shape

# direct if-statements are 4-5 times faster than min+max
# These subsequent 25 lines are equivalent to:
# cmin = np.maximum(0, np.minimum(cmin, sh))
# the numpy equivalents are way too slow in this case.
if cmin[0] < 0:
cmin[0] = 0
elif sh[0] < cmin[0]:
Expand Down

0 comments on commit e7723f3

Please sign in to comment.