From eb273ab9ea3ccc5020aeb97e44fec34af40eb03a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Aug 2016 16:54:03 -0400 Subject: [PATCH] fix elusive uninitialized data bug reported by valgrind (cherry picked from commit b44492ee05abc9a52180c73614d8876772bc4b41) --- src/fix_balance.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fix_balance.cpp b/src/fix_balance.cpp index 525c752b48..8ad716a8bc 100644 --- a/src/fix_balance.cpp +++ b/src/fix_balance.cpp @@ -83,6 +83,7 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) : int outarg = 0; fp = NULL; last_clock = 0.0; + clock_factor = -1.0; while (iarg < narg) { if (strcmp(arg[iarg],"out") == 0) { @@ -229,7 +230,8 @@ void FixBalance::pre_exchange() // return if imbalance < threshhold - last_clock = balance->imbalance_clock(clock_factor,last_clock); + if (clock_factor > 0.0) + last_clock = balance->imbalance_clock(clock_factor,last_clock); imbnow = balance->imbalance_nlocal(maxperproc); if (imbnow <= thresh) { if (nevery) next_reneighbor = (update->ntimestep/nevery)*nevery + nevery;