From a6eb6e4f8486148898cc6fecf3dbc87a0c4c7819 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 11 Jan 2013 16:50:56 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9261 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/fix_deform.cpp | 2 +- src/fix_langevin.cpp | 4 ++-- src/fix_nh.cpp | 8 ++------ src/fix_press_berendsen.cpp | 2 +- src/fix_restrain.cpp | 6 +++--- src/fix_temp_berendsen.cpp | 2 +- src/fix_temp_rescale.cpp | 2 +- src/fix_tmd.cpp | 2 +- src/pair_dpd_tstat.cpp | 2 +- src/variable.cpp | 6 +++--- 10 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index a047c0e2ef..c622c3b589 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -679,7 +679,7 @@ void FixDeform::end_of_step() int i; double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; // wrap variable evaluations with clear/add diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 4e49b8ede2..292f691bc4 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -285,7 +285,7 @@ void FixLangevin::post_force_no_tally() int nlocal = atom->nlocal; double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; // set current t_target and t_sqrt // if variable temp, evaluate variable, wrap with clear/add @@ -480,7 +480,7 @@ void FixLangevin::post_force_tally() int nlocal = atom->nlocal; double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; // set current t_target and t_sqrt // if variable temp, evaluate variable, wrap with clear/add diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 3d2ca8aa29..22f07cedd7 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -2093,9 +2093,7 @@ void FixNH::compute_deviatoric() void FixNH::compute_temp_target() { double delta = update->ntimestep - update->beginstep; - if (update->endstep > update->beginstep) - delta /= update->endstep - update->beginstep; - else delta = 0.0; + if (delta != 0.0) delta /= update->endstep - update->beginstep; t_target = t_start + delta * (t_stop-t_start); ke_target = tdof * boltz * t_target; @@ -2108,9 +2106,7 @@ void FixNH::compute_temp_target() void FixNH::compute_press_target() { double delta = update->ntimestep - update->beginstep; - if (update->endstep > update->beginstep) - delta /= update->endstep - update->beginstep; - else delta = 0.0; + if (delta != 0.0) delta /= update->endstep - update->beginstep; p_hydro = 0.0; for (int i = 0; i < 3; i++) diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index e9ffbdfb1c..5015804006 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -357,7 +357,7 @@ void FixPressBerendsen::end_of_step() couple(); double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; for (int i = 0; i < 3; i++) { if (p_flag[i]) { diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index 1c2080a50e..e2f8bbf6f2 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -213,7 +213,7 @@ void FixRestrain::restrain_bond(int m) int newton_bond = force->newton_bond; double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; double k = kstart[m] + delta * (kstop[m] - kstart[m]); i1 = atom->map(ids[m][0]); @@ -294,7 +294,7 @@ void FixRestrain::restrain_angle(int m) int newton_bond = force->newton_bond; double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; double k = kstart[m] + delta * (kstop[m] - kstart[m]); i1 = atom->map(ids[m][0]); @@ -422,7 +422,7 @@ void FixRestrain::restrain_dihedral(int m) int newton_bond = force->newton_bond; double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; double k = kstart[m] + delta * (kstop[m] - kstart[m]); i1 = atom->map(ids[m][0]); diff --git a/src/fix_temp_berendsen.cpp b/src/fix_temp_berendsen.cpp index 4cd6599eec..52bd4bc3a5 100644 --- a/src/fix_temp_berendsen.cpp +++ b/src/fix_temp_berendsen.cpp @@ -140,7 +140,7 @@ void FixTempBerendsen::end_of_step() "Computed temperature for fix temp/berendsen cannot be 0.0"); double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; // set current t_target // if variable temp, evaluate variable, wrap with clear/add diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index f28a25f6bc..69e74eeb02 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -137,7 +137,7 @@ void FixTempRescale::end_of_step() error->all(FLERR,"Computed temperature for fix temp/rescale cannot be 0.0"); double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; // set current t_target // if variable temp, evaluate variable, wrap with clear/add diff --git a/src/fix_tmd.cpp b/src/fix_tmd.cpp index c504ae0514..127d7d4f75 100644 --- a/src/fix_tmd.cpp +++ b/src/fix_tmd.cpp @@ -192,7 +192,7 @@ void FixTMD::initial_integrate(int vflag) int nlocal = atom->nlocal; double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; double rho_target = rho_start + delta * (rho_stop - rho_start); // compute the Lagrange multiplier diff --git a/src/pair_dpd_tstat.cpp b/src/pair_dpd_tstat.cpp index 4bcccede18..257f91d976 100644 --- a/src/pair_dpd_tstat.cpp +++ b/src/pair_dpd_tstat.cpp @@ -49,7 +49,7 @@ void PairDPDTstat::compute(int eflag, int vflag) if (t_start != t_stop) { double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; temperature = t_start + delta * (t_stop-t_start); double boltz = force->boltz; for (i = 1; i <= atom->ntypes; i++) diff --git a/src/variable.cpp b/src/variable.cpp index 503f6995c5..5b9402a731 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -1806,7 +1806,7 @@ double Variable::collapse_tree(Tree *tree) if (tree->left->type != VALUE || tree->right->type != VALUE) return 0.0; tree->type = VALUE; double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; tree->value = arg1 + delta*(arg2-arg1); return tree->value; } @@ -2072,7 +2072,7 @@ double Variable::eval_tree(Tree *tree, int i) arg1 = eval_tree(tree->left,i); arg2 = eval_tree(tree->right,i); double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; arg = arg1 + delta*(arg2-arg1); return arg; } @@ -2489,7 +2489,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree, if (tree) newtree->type = RAMP; else { double delta = update->ntimestep - update->beginstep; - delta /= update->endstep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; double value = value1 + delta*(value2-value1); argstack[nargstack++] = value; }