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) {