initialize pointers in constructor. removed commented out code

This commit is contained in:
Axel Kohlmeyer
2024-08-13 16:47:17 -04:00
parent fcaaca8304
commit 09af3e0fac
8 changed files with 29 additions and 47 deletions

View File

@ -27,7 +27,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
PairBPMSpring::PairBPMSpring(LAMMPS *_lmp) : Pair(_lmp)
PairBPMSpring::PairBPMSpring(LAMMPS *_lmp) : Pair(_lmp), k(nullptr), cut(nullptr), gamma(nullptr)
{
writedata = 1;
}
@ -210,7 +210,7 @@ void PairBPMSpring::coeff(int narg, char **arg)
void PairBPMSpring::init_style()
{
if (comm->ghost_velocity == 0)
error->all(FLERR,"Pair bpm/spring requires ghost atoms store velocity");
error->all(FLERR, "Pair bpm/spring requires ghost atoms store velocity");
neighbor->add_request(this);
}

View File

@ -44,8 +44,8 @@ static constexpr double SMALL = 0.001;
/* ---------------------------------------------------------------------- */
AngleSPICA::AngleSPICA(LAMMPS *lmp) :
Angle(lmp), k(nullptr), theta0(nullptr), lj_type(nullptr), lj1(nullptr), lj2(nullptr),
lj3(nullptr), lj4(nullptr), rminsq(nullptr), emin(nullptr)
Angle(lmp), k(nullptr), theta0(nullptr), repscale(nullptr), lj_type(nullptr), lj1(nullptr),
lj2(nullptr), lj3(nullptr), lj4(nullptr), rminsq(nullptr), emin(nullptr)
{
repflag = 0;
}

View File

@ -42,12 +42,14 @@ static constexpr double EPSILON = 1.0e-10;
/* ---------------------------------------------------------------------- */
PairDPDCoulSlaterLong::PairDPDCoulSlaterLong(LAMMPS *lmp) :
Pair(lmp), cut_dpd(nullptr), cut_dpdsq(nullptr), cut_slatersq(nullptr),
Pair(lmp), cut(nullptr), cut_dpd(nullptr), cut_dpdsq(nullptr), cut_slatersq(nullptr),
a0(nullptr), gamma(nullptr), sigma(nullptr), random(nullptr)
{
writedata = 1;
ewaldflag = pppmflag = 1;
respa_enable = 0;
cut_global = cut_coul = temperature = 0.0;
}
/* ---------------------------------------------------------------------- */

View File

