Skip to content

Commit

Permalink
reduced chance of warnings for close_sc
Browse files Browse the repository at this point in the history
Now everything below maxR + 0.1 should be fine.

Signed-off-by: Nick Papior <nickpapior@gmail.com>
  • Loading branch information
zerothi committed Nov 2, 2023
1 parent 94510c8 commit 5a63302
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/sisl/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1821,11 +1821,13 @@ def optimize_nsc(self,
while prev_isc == isc[i]:
# Try next supercell connection
isc[i] += 1
for ia in self:
idx = self.close_sc(ia, isc=isc, R=R)
if len(idx) > 0:
prev_isc = isc[i]
break
with warnings.catch_warnings():
warnings.simplefilter("ignore")
for ia in self:
idx = self.close_sc(ia, isc=isc, R=R)
if len(idx) > 0:
prev_isc = isc[i]
break

# Save the reached supercell connection
nsc[i] = prev_isc * 2 + 1
Expand Down Expand Up @@ -3588,7 +3590,7 @@ def close_sc(self,

# Maximum distance queried
max_R = R[-1]
if atoms is not None and max_R > maxR:
if atoms is not None and max_R > maxR + 0.1:
warn(f"{self.__class__.__name__}.close_sc has been passed an 'atoms' argument "
"together with an R value larger than the orbital ranges. "
"If used together with 'sparse-matrix.construct' this can result in wrong couplings.",
Expand Down

0 comments on commit 5a63302

Please sign in to comment.