From 70ce971d4aa2b1312df2667c5ffb42eae922216a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 14 May 2021 08:39:47 -0400 Subject: [PATCH] address some warnings from coverity scan --- src/USER-BROWNIAN/fix_brownian_asphere.cpp | 4 ++-- src/USER-BROWNIAN/fix_brownian_base.cpp | 3 ++- src/USER-BROWNIAN/fix_propel_self.cpp | 3 ++- src/USER-REACTION/fix_bond_react.cpp | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/USER-BROWNIAN/fix_brownian_asphere.cpp b/src/USER-BROWNIAN/fix_brownian_asphere.cpp index e7b6eb2728..f7d39c4792 100644 --- a/src/USER-BROWNIAN/fix_brownian_asphere.cpp +++ b/src/USER-BROWNIAN/fix_brownian_asphere.cpp @@ -38,8 +38,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixBrownianAsphere::FixBrownianAsphere(LAMMPS *lmp, int narg, char **arg) : - FixBrownianBase(lmp, narg, arg) +FixBrownianAsphere::FixBrownianAsphere(LAMMPS *lmp, int narg, char **arg) + : FixBrownianBase(lmp, narg, arg), avec(nullptr) { if (!gamma_t_eigen_flag || !gamma_r_eigen_flag) { error->all(FLERR, "Illegal fix brownian command."); diff --git a/src/USER-BROWNIAN/fix_brownian_base.cpp b/src/USER-BROWNIAN/fix_brownian_base.cpp index 93990681bd..2e6a3dff46 100644 --- a/src/USER-BROWNIAN/fix_brownian_base.cpp +++ b/src/USER-BROWNIAN/fix_brownian_base.cpp @@ -46,6 +46,7 @@ FixBrownianBase::FixBrownianBase(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n gamma_t_flag = gamma_r_flag = 0; gamma_t_eigen_flag = gamma_r_eigen_flag = 0; dipole_flag = 0; + g2 = 0.0; if (narg < 5) error->all(FLERR, "Illegal fix brownian command."); @@ -201,7 +202,7 @@ void FixBrownianBase::init() g1 = force->ftm2v; if (noise_flag == 0) { - g2 = 0; + g2 = 0.0; } else if (gaussian_noise_flag == 1) { g2 = sqrt(2 * force->boltz * temp / dt / force->mvv2e); } else { diff --git a/src/USER-BROWNIAN/fix_propel_self.cpp b/src/USER-BROWNIAN/fix_propel_self.cpp index 9adb49d039..f7cc0bc2be 100644 --- a/src/USER-BROWNIAN/fix_propel_self.cpp +++ b/src/USER-BROWNIAN/fix_propel_self.cpp @@ -42,7 +42,8 @@ enum { DIPOLE, VELOCITY, QUAT }; /* ---------------------------------------------------------------------- */ -FixPropelSelf::FixPropelSelf(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) +FixPropelSelf::FixPropelSelf(LAMMPS *lmp, int narg, char **arg) + : Fix(lmp, narg, arg), avec(nullptr) { virial_global_flag = virial_peratom_flag = 1; diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 14191cb10d..fc6c8cce23 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -2212,6 +2212,7 @@ double FixBondReact::rxnfunction(std::string rxnfunc, std::string varid, if (rxnfunc == "rxnsum") return sumvvec; if (rxnfunc == "rxnave") return sumvvec/nsum; + return 0.0; } /* ----------------------------------------------------------------------