Skip to content

Commit

Permalink
update: add coreect cartesian detection of collision
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Sep 9, 2024
1 parent 1cc1971 commit 32461ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/py/mat3ra/made/basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ def to_crystal(self):
def add_atom(self, element="Si", coordinate=None, force=False):
if coordinate is None:
coordinate = [0, 0, 0]
if get_overlapping_coordinates(coordinate, self.coordinates.values, threshold=0.01):
cartesian_basis = self.copy()
cartesian_basis.to_cartesian()
cartesian_coordinate = self.cell.convert_point_to_cartesian(coordinate)
if get_overlapping_coordinates(cartesian_coordinate, cartesian_basis.coordinates.values, threshold=0.1):
if force:
print(f"Warning: Overlapping coordinates found for {coordinate}. Adding atom anyway.")
else:
Expand Down

0 comments on commit 32461ef

Please sign in to comment.