diff --git a/src/fix_nph.cpp b/src/fix_nph.cpp index 6865060c22..9cd6bc2673 100644 --- a/src/fix_nph.cpp +++ b/src/fix_nph.cpp @@ -270,8 +270,6 @@ void FixNPH::init() pressure = modify->compute[icompute]; // set timesteps and frequencies - // Nkt = initial value for piston mass and energy conservation - // guesstimate a unit-dependent t_initial if actual T = 0.0 dtv = update->dt; dtf = 0.5 * update->dt * force->ftm2v; @@ -287,14 +285,6 @@ void FixNPH::init() if (dimension == 3) vol0 = domain->xprd * domain->yprd * domain->zprd; else vol0 = domain->xprd * domain->yprd; - temperature->init(); // not yet called by Modify::init() - double t_initial = temperature->compute_scalar(); - if (t_initial == 0.0) { - if (strcmp(update->unit_style,"lj") == 0) t_initial = 1.0; - else t_initial = 300.0; - } - nkt = atom->natoms * boltz * t_initial; - if (force->kspace) kspace_flag = 1; else kspace_flag = 0; @@ -326,6 +316,18 @@ void FixNPH::init() void FixNPH::setup(int vflag) { + // Nkt = initial value for piston mass and energy conservation + // cannot be done in init() b/c temperature cannot be called there + // is b/c Modify::init() inits computes after fixes due to dof dependence + // guesstimate a unit-dependent t_initial if actual T = 0.0 + + double t_initial = temperature->compute_scalar(); + if (t_initial == 0.0) { + if (strcmp(update->unit_style,"lj") == 0) t_initial = 1.0; + else t_initial = 300.0; + } + nkt = atom->natoms * boltz * t_initial; + p_target[0] = p_start[0]; // used by compute_scalar() p_target[1] = p_start[1]; p_target[2] = p_start[2]; diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index 8b0a876bab..8bf8d79a04 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -99,9 +99,6 @@ void FixTempRescale::init() if (temperature->tempbias) which = BIAS; else which = NOBIAS; - - temperature->init(); // not yet called by Modify::init() - efactor = (0.5 * force->boltz * temperature->dof); } /* ---------------------------------------------------------------------- */ @@ -121,6 +118,7 @@ void FixTempRescale::end_of_step() 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 efactor = 0.5 * force->boltz * temperature->dof; double **v = atom->v; int *mask = atom->mask; diff --git a/src/modify.cpp b/src/modify.cpp index b6d954421c..962536a9f9 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -187,7 +187,7 @@ void Modify::init() restart_pbc_any = 0; for (i = 0; i < nfix; i++) if (fix[i]->restart_pbc) restart_pbc_any = 1; - + // create list of computes that store invocation times list_init_compute();