From 6f66f5b23b81a608d449a4cec193bc1c135acc9e Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Tue, 27 Oct 2020 13:55:50 -0600 Subject: [PATCH] Add non-numeric pressure check to fix box/relax --- src/fix_box_relax.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/fix_box_relax.cpp b/src/fix_box_relax.cpp index 0437d1550c..0200f8ed03 100644 --- a/src/fix_box_relax.cpp +++ b/src/fix_box_relax.cpp @@ -735,12 +735,18 @@ void FixBoxRelax::couple() p_current[2] = tensor[2]; } + if (!std::isfinite(p_current[0]) || !std::isfinite(p_current[1]) || !std::isfinite(p_current[2])) + error->all(FLERR,"Non-numeric pressure - simulation unstable"); + // switch order from xy-xz-yz to Voigt if (pstyle == TRICLINIC) { p_current[3] = tensor[5]; p_current[4] = tensor[4]; p_current[5] = tensor[3]; + + if (!std::isfinite(p_current[3]) || !std::isfinite(p_current[4]) || !std::isfinite(p_current[5])) + error->all(FLERR,"Non-numeric pressure - simulation unstable"); } }