move initialization of all pointers to null to initializer list
This commit is contained in:
38
src/pair.cpp
38
src/pair.cpp
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -32,16 +31,17 @@
|
|||||||
#include "suffix.h"
|
#include "suffix.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
|
||||||
#include <cfloat> // IWYU pragma: keep
|
#include <cfloat> // IWYU pragma: keep
|
||||||
#include <climits> // IWYU pragma: keep
|
#include <climits> // IWYU pragma: keep
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace MathConst;
|
using namespace MathConst;
|
||||||
|
|
||||||
enum{NONE,RLINEAR,RSQ,BMP};
|
enum { NONE, RLINEAR, RSQ, BMP };
|
||||||
static const std::string mixing_rule_names[Pair::SIXTHPOWER+1] = {"geometric", "arithmetic", "sixthpower" };
|
static const std::string mixing_rule_names[Pair::SIXTHPOWER + 1] = {"geometric", "arithmetic",
|
||||||
|
"sixthpower"};
|
||||||
|
|
||||||
// allocate space for static class instance variable and initialize it
|
// 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++;
|
instance_me = instance_total++;
|
||||||
|
|
||||||
@ -71,12 +79,7 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
|
|||||||
did_mix = false;
|
did_mix = false;
|
||||||
|
|
||||||
nextra = 0;
|
nextra = 0;
|
||||||
pvector = nullptr;
|
|
||||||
single_extra = 0;
|
single_extra = 0;
|
||||||
svector = nullptr;
|
|
||||||
|
|
||||||
setflag = nullptr;
|
|
||||||
cutsq = nullptr;
|
|
||||||
|
|
||||||
ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = dipoleflag = spinflag = 0;
|
ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = dipoleflag = spinflag = 0;
|
||||||
reinitflag = 1;
|
reinitflag = 1;
|
||||||
@ -95,27 +98,16 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
|
|||||||
ndisptablebits = 12;
|
ndisptablebits = 12;
|
||||||
tabinner = sqrt(2.0);
|
tabinner = sqrt(2.0);
|
||||||
tabinner_disp = sqrt(2.0);
|
tabinner_disp = sqrt(2.0);
|
||||||
ftable = nullptr;
|
|
||||||
fdisptable = nullptr;
|
|
||||||
trim_flag = 1;
|
trim_flag = 1;
|
||||||
|
|
||||||
allocated = 0;
|
allocated = 0;
|
||||||
suffix_flag = Suffix::NONE;
|
suffix_flag = Suffix::NONE;
|
||||||
|
|
||||||
maxeatom = maxvatom = maxcvatom = 0;
|
maxeatom = maxvatom = maxcvatom = 0;
|
||||||
eatom = nullptr;
|
|
||||||
vatom = nullptr;
|
|
||||||
cvatom = nullptr;
|
|
||||||
|
|
||||||
num_tally_compute = 0;
|
num_tally_compute = 0;
|
||||||
list_tally_compute = nullptr;
|
|
||||||
|
|
||||||
nelements = nparams = maxparam = 0;
|
nelements = nparams = maxparam = 0;
|
||||||
elements = nullptr;
|
|
||||||
elem1param = nullptr;
|
|
||||||
elem2param = nullptr;
|
|
||||||
elem3param = nullptr;
|
|
||||||
map = nullptr;
|
|
||||||
|
|
||||||
nondefault_history_transfer = 0;
|
nondefault_history_transfer = 0;
|
||||||
beyond_contact = 0;
|
beyond_contact = 0;
|
||||||
@ -151,6 +143,8 @@ Pair::~Pair()
|
|||||||
memory->destroy(cvatom);
|
memory->destroy(cvatom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
modify parameters of the pair style
|
modify parameters of the pair style
|
||||||
pair_hybrid has its own version of this routine
|
pair_hybrid has its own version of this routine
|
||||||
|
|||||||
Reference in New Issue
Block a user