fix bugs found by or avoid warnings from coverity scan

This commit is contained in:
Axel Kohlmeyer
2021-02-26 15:55:20 -05:00
parent 099dcedb7f
commit 09e33fd342
10 changed files with 12 additions and 5 deletions

View File

@ -59,6 +59,7 @@ FixWallBodyPolygon::FixWallBodyPolygon(LAMMPS *lmp, int narg, char **arg) :
restart_peratom = 1; restart_peratom = 1;
create_attribute = 1; create_attribute = 1;
wallstyle = -1;
// wall/particle coefficients // wall/particle coefficients
@ -96,7 +97,7 @@ FixWallBodyPolygon::FixWallBodyPolygon(LAMMPS *lmp, int narg, char **arg) :
lo = hi = 0.0; lo = hi = 0.0;
cylradius = utils::numeric(FLERR,arg[iarg+1],false,lmp); cylradius = utils::numeric(FLERR,arg[iarg+1],false,lmp);
iarg += 2; iarg += 2;
} } else error->all(FLERR,fmt::format("Unknown wall style {}",arg[iarg]));
// check for trailing keyword/values // check for trailing keyword/values

View File

@ -33,7 +33,7 @@ using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
using namespace MathConst; using namespace MathConst;
enum{XPLANE=0,YPLANE=1,ZPLANE}; // XYZ PLANE need to be 0,1,2 enum{XPLANE=0,YPLANE=1,ZPLANE=2}; // XYZ PLANE need to be 0,1,2
enum{HOOKE,HOOKE_HISTORY}; enum{HOOKE,HOOKE_HISTORY};
enum {INVALID=0,NONE=1,VERTEX=2}; enum {INVALID=0,NONE=1,VERTEX=2};
@ -59,6 +59,7 @@ FixWallBodyPolyhedron::FixWallBodyPolyhedron(LAMMPS *lmp, int narg, char **arg)
restart_peratom = 1; restart_peratom = 1;
create_attribute = 1; create_attribute = 1;
wallstyle = -1;
// wall/particle coefficients // wall/particle coefficients

View File

@ -473,6 +473,7 @@ double PairColloid::single(int /*i*/, int /*j*/, int itype, int jtype, double rs
double K[9],h[4],g[4]; double K[9],h[4],g[4];
double r,r2inv,r6inv,forcelj,c1,c2,phi,fR,dUR,dUA; double r,r2inv,r6inv,forcelj,c1,c2,phi,fR,dUR,dUA;
phi = 0.0;
switch (form[itype][jtype]) { switch (form[itype][jtype]) {
case SMALL_SMALL: case SMALL_SMALL:
r2inv = 1.0/rsq; r2inv = 1.0/rsq;

View File

@ -56,6 +56,7 @@ FixTFMC::FixTFMC(LAMMPS *lmp, int narg, char **arg) :
comflag = 0; comflag = 0;
rotflag = 0; rotflag = 0;
xflag = yflag = zflag = 0;
int iarg = 6; int iarg = 6;
while (iarg < narg) { while (iarg < narg) {

View File

@ -49,6 +49,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) :
scaleflag = 1; scaleflag = 1;
spatflag=0; spatflag=0;
spatialid = nullptr; spatialid = nullptr;
size = 0.0;
xloflag = xhiflag = yloflag = yhiflag = zloflag = zhiflag = 0; xloflag = xhiflag = yloflag = yhiflag = zloflag = zhiflag = 0;
tempflag = 0; tempflag = 0;

View File

@ -43,6 +43,7 @@ FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) :
tempflag = 0; tempflag = 0;
scaleflag = 1; scaleflag = 1;
roughflag = 0; roughflag = 0;
roughdist = 0.0;
rampflag = 0; rampflag = 0;
rampNL1flag = 0; rampNL1flag = 0;
rampNL2flag = 0; rampNL2flag = 0;

View File

@ -386,7 +386,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) :
// apply scaling factors and cylinder dims orthogonal to axis // apply scaling factors and cylinder dims orthogonal to axis
if (binflag) { if (binflag) {
double scale; double scale = 1.0;
if (which == ArgInfo::BIN1D || which == ArgInfo::BIN2D if (which == ArgInfo::BIN1D || which == ArgInfo::BIN2D
|| which == ArgInfo::BIN3D || which == ArgInfo::BINCYLINDER) { || which == ArgInfo::BIN3D || which == ArgInfo::BINCYLINDER) {
if (which == ArgInfo::BIN1D || which == ArgInfo::BINCYLINDER) ndim = 1; if (which == ArgInfo::BIN1D || which == ArgInfo::BINCYLINDER) ndim = 1;

View File

@ -50,7 +50,7 @@ ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) :
indexref = argi.get_index1(); indexref = argi.get_index1();
idref = argi.copy_name(); idref = argi.copy_name();
if ((whichref == ArgInfo::UNKNOWN) || (which[nvalues] == ArgInfo::NONE) if ((whichref == ArgInfo::UNKNOWN) || (whichref == ArgInfo::NONE)
|| (argi.get_dim() > 1)) || (argi.get_dim() > 1))
error->all(FLERR,"Illegal compute global/atom command"); error->all(FLERR,"Illegal compute global/atom command");

View File

@ -51,7 +51,7 @@ FixAveHistoWeight::FixAveHistoWeight(LAMMPS *lmp, int narg, char **arg) :
// check that length of 2 values is the same // check that length of 2 values is the same
int size[2]; int size[2] = {0,0};
for (int i = 0; i < nvalues; i++) { for (int i = 0; i < nvalues; i++) {
if (which[i] == ArgInfo::X || which[i] == ArgInfo::V || which[i] == ArgInfo::F) { if (which[i] == ArgInfo::X || which[i] == ArgInfo::V || which[i] == ArgInfo::F) {

View File

@ -54,6 +54,7 @@ Update::Update(LAMMPS *lmp) : Pointers(lmp)
eflag_atom = vflag_atom = 0; eflag_atom = vflag_atom = 0;
dt_default = 1; dt_default = 1;
dt = 0.0;
unit_style = nullptr; unit_style = nullptr;
set_units("lj"); set_units("lj");