From 6e2683ed490d00c9603a75050e46a90a60ec6065 Mon Sep 17 00:00:00 2001 From: Lauri Himanen <6513318+lauri-codes@users.noreply.github.com> Date: Thu, 10 Oct 2024 20:50:11 +0300 Subject: [PATCH] Fixing overlap issue. (#30) --- matid/clustering/sbc.py | 2 +- matid/core/periodicfinder.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/matid/clustering/sbc.py b/matid/clustering/sbc.py index 26a62c1b..e5a647c4 100644 --- a/matid/clustering/sbc.py +++ b/matid/clustering/sbc.py @@ -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, ): diff --git a/matid/core/periodicfinder.py b/matid/core/periodicfinder.py index e729f64b..23bc7a4e 100644 --- a/matid/core/periodicfinder.py +++ b/matid/core/periodicfinder.py @@ -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, ): @@ -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(