Skip to content

Commit 575e56f

Browse files
committed
Break loop after first angle optimisation failure.
1 parent 8a38a23 commit 575e56f

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/ghostly/_ghostly.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,6 @@ def _triple(
938938

939939
# Perform multiple minimisations to get an average for the theta0 values.
940940
is_error = False
941-
num_errors = 0
942941
for _ in range(num_optimise):
943942
# Minimise the molecule.
944943
min_mol = _morph.link_to_reference(mol)
@@ -951,7 +950,6 @@ def _triple(
951950
minimiser.run()
952951
except Exception:
953952
is_error = True
954-
num_errors += 1
955953

956954
# Commit the changes.
957955
min_mol = minimiser.commit()
@@ -963,11 +961,11 @@ def _triple(
963961
except Exception:
964962
raise ValueError(f"Could not find optimised angle term: {idx}")
965963

966-
if is_error:
967-
_logger.warning(
968-
f" {num_errors} minimisation(s) failed to converge during "
969-
f"angle optimisation at {_lam_sym} = {int(is_lambda1)}."
970-
)
964+
if is_error:
965+
_logger.warning(
966+
"Minimisation failed to converge during angle optimisation."
967+
)
968+
break
971969

972970
# Compute the mean and standard error.
973971
import numpy as _np

0 commit comments

Comments
 (0)