Hi Steve,

I noticed that there is a minor error in the file fix_temp_rescale.cpp.

I believe that the variable ‘energy’ in the function ‘FixTempRescale::end_of_step()’ ought to be reset to zero initially in every instance the function is called. Currently, it is only reset to zero when the temperature is outside the temperature window.

The correction is in red as shown below.

Regards,

Zhun-Yong Ong

University of Illinois at Urbana-Champaign

/* ---------------------------------------------------------------------- */

void FixTempRescale::end_of_step()

{

double t_current = temperature->compute_scalar();

if (t_current == 0.0)

error->all(“Computed temperature for fix temp/rescale cannot be 0.0”);

double delta = update->ntimestep - update->beginstep;

delta /= update->endstep - update->beginstep;

double t_target = t_start + delta * (t_stop-t_start);

// rescale velocity of appropriate atoms if outside window

if (fabs(t_current-t_target) > t_window) {

t_target = t_current - fraction*(t_current-t_target);

double factor = sqrt(t_target/t_current);

double **v = atom->v;

int *mask = atom->mask;

int nlocal = atom->nlocal;

energy = 0.0; // This line is needed to clear the previous value.

if (which == NOBIAS) {

energy += (t_current-t_target) * efactor;

for (int i = 0; i < nlocal; i++) {

if (mask[i] & groupbit) {

v[i][0] *= factor;

v[i][1] *= factor;

v[i][2] *= factor;

}

}

} else if (which == BIAS) {

energy += (t_current-t_target) * efactor;

for (int i = 0; i < nlocal; i++) {

if (mask[i] & groupbit) {

temperature->remove_bias(i,v[i]);

v[i][0] *= factor;

v[i][1] *= factor;

v[i][2] *= factor;

temperature->restore_bias(i,v[i]);

}

}

}

} else energy = 0.0;

}