From 99fa6ed4b4fafa615cf85fba355288e62dd550c2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 23 Apr 2021 16:50:35 -0400 Subject: [PATCH] delay part of the variable.cpp refactoring until we have better unit testing for it. --- src/KSPACE/pair_buck_long_coul_long.cpp | 20 ++++++++++---------- src/variable.cpp | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/KSPACE/pair_buck_long_coul_long.cpp b/src/KSPACE/pair_buck_long_coul_long.cpp index 8e8cf21da6..ca5a9ab3c2 100644 --- a/src/KSPACE/pair_buck_long_coul_long.cpp +++ b/src/KSPACE/pair_buck_long_coul_long.cpp @@ -563,9 +563,9 @@ void PairBuckLongCoulLong::compute(int eflag, int vflag) force_buck = r*expr*buck1i[typej]-(fdisptable[disp_k]+f_disp*dfdisptable[disp_k])*buckci[typej]; if (eflag) evdwl = expr*buckai[typej]-(edisptable[disp_k]+f_disp*dedisptable[disp_k])*buckci[typej]; } else { //special case - double f = special_lj[ni], t = rn*(1.0-f); - force_buck = f*r*expr*buck1i[typej] -(fdisptable[disp_k]+f_disp*dfdisptable[disp_k])*buckci[typej] +t*buck2i[typej]; - if (eflag) evdwl = f*expr*buckai[typej] -(edisptable[disp_k]+f_disp*dedisptable[disp_k])*buckci[typej]+t*buckci[typej]; + double fc = special_lj[ni], t = rn*(1.0-fc); + force_buck = fc*r*expr*buck1i[typej] -(fdisptable[disp_k]+f_disp*dfdisptable[disp_k])*buckci[typej] +t*buck2i[typej]; + if (eflag) evdwl = fc*expr*buckai[typej] -(edisptable[disp_k]+f_disp*dedisptable[disp_k])*buckci[typej]+t*buckci[typej]; } } } else { // cut @@ -574,10 +574,10 @@ void PairBuckLongCoulLong::compute(int eflag, int vflag) if (eflag) evdwl = expr*buckai[typej] - rn*buckci[typej]-offseti[typej]; } else { // special case - double f = special_lj[ni]; - force_buck = f*(r*expr*buck1i[typej]-rn*buck2i[typej]); + double fc = special_lj[ni]; + force_buck = fc*(r*expr*buck1i[typej]-rn*buck2i[typej]); if (eflag) - evdwl = f*(expr*buckai[typej]-rn*buckci[typej]-offseti[typej]); + evdwl = fc*(expr*buckai[typej]-rn*buckci[typej]-offseti[typej]); } } } @@ -586,10 +586,10 @@ void PairBuckLongCoulLong::compute(int eflag, int vflag) fpair = (force_coul+force_buck)*r2inv; if (newton_pair || j < nlocal) { - double *fj = f0+(j+(j<<1)), f; - fi[0] += f = d[0]*fpair; fj[0] -= f; - fi[1] += f = d[1]*fpair; fj[1] -= f; - fi[2] += f = d[2]*fpair; fj[2] -= f; + double *fj = f0+(j+(j<<1)), fp; + fi[0] += fp = d[0]*fpair; fj[0] -= fp; + fi[1] += fp = d[1]*fpair; fj[1] -= fp; + fi[2] += fp = d[2]*fpair; fj[2] -= fp; } else { fi[0] += d[0]*fpair; diff --git a/src/variable.cpp b/src/variable.cpp index 9fe3fdcd12..ac225230cf 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -4109,7 +4109,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Fix *fix = nullptr; int index,nvec,nstride; char *ptr1,*ptr2; - ivar = -1; + int ivar = -1; // argument is compute @@ -4387,7 +4387,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, if (narg != 1) print_var_error(FLERR,"Invalid special function in variable formula",ivar); - ivar = find(args[0]); + int ivar = find(args[0]); if (ivar < 0) { std::string mesg = "Variable ID '"; mesg += args[0]; @@ -4399,7 +4399,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, // save value in tree or on argstack if (style[ivar] == SCALARFILE) { - value = atof(data[ivar][0]); + double value = atof(data[ivar][0]); int done = reader[ivar]->read_scalar(data[ivar][0]); if (done) remove(ivar);