@ -113,7 +113,8 @@ static int constexpr albemunu[21][4] = {
/* ---------------------------------------------------------------------- */
ComputeBornMatrix::ComputeBornMatrix(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), id_virial(nullptr), temp_x(nullptr), temp_f(nullptr)
Compute(lmp, narg, arg), values_local(nullptr), values_global(nullptr), list(nullptr),
id_virial(nullptr), compute_virial(nullptr), temp_x(nullptr), temp_f(nullptr)
{
if (narg < 3) error->all(FLERR, "Illegal compute born/matrix command");

View File

@ -30,7 +30,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
BondHarmonicRestrain::BondHarmonicRestrain(LAMMPS *_lmp) : Bond(_lmp), initial(nullptr)
BondHarmonicRestrain::BondHarmonicRestrain(LAMMPS *_lmp) : Bond(_lmp), k(nullptr), initial(nullptr)
{
writedata = 0;
natoms = -1;

View File

@ -35,7 +35,8 @@ enum { SCALAR, VECTOR, ARRAY };
ComputePODAtom::ComputePODAtom(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), list(nullptr), podptr(nullptr), pod(nullptr), tmpmem(nullptr),
rij(nullptr), elements(nullptr), map(nullptr)
rij(nullptr), elements(nullptr), map(nullptr), ai(nullptr), aj(nullptr), ti(nullptr),
tj(nullptr)
{
int nargmin = 6;
@ -167,34 +168,11 @@ void ComputePODAtom::compute_peratom()
for (int m = 0; m < Mdesc; m++) {
int mk = m + Mdesc*k;
pod[i][mk] = pd[k]*bd[m];
// for (int n=0; n<nij; n++) {
// int ain = 3*ai[n];
// int ajn = 3*aj[n];
// int nm = 3*n + 3*nij*m;
// int nk = 3*n + 3*nij*k;
// pod[1 + ain][imk] += bdd[0 + nm]*pd[k] + bd[m]*pdd[0+nk];
// pod[2 + ain][imk] += bdd[1 + nm]*pd[k] + bd[m]*pdd[1+nk];
// pod[3 + ain][imk] += bdd[2 + nm]*pd[k] + bd[m]*pdd[2+nk];
// pod[1 + ajn][imk] -= bdd[0 + nm]*pd[k] + bd[m]*pdd[0+nk];
// pod[2 + ajn][imk] -= bdd[1 + nm]*pd[k] + bd[m]*pdd[1+nk];
// pod[3 + ajn][imk] -= bdd[2 + nm]*pd[k] + bd[m]*pdd[2+nk];
// }
}
}
else {
for (int m = 0; m < Mdesc; m++) {
pod[i][m] = bd[m];
// for (int n=0; n<nij; n++) {
// int ain = 3*ai[n];
// int ajn = 3*aj[n];
// int nm = 3*n + 3*nij*m;
// pod[1 + ain][im] += bdd[0 + nm];
// pod[2 + ain][im] += bdd[1 + nm];
// pod[3 + ain][im] += bdd[2 + nm];
// pod[1 + ajn][im] -= bdd[0 + nm];
// pod[2 + ajn][im] -= bdd[1 + nm];
// pod[3 + ajn][im] -= bdd[2 + nm];
// }
}
}
}

View File

@ -42,8 +42,8 @@
#include "update.h"
#include "variable.h"
#include <cmath>
#include <cctype>
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
@ -51,22 +51,23 @@ using MathConst::DEG2RAD;
static constexpr double BIG = 1.0e20;
enum{NUMERIC,ATOM,TYPE,ELEMENT,ATTRIBUTE};
enum{SPHERE,LINE,TRI}; // also in some Body and Fix child classes
enum{STATIC,DYNAMIC};
enum{NO=0,YES=1};
enum { NUMERIC, ATOM, TYPE, ELEMENT, ATTRIBUTE };
enum { SPHERE, LINE, TRI }; // also in some Body and Fix child classes
enum { STATIC, DYNAMIC };
enum { NO = 0, YES = 1 };
/* ---------------------------------------------------------------------- */
DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
DumpCustom(lmp, narg, arg), thetastr(nullptr), phistr(nullptr), cxstr(nullptr),
cystr(nullptr), czstr(nullptr), upxstr(nullptr), upystr(nullptr), upzstr(nullptr),
zoomstr(nullptr), diamtype(nullptr), diamelement(nullptr),
bdiamtype(nullptr), colortype(nullptr), colorelement(nullptr), bcolortype(nullptr),
avec_line(nullptr), avec_tri(nullptr), avec_body(nullptr), fixptr(nullptr), image(nullptr),
chooseghost(nullptr), bufcopy(nullptr)
DumpCustom(lmp, narg, arg), thetastr(nullptr), phistr(nullptr), cxstr(nullptr), cystr(nullptr),
czstr(nullptr), upxstr(nullptr), upystr(nullptr), upzstr(nullptr), zoomstr(nullptr),
diamtype(nullptr), diamelement(nullptr), bdiamtype(nullptr), colortype(nullptr),
colorelement(nullptr), bcolortype(nullptr), grid2d(nullptr), grid3d(nullptr),
id_grid_compute(nullptr), id_grid_fix(nullptr), grid_compute(nullptr), grid_fix(nullptr),
gbuf(nullptr), avec_line(nullptr), avec_tri(nullptr), avec_body(nullptr), fixptr(nullptr),
image(nullptr), chooseghost(nullptr), bufcopy(nullptr)
{
if (binary || multiproc) error->all(FLERR,"Invalid dump image filename");
if (binary || multiproc) error->all(FLERR, "Invalid dump image filename");
// force binary flag on to avoid corrupted output on Windows

View File

@ -451,10 +451,10 @@ void FixAveGrid::init()
// check that grid sizes for all fields match grid size for this fix
if (modegrid) {
Compute *compute;
Fix *fix;
Grid2d *grid2d;
Grid3d *grid3d;
Compute *compute = nullptr;
Fix *fix = nullptr;
Grid2d *grid2d = nullptr;
Grid3d *grid3d = nullptr;
int nxtmp,nytmp,nztmp;