Skip to content

Commit 5d236c5

Browse files
committed
Catch ghostly angle optimisation failures.
1 parent 0afe158 commit 5d236c5

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/somd2/runner/_base.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,18 @@ def __init__(self, system, config):
265265
from ghostly import modify
266266

267267
_logger.info("Applying modifications to ghost atom bonded terms")
268-
self._system, self._modifications = modify(self._system)
268+
try:
269+
self._system, self._modifications = modify(self._system)
270+
# Angle optimisation can sometimes fail.
271+
except Exception as e1:
272+
try:
273+
self._system, self._modifications = modify(
274+
self_system, optimise_angles=False
275+
)
276+
except Exception as e2:
277+
msg = f"Unable to apply modifications to ghost atom bonded terms: {e1}; {e2}"
278+
_logger.error(msg)
279+
raise RuntimeError(msg)
269280

270281
# Check for a periodic space.
271282
self._has_space = self._check_space()

0 commit comments

Comments
 (0)