diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index 6be89f9877..caf6f71122 100755 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -47,8 +47,7 @@ PairTersoff::PairTersoff(LAMMPS *lmp) : Pair(lmp) nelements = 0; elements = NULL; - nparams = 0; - maxparam = 0; + nparams = maxparam = 0; params = NULL; elem2param = NULL; } @@ -364,9 +363,9 @@ void PairTersoff::read_file(char *file) int params_per_line = 17; char **words = new char*[params_per_line+1]; - if (params) delete [] params; + if (params) memory->sfree(params); params = NULL; - nparams = 0; + nparams = maxparam = 0; // open file on proc 0 diff --git a/src/input.cpp b/src/input.cpp index 97eaa5cd58..6fd8e99f66 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -524,7 +524,7 @@ void Input::echo() void Input::ifthenelse() { - if (narg < 4) error->all("Illegal if command"); + if (narg < 3) error->all("Illegal if command"); // substitute for variables in Boolean expression for "if" // in case expression was enclosed in quotes diff --git a/src/variable.cpp b/src/variable.cpp index 1136593216..fd236b7102 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -3163,13 +3163,13 @@ double Variable::evaluate_boolean(char *str) // number: push value onto stack // ---------------- - } else if (isdigit(onechar) || onechar == '.') { + } else if (isdigit(onechar) || onechar == '.' || onechar == '-') { if (expect == OP) error->all("Invalid Boolean syntax in if command"); expect = OP; // istop = end of number, including scientific notation - int istart = i; + int istart = i++; while (isdigit(str[i]) || str[i] == '.') i++; if (str[i] == 'e' || str[i] == 'E') { i++; @@ -3282,7 +3282,7 @@ double Variable::evaluate_boolean(char *str) // push current operation onto stack opstack[nopstack++] = op; - + } else error->all("Invalid Boolean syntax in if command"); }