From 1007f6c725344183638c4c768f3f754752b29a7c Mon Sep 17 00:00:00 2001 From: Gerardo Tauriello <gerardo.tauriello@unibas.ch> Date: Wed, 24 Aug 2016 19:43:17 +0200 Subject: [PATCH] SCHWED-1316: catch NaN in energy minimization and abort. --- CMakeLists.txt | 2 +- modelling/pymod/_pipeline.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a566df2..4032c983 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ include(PROMOD3) set(PROMOD3_VERSION_MAJOR 1) set(PROMOD3_VERSION_MINOR 0) -set(PROMOD3_VERSION_PATCH 0) +set(PROMOD3_VERSION_PATCH 1) set(PROMOD3_VERSION_STRING ${PROMOD3_VERSION_MAJOR}.${PROMOD3_VERSION_MINOR}) set(PROMOD3_VERSION_STRING ${PROMOD3_VERSION_STRING}.${PROMOD3_VERSION_PATCH}) diff --git a/modelling/pymod/_pipeline.py b/modelling/pymod/_pipeline.py index 9fe9f49b..53d6bfd3 100644 --- a/modelling/pymod/_pipeline.py +++ b/modelling/pymod/_pipeline.py @@ -13,7 +13,7 @@ from _ring_punches import * import ost from ost import mol from ost.mol import mm -import os +import os, math def BuildSidechains(mhandle, merge_distance=4, scorer=None, fragment_db=None, structure_db=None, torsion_sampler=None): @@ -140,6 +140,11 @@ def MinimizeModelEnergy(mhandle, max_iterations=12, max_iter_sd=20, settings.platform = mm.Platform.Reference sim = mm.Simulation(mhandle.model, settings) ost.LogWarning("Switched to slower reference platform of OpenMM!") + # check for certain failure -> we get NaN if atoms are on top each other + if math.isnan(sim.GetEnergy()): + ost.LogError("OpenMM could not minimize energy as atoms are on top of " + "each other!") + return # settings to check for stereochemical problems clashing_distances = mol.alg.DefaultClashingDistances() bond_stereo_chemical_param = mol.alg.DefaultBondStereoChemicalParams() -- GitLab