move initialization of all pointers to null to initializer list

This commit is contained in:
Axel Kohlmeyer
2023-03-26 17:26:47 -04:00
parent d31f754451
commit a1a0186438

View File

@ -1,4 +1,3 @@
// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@ -32,16 +31,17 @@
#include "suffix.h"
#include "update.h"
#include <cfloat> // IWYU pragma: keep
#include <climits> // IWYU pragma: keep
#include <cfloat> // IWYU pragma: keep
#include <climits> // IWYU pragma: keep
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS;
using namespace MathConst;
enum{NONE,RLINEAR,RSQ,BMP};
static const std::string mixing_rule_names[Pair::SIXTHPOWER+1] = {"geometric", "arithmetic", "sixthpower" };
enum { NONE, RLINEAR, RSQ, BMP };
static const std::string mixing_rule_names[Pair::SIXTHPOWER + 1] = {"geometric", "arithmetic",
"sixthpower"};
// allocate space for static class instance variable and initialize it
@ -49,7 +49,15 @@ int Pair::instance_total = 0;
/* ---------------------------------------------------------------------- */
Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
Pair::Pair(LAMMPS *lmp) :
Pointers(lmp), eatom(nullptr), vatom(nullptr), cvatom(nullptr), cutsq(nullptr),
setflag(nullptr), cutghost(nullptr), rtable(nullptr), drtable(nullptr), ftable(nullptr),
dftable(nullptr), ctable(nullptr), dctable(nullptr), etable(nullptr), detable(nullptr),
ptable(nullptr), dptable(nullptr), vtable(nullptr), dvtable(nullptr), rdisptable(nullptr),
drdisptable(nullptr), fdisptable(nullptr), dfdisptable(nullptr), edisptable(nullptr),
dedisptable(nullptr), pvector(nullptr), svector(nullptr), list(nullptr), listhalf(nullptr),
listfull(nullptr), list_tally_compute(nullptr), elements(nullptr), elem1param(nullptr),
elem2param(nullptr), elem3param(nullptr), map(nullptr)
{
instance_me = instance_total++;
@ -71,12 +79,7 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
did_mix = false;
nextra = 0;
pvector = nullptr;
single_extra = 0;
svector = nullptr;
setflag = nullptr;
cutsq = nullptr;
ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = dipoleflag = spinflag = 0;
reinitflag = 1;
@ -95,27 +98,16 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
ndisptablebits = 12;
tabinner = sqrt(2.0);
tabinner_disp = sqrt(2.0);
ftable = nullptr;
fdisptable = nullptr;
trim_flag = 1;
allocated = 0;
suffix_flag = Suffix::NONE;
maxeatom = maxvatom = maxcvatom = 0;
eatom = nullptr;
vatom = nullptr;
cvatom = nullptr;
num_tally_compute = 0;
list_tally_compute = nullptr;
nelements = nparams = maxparam = 0;
elements = nullptr;
elem1param = nullptr;
elem2param = nullptr;
elem3param = nullptr;
map = nullptr;
nondefault_history_transfer = 0;
beyond_contact = 0;
@ -151,6 +143,8 @@ Pair::~Pair()
memory->destroy(cvatom);
}
// clang-format off
/* ----------------------------------------------------------------------
modify parameters of the pair style
pair_hybrid has its own version of this routine