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"); } }