Use isclose
over ==
for overlap position check in SlabGenerator.get_slabs
#3825
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Follow up #3748.
isclose
over==
for overlap check inSlabGenerator.get_slabs
ztol
arg to control the behavior ofget_slabs
, default to0
to keep consistency with previous behaviorUse
isclose
over==
for overlap check inSlabGenerator.get_slabs
Previously a
z_range
is neglected only when two coordinates are exactly the same.pymatgen/pymatgen/core/surface.py
Lines 1317 to 1321 in 578d29c
Need discussion
However I'm not quite sure if checking the
z_range
really make much sense, as it's not possible to know whether terminating at a specific z-coordinate really breaks a bond (cannot calculate bond-distance just by z-distance).It might be good to implement a method to detect bond broken by distance?