fix missing argument bug in velocity code and simplify a second case
This commit is contained in:
@ -186,15 +186,11 @@ void Velocity::create(double t_desired, int seed)
|
||||
Compute *temperature_nobias = nullptr;
|
||||
|
||||
if (temperature == nullptr || bias_flag) {
|
||||
char **arg = new char*[3];
|
||||
arg[0] = (char *) "velocity_temp";
|
||||
arg[1] = group->names[igroup];
|
||||
arg[2] = (char *) "temp";
|
||||
modify->add_compute(fmt::format("velocity_temp {} temp",group->names[igroup]));
|
||||
if (temperature == nullptr) {
|
||||
temperature = new ComputeTemp(lmp,3,arg);
|
||||
temperature = modify->compute[modify->ncompute-1];
|
||||
tcreate_flag = 1;
|
||||
} else temperature_nobias = new ComputeTemp(lmp,3,arg);
|
||||
delete [] arg;
|
||||
} else temperature_nobias = modify->compute[modify->ncompute-1];
|
||||
}
|
||||
|
||||
// initialize temperature computation(s)
|
||||
@ -401,8 +397,8 @@ void Velocity::create(double t_desired, int seed)
|
||||
// if temperature compute was created, delete it
|
||||
|
||||
delete random;
|
||||
if (tcreate_flag) delete temperature;
|
||||
if (temperature_nobias) delete temperature_nobias;
|
||||
if (tcreate_flag) modify->delete_compute("velocity_temp");
|
||||
if (temperature_nobias) modify->delete_compute("velocity_temp");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -578,7 +574,7 @@ void Velocity::scale(int /*narg*/, char **arg)
|
||||
|
||||
int tflag = 0;
|
||||
if (temperature == nullptr) {
|
||||
modify->add_compute(fmt::format("velocity_temp {} temp"));
|
||||
modify->add_compute(fmt::format("velocity_temp {} temp",group->names[igroup]));
|
||||
temperature = modify->compute[modify->ncompute-1];
|
||||
tflag = 1;
|
||||
}
|
||||
@ -608,7 +604,7 @@ void Velocity::scale(int /*narg*/, char **arg)
|
||||
|
||||
// if temperature was created, delete it
|
||||
|
||||
if (tflag) delete temperature;
|
||||
if (tflag) modify->delete_compute("velocity_temp");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user