From 0e893e29624cc35a6374ac8d1ff7124c9b6cb05c Mon Sep 17 00:00:00 2001 From: Judit Zador Date: Fri, 7 Jun 2024 14:21:42 -0700 Subject: [PATCH 1/3] solution for IndexError when too many bonds created in Internals --- sella/internal.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sella/internal.py b/sella/internal.py index c2ffdbc..c9e539e 100644 --- a/sella/internal.py +++ b/sella/internal.py @@ -1375,6 +1375,9 @@ def find_all_bonds( labels[nbonds == 0] = -1 for i, j in cwr(range(self.natoms), 2): + # do not consider bonds beyond max_bonds + #if i > max_bonds or j > max_bonds: + # break # do not add a bond between atoms belonging to the same # bonding network fragment if labels[i] == labels[j] and labels[i] != -1: @@ -1393,12 +1396,16 @@ def find_all_bonds( self.add_bond((i, j), ts) except DuplicateInternalError: continue - c10y[i, nbonds[i]] = j - nbonds[i] += 1 - c10y[j, nbonds[j]] = i - nbonds[j] += 1 + if nbonds[i] < max_bonds and nbonds[j] < max_bonds: + c10y[i, nbonds[i]] = j + nbonds[i] += 1 + c10y[j, nbonds[j]] = i + nbonds[j] += 1 + else: + pass first_run = False scale *= 1.05 + print(scale) if self.allow_fragments and nlabels != 1: assert nlabels > 1 From d2eb69e1ce023f91484ee2e4bf7b75cee5f367a5 Mon Sep 17 00:00:00 2001 From: Judit Zador Date: Fri, 7 Jun 2024 14:24:35 -0700 Subject: [PATCH 2/3] removed comment from code --- sella/internal.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/sella/internal.py b/sella/internal.py index c9e539e..a172f95 100644 --- a/sella/internal.py +++ b/sella/internal.py @@ -1375,9 +1375,6 @@ def find_all_bonds( labels[nbonds == 0] = -1 for i, j in cwr(range(self.natoms), 2): - # do not consider bonds beyond max_bonds - #if i > max_bonds or j > max_bonds: - # break # do not add a bond between atoms belonging to the same # bonding network fragment if labels[i] == labels[j] and labels[i] != -1: From aebd6b5ed12bae7731df7691206c30fd1a4486a6 Mon Sep 17 00:00:00 2001 From: Judit Zador Date: Mon, 10 Jun 2024 15:37:19 -0700 Subject: [PATCH 3/3] removed unnecessary print --- sella/internal.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sella/internal.py b/sella/internal.py index a172f95..c1c63d7 100644 --- a/sella/internal.py +++ b/sella/internal.py @@ -1402,7 +1402,6 @@ def find_all_bonds( pass first_run = False scale *= 1.05 - print(scale) if self.allow_fragments and nlabels != 1: assert nlabels > 1