Skip to content

Commit

Permalink
Fixing overlap issue. (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
lauri-codes authored Oct 10, 2024
1 parent 70f937c commit 6e2683e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion matid/clustering/sbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_clusters(
merge_threshold=0.5,
merge_radius=1,
bond_threshold=0.65,
overlap_threshold=-0.1,
overlap_threshold=-0.4,
radii="covalent",
seed=7,
):
Expand Down
10 changes: 7 additions & 3 deletions matid/core/periodicfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_region(
max_cell_size,
pos_tol,
bond_threshold=None,
overlap_threshold=-0.1,
overlap_threshold=-0.6,
distances: Distances = None,
return_mask: bool = False,
):
Expand Down Expand Up @@ -530,11 +530,15 @@ def _find_proto_cell(

# Check that the final proto cell atoms don't overlap
if proto_cell is not None:
dist_proto_cell = matid.geometry.get_distances(proto_cell).dist_matrix_mic
dist_proto_cell = dist_proto_cell[np.triu_indices(dist_proto_cell.shape[0])]
dist_proto_cell = matid.geometry.get_distances(proto_cell).dist_matrix_radii_mic
dist_proto_cell = dist_proto_cell[np.triu_indices(dist_proto_cell.shape[0], 1)]
print(dist_proto_cell.min(), overlap_threshold)
if dist_proto_cell.min() < overlap_threshold:
return None, None, None, None

from ase.visualize import view
view(proto_cell)

return proto_cell, offset, n_spans, n_periodic_spans_selected

def _find_graphs(
Expand Down

0 comments on commit 6e2683e

Please sign in to comment.