From 8aed7e55b37752e574116e40d7210d63a99b4d32 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 13 Apr 2021 14:59:37 -0400 Subject: [PATCH] add error check when updating variables in ::single() function --- src/pair_hybrid_scaled.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp index cdbccbf7c7..de8801fe24 100644 --- a/src/pair_hybrid_scaled.cpp +++ b/src/pair_hybrid_scaled.cpp @@ -396,6 +396,9 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq, double *vals = new double[nvars]; for (i = 0; i < nvars; ++i) { j = input->variable->find(scalevars[i].c_str()); + if (j < 0) + error->all(FLERR,fmt::format("Variable '{}' not found when updating " + "scale factors",scalevars[i])); vals[i] = input->variable->compute_equal(j); } for (i = 0; i < nstyles; ++i) {