address possible initialization issues reported by coverity scan

This commit is contained in:
Axel Kohlmeyer
2022-09-22 10:34:23 -04:00
parent 4f0cdcbe37
commit 2b27fd8acb
3 changed files with 8 additions and 13 deletions

View File

@ -377,11 +377,8 @@ void FixChargeRegulation::forward_acid() {
double energy_before = energy_stored;
double factor;
double dummyp[3];
double pos[3];
pos[0] = 0;
pos[1] = 0;
pos[2] = 0; // acid/base particle position
double pos_all[3];
double pos[3] = {0.0, 0.0, 0.0}; // acid/base particle position
double pos_all[3] = {0.0, 0.0, 0.0};
int m1 = -1, m2 = -1;
m1 = get_random_particle(acid_type, 0, 0, dummyp);

View File

@ -56,9 +56,9 @@ FixNVTSllodOMP::FixNVTSllodOMP(LAMMPS *lmp, int narg, char **arg) :
// id = fix-ID + temp
id_temp = utils::strdup(std::string(id) + "_temp");
modify->add_compute(fmt::format("{} {} temp/deform",
id_temp,group->names[igroup]));
modify->add_compute(fmt::format("{} {} temp/deform",id_temp,group->names[igroup]));
tcomputeflag = 1;
nondeformbias = 0;
}
/* ---------------------------------------------------------------------- */
@ -79,8 +79,7 @@ void FixNVTSllodOMP::init()
for (i = 0; i < modify->nfix; i++)
if (utils::strmatch(modify->fix[i]->style,"^deform")) {
if ((dynamic_cast<FixDeform *>(modify->fix[i]))->remapflag != Domain::V_REMAP)
error->all(FLERR,"Using fix nvt/sllod/omp with inconsistent fix "
"deform remap option");
error->all(FLERR,"Using fix nvt/sllod/omp with inconsistent fix deform remap option");
break;
}
if (i == modify->nfix)

View File

@ -51,9 +51,9 @@ FixNVTSllod::FixNVTSllod(LAMMPS *lmp, int narg, char **arg) :
// id = fix-ID + temp
id_temp = utils::strdup(std::string(id) + "_temp");
modify->add_compute(fmt::format("{} {} temp/deform",
id_temp,group->names[igroup]));
modify->add_compute(fmt::format("{} {} temp/deform",id_temp,group->names[igroup]));
tcomputeflag = 1;
nondeformbias = 0;
}
/* ---------------------------------------------------------------------- */
@ -74,8 +74,7 @@ void FixNVTSllod::init()
for (i = 0; i < modify->nfix; i++)
if (strncmp(modify->fix[i]->style,"deform",6) == 0) {
if ((dynamic_cast<FixDeform *>(modify->fix[i]))->remapflag != Domain::V_REMAP)
error->all(FLERR,"Using fix nvt/sllod with inconsistent fix deform "
"remap option");
error->all(FLERR,"Using fix nvt/sllod with inconsistent fix deform remap option");
break;
}
if (i == modify->nfix)