File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131
3232try :
3333 from somd2 import _logger
34- except :
34+ except Exception :
3535 from loguru import logger as _logger
3636
3737import platform as _platform
@@ -940,6 +940,8 @@ def _triple(
940940 theta0s [idx ] = []
941941
942942 # Perform multiple minimisations to get an average for the theta0 values.
943+ is_error = False
944+ num_errors = 0
943945 for _ in range (num_optimise ):
944946 # Minimise the molecule.
945947 min_mol = _morph .link_to_reference (mol )
@@ -948,7 +950,11 @@ def _triple(
948950 constraint = "none" ,
949951 platform = "cpu" ,
950952 )
951- minimiser .run ()
953+ try :
954+ minimiser .run ()
955+ except Exception :
956+ is_error = True
957+ num_errors += 1
952958
953959 # Commit the changes.
954960 min_mol = minimiser .commit ()
@@ -957,9 +963,15 @@ def _triple(
957963 for idx in angle_idxs :
958964 try :
959965 theta0s [idx ].append (min_mol .angles (* idx ).sizes ()[0 ].to (_radian ))
960- except :
966+ except Exception :
961967 raise ValueError (f"Could not find optimised angle term: { idx } " )
962968
969+ if is_error :
970+ _logger .warning (
971+ f" { num_errors } minimisation(s) failed to converge during "
972+ f"angle optimisation at { _lam_sym } = { int (is_lambda1 )} ."
973+ )
974+
963975 # Compute the mean and standard error.
964976 import numpy as _np
965977
You can’t perform that action at this time.
0 commit comments