streamline code by using changes in Modify class

This commit is contained in:
Axel Kohlmeyer
2021-08-06 12:12:34 -04:00
parent b16bca2f45
commit a7d05cff09

View File

@ -187,11 +187,11 @@ void Velocity::create(double t_desired, int seed)
Compute *temperature_nobias = nullptr;
if (temperature == nullptr || bias_flag) {
modify->add_compute(fmt::format("velocity_temp {} temp",group->names[igroup]));
auto newcompute = modify->add_compute(fmt::format("velocity_temp {} temp",group->names[igroup]));
if (temperature == nullptr) {
temperature = modify->compute[modify->ncompute-1];
temperature = newcompute;
tcreate_flag = 1;
} else temperature_nobias = modify->compute[modify->ncompute-1];
} else temperature_nobias = newcompute;
}
// initialize temperature computation(s)
@ -575,8 +575,7 @@ void Velocity::scale(int /*narg*/, char **arg)
int tflag = 0;
if (temperature == nullptr) {
modify->add_compute(fmt::format("velocity_temp {} temp",group->names[igroup]));
temperature = modify->compute[modify->ncompute-1];
temperature = modify->add_compute(fmt::format("velocity_temp {} temp",group->names[igroup]));
tflag = 1;
}