From 40fd97bd4c925a37e33ec88e0bcb75a43caefbdc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Aug 2016 01:59:27 -0400 Subject: [PATCH] silence warnings about cases, that cannot happen (cherry picked from commit 60bf26bad9c6f43bc4af63b97bcc3cb6bc3f9afc) --- src/fix_controller.cpp | 2 +- src/imbalance_var.cpp | 3 ++- src/variable.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fix_controller.cpp b/src/fix_controller.cpp index 28f2873910..d931686515 100644 --- a/src/fix_controller.cpp +++ b/src/fix_controller.cpp @@ -197,7 +197,7 @@ void FixController::end_of_step() // invoke compute if not previously invoked - double current; + double current = 0.0; if (pvwhich == COMPUTE) { if (pvindex == 0) { diff --git a/src/imbalance_var.cpp b/src/imbalance_var.cpp index 40b955af1c..e9c9a3c911 100644 --- a/src/imbalance_var.cpp +++ b/src/imbalance_var.cpp @@ -59,8 +59,9 @@ void ImbalanceVar::compute(double *weight) { if (_id >= 0) { const int all = _lmp->group->find("all"); - const int nlocal = _lmp->atom->nlocal; + if (all < 0) return; + const int nlocal = _lmp->atom->nlocal; double *val = new double[nlocal]; _lmp->input->variable->compute_atom(_id,all,val,1,0); for (int i = 0; i < nlocal; ++i) weight[i] *= val[i]; diff --git a/src/variable.cpp b/src/variable.cpp index f27de2777c..05c55ec7c6 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -898,7 +898,7 @@ double Variable::compute_equal(int ivar) error->all(FLERR,"Variable has circular dependency"); eval_in_progress[ivar] = 1; - double value; + double value = 0.0; if (style[ivar] == EQUAL) value = evaluate(data[ivar][0],NULL); else if (style[ivar] == INTERNAL) value = dvalue[ivar]; else if (style[ivar] == PYTHON) {