T2345: Replace instances of NULL with nullptr
The following changes have been applied to src and lib folders: regex replace: ([^"_])NULL ⇒ \1nullptr (8968 chgs in src, 1153 in lib) Manually find/change: (void \*) nullptr ⇒ nullptr (1 case) regex find: ".*?nullptr.*?" Manually ~14 cases back to "NULL" in src, ~2 in lib regex finds a few false positive where nullptr appears between two strings in a function call
This commit is contained in:
@ -36,8 +36,8 @@ enum{PAIR,TAIL,KSPACE};
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeTI::ComputeTI(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg), nterms(0), which(NULL), ivar1(NULL), ivar2(NULL),
|
||||
ilo(NULL), ihi(NULL), var1(NULL), var2(NULL), pptr(NULL), pstyle(NULL)
|
||||
Compute(lmp, narg, arg), nterms(0), which(nullptr), ivar1(nullptr), ivar2(nullptr),
|
||||
ilo(nullptr), ihi(nullptr), var1(nullptr), var2(nullptr), pptr(nullptr), pstyle(nullptr)
|
||||
{
|
||||
if (narg < 4) error->all(FLERR,"Illegal compute ti command");
|
||||
|
||||
@ -64,7 +64,7 @@ ComputeTI::ComputeTI(LAMMPS *lmp, int narg, char **arg) :
|
||||
pptr = new Pair*[nterms];
|
||||
pstyle = new char*[nterms];
|
||||
|
||||
for (int m = 0; m < nterms; m++) pstyle[m] = NULL;
|
||||
for (int m = 0; m < nterms; m++) pstyle[m] = nullptr;
|
||||
|
||||
// parse keywords
|
||||
|
||||
@ -136,16 +136,16 @@ void ComputeTI::init()
|
||||
|
||||
if (which[m] == PAIR) {
|
||||
pptr[m] = force->pair_match(pstyle[m],1);
|
||||
if (pptr[m] == NULL)
|
||||
if (pptr[m] == nullptr)
|
||||
error->all(FLERR,"Compute ti pair style does not exist");
|
||||
|
||||
} else if (which[m] == TAIL) {
|
||||
if (force->pair == NULL || force->pair->tail_flag == 0)
|
||||
if (force->pair == nullptr || force->pair->tail_flag == 0)
|
||||
error->all(FLERR,"Compute ti tail when pair style does not "
|
||||
"compute tail corrections");
|
||||
|
||||
} else if (which[m] == KSPACE) {
|
||||
if (force->kspace == NULL)
|
||||
if (force->kspace == nullptr)
|
||||
error->all(FLERR,"Compute ti kspace style does not exist");
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ int xdr3dfcoord(XDR *, float *, int *, float *);
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
DumpXTC::DumpXTC(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg),
|
||||
coords(NULL)
|
||||
coords(nullptr)
|
||||
{
|
||||
if (narg != 5) error->all(FLERR,"Illegal dump xtc command");
|
||||
if (binary || compressed || multifile || multiproc)
|
||||
@ -62,7 +62,7 @@ DumpXTC::DumpXTC(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg),
|
||||
size_one = 3;
|
||||
sort_flag = 1;
|
||||
sortcol = 0;
|
||||
format_default = NULL;
|
||||
format_default = nullptr;
|
||||
flush_flag = 0;
|
||||
unwrap_flag = 0;
|
||||
precision = 1000.0;
|
||||
@ -137,9 +137,9 @@ void DumpXTC::init_style()
|
||||
void DumpXTC::openfile()
|
||||
{
|
||||
// XTC maintains it's own XDR file ptr
|
||||
// set fp to NULL so parent dump class will not use it
|
||||
// set fp to nullptr so parent dump class will not use it
|
||||
|
||||
fp = NULL;
|
||||
fp = nullptr;
|
||||
if (me == 0)
|
||||
if (xdropen(&xd,filename,"w") == 0) error->one(FLERR,"Cannot open dump file");
|
||||
}
|
||||
@ -364,8 +364,8 @@ void DumpXTC::write_frame()
|
||||
static FILE *xdrfiles[MAXID];
|
||||
static XDR *xdridptr[MAXID];
|
||||
static char xdrmodes[MAXID];
|
||||
static int *ip = NULL;
|
||||
static int *buf = NULL;
|
||||
static int *ip = nullptr;
|
||||
static int *buf = nullptr;
|
||||
|
||||
/*___________________________________________________________________________
|
||||
|
|
||||
@ -414,12 +414,12 @@ int xdropen(XDR *xdrs, const char *filename, const char *type)
|
||||
|
||||
if (init_done == 0) {
|
||||
for (xdrid = 1; xdrid < MAXID; xdrid++) {
|
||||
xdridptr[xdrid] = NULL;
|
||||
xdridptr[xdrid] = nullptr;
|
||||
}
|
||||
init_done = 1;
|
||||
}
|
||||
xdrid = 1;
|
||||
while (xdrid < MAXID && xdridptr[xdrid] != NULL) {
|
||||
while (xdrid < MAXID && xdridptr[xdrid] != nullptr) {
|
||||
xdrid++;
|
||||
}
|
||||
if (xdrid == MAXID) {
|
||||
@ -433,8 +433,8 @@ int xdropen(XDR *xdrs, const char *filename, const char *type)
|
||||
lmode = XDR_DECODE;
|
||||
}
|
||||
xdrfiles[xdrid] = fopen(filename, type);
|
||||
if (xdrfiles[xdrid] == NULL) {
|
||||
xdrs = NULL;
|
||||
if (xdrfiles[xdrid] == nullptr) {
|
||||
xdrs = nullptr;
|
||||
return 0;
|
||||
}
|
||||
xdrmodes[xdrid] = *type;
|
||||
@ -444,7 +444,7 @@ int xdropen(XDR *xdrs, const char *filename, const char *type)
|
||||
* (C users are expected to pass the address of an already allocated
|
||||
* XDR staructure)
|
||||
*/
|
||||
if (xdrs == NULL) {
|
||||
if (xdrs == nullptr) {
|
||||
xdridptr[xdrid] = (XDR *) malloc(sizeof(XDR));
|
||||
xdrstdio_create(xdridptr[xdrid], xdrfiles[xdrid], lmode);
|
||||
} else {
|
||||
@ -468,7 +468,7 @@ int xdrclose(XDR *xdrs)
|
||||
{
|
||||
int xdrid;
|
||||
|
||||
if (xdrs == NULL) {
|
||||
if (xdrs == nullptr) {
|
||||
fprintf(stderr, "xdrclose: passed a NULL pointer\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -477,7 +477,7 @@ int xdrclose(XDR *xdrs)
|
||||
|
||||
xdr_destroy(xdrs);
|
||||
fclose(xdrfiles[xdrid]);
|
||||
xdridptr[xdrid] = NULL;
|
||||
xdridptr[xdrid] = nullptr;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -495,8 +495,8 @@ void xdrfreebuf()
|
||||
{
|
||||
if (ip) free(ip);
|
||||
if (buf) free(buf);
|
||||
ip = NULL;
|
||||
buf = NULL;
|
||||
ip = nullptr;
|
||||
buf = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -815,28 +815,28 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision)
|
||||
}
|
||||
|
||||
xdr_float(xdrs, precision);
|
||||
if (ip == NULL) {
|
||||
if (ip == nullptr) {
|
||||
ip = (int *) malloc(size3 * sizeof(*ip));
|
||||
if (ip == NULL) {
|
||||
if (ip == nullptr) {
|
||||
fprintf(stderr,"malloc failed\n");
|
||||
exit(1);
|
||||
}
|
||||
bufsize = (int) (size3 * 1.2);
|
||||
buf = (int *) malloc(bufsize * sizeof(*buf));
|
||||
if (buf == NULL) {
|
||||
if (buf == nullptr) {
|
||||
fprintf(stderr,"malloc failed\n");
|
||||
exit(1);
|
||||
}
|
||||
oldsize = *size;
|
||||
} else if (*size > oldsize) {
|
||||
ip = (int *) realloc(ip, size3 * sizeof(*ip));
|
||||
if (ip == NULL) {
|
||||
if (ip == nullptr) {
|
||||
fprintf(stderr,"malloc failed\n");
|
||||
exit(1);
|
||||
}
|
||||
bufsize = (int) (size3 * 1.2);
|
||||
buf = (int *) realloc(buf, bufsize * sizeof(*buf));
|
||||
if (buf == NULL) {
|
||||
if (buf == nullptr) {
|
||||
fprintf(stderr,"malloc failed\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -1059,28 +1059,28 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision)
|
||||
(xdrproc_t)xdr_float));
|
||||
}
|
||||
xdr_float(xdrs, precision);
|
||||
if (ip == NULL) {
|
||||
if (ip == nullptr) {
|
||||
ip = (int *) malloc(size3 * sizeof(*ip));
|
||||
if (ip == NULL) {
|
||||
if (ip == nullptr) {
|
||||
fprintf(stderr,"malloc failed\n");
|
||||
exit(1);
|
||||
}
|
||||
bufsize = (int) (size3 * 1.2);
|
||||
buf = (int *) malloc(bufsize * sizeof(*buf));
|
||||
if (buf == NULL) {
|
||||
if (buf == nullptr) {
|
||||
fprintf(stderr,"malloc failed\n");
|
||||
exit(1);
|
||||
}
|
||||
oldsize = *size;
|
||||
} else if (*size > oldsize) {
|
||||
ip = (int *)realloc(ip, size3 * sizeof(*ip));
|
||||
if (ip == NULL) {
|
||||
if (ip == nullptr) {
|
||||
fprintf(stderr,"malloc failed\n");
|
||||
exit(1);
|
||||
}
|
||||
bufsize = (int) (size3 * 1.2);
|
||||
buf = (int *)realloc(buf, bufsize * sizeof(*buf));
|
||||
if (buf == NULL) {
|
||||
if (buf == nullptr) {
|
||||
fprintf(stderr,"malloc failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -44,9 +44,9 @@ enum{DIST_UNIFORM,DIST_GAUSSIAN};
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg), idregion(NULL), idrigid(NULL),
|
||||
idshake(NULL), onemols(NULL), molfrac(NULL), coords(NULL), imageflags(NULL),
|
||||
fixrigid(NULL), fixshake(NULL), random(NULL)
|
||||
Fix(lmp, narg, arg), idregion(nullptr), idrigid(nullptr),
|
||||
idshake(nullptr), onemols(nullptr), molfrac(nullptr), coords(nullptr), imageflags(nullptr),
|
||||
fixrigid(nullptr), fixshake(nullptr), random(nullptr)
|
||||
{
|
||||
if (narg < 7) error->all(FLERR,"Illegal fix deposit command");
|
||||
|
||||
@ -233,7 +233,7 @@ void FixDeposit::init()
|
||||
// if rigidflag defined, check for rigid/small fix
|
||||
// its molecule template must be same as this one
|
||||
|
||||
fixrigid = NULL;
|
||||
fixrigid = nullptr;
|
||||
if (rigidflag) {
|
||||
int ifix = modify->find_fix(idrigid);
|
||||
if (ifix < 0) error->all(FLERR,"Fix deposit rigid fix does not exist");
|
||||
@ -248,7 +248,7 @@ void FixDeposit::init()
|
||||
// if shakeflag defined, check for SHAKE fix
|
||||
// its molecule template must be same as this one
|
||||
|
||||
fixshake = NULL;
|
||||
fixshake = nullptr;
|
||||
if (shakeflag) {
|
||||
int ifix = modify->find_fix(idshake);
|
||||
if (ifix < 0) error->all(FLERR,"Fix deposit shake fix does not exist");
|
||||
@ -658,13 +658,13 @@ void FixDeposit::options(int narg, char **arg)
|
||||
// defaults
|
||||
|
||||
iregion = -1;
|
||||
idregion = NULL;
|
||||
idregion = nullptr;
|
||||
mode = ATOM;
|
||||
molfrac = NULL;
|
||||
molfrac = nullptr;
|
||||
rigidflag = 0;
|
||||
idrigid = NULL;
|
||||
idrigid = nullptr;
|
||||
shakeflag = 0;
|
||||
idshake = NULL;
|
||||
idshake = nullptr;
|
||||
idnext = 0;
|
||||
globalflag = localflag = 0;
|
||||
lo = hi = deltasq = 0.0;
|
||||
@ -904,5 +904,5 @@ void *FixDeposit::extract(const char *str, int &itype)
|
||||
return &oneradius;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -40,8 +40,8 @@ enum{NONE,CONSTANT,EQUAL,ATOM};
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg), xstr(NULL), ystr(NULL), zstr(NULL),
|
||||
estr(NULL), idregion(NULL), efield(NULL)
|
||||
Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr),
|
||||
estr(nullptr), idregion(nullptr), efield(nullptr)
|
||||
{
|
||||
if (narg < 6) error->all(FLERR,"Illegal fix efield command");
|
||||
|
||||
@ -57,7 +57,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) :
|
||||
virial_flag = 1;
|
||||
|
||||
qe2f = force->qe2f;
|
||||
xstr = ystr = zstr = NULL;
|
||||
xstr = ystr = zstr = nullptr;
|
||||
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
@ -89,8 +89,8 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) :
|
||||
// optional args
|
||||
|
||||
iregion = -1;
|
||||
idregion = NULL;
|
||||
estr = NULL;
|
||||
idregion = nullptr;
|
||||
estr = nullptr;
|
||||
|
||||
int iarg = 6;
|
||||
while (iarg < narg) {
|
||||
@ -272,7 +272,7 @@ void FixEfield::post_force(int vflag)
|
||||
|
||||
// update region if necessary
|
||||
|
||||
Region *region = NULL;
|
||||
Region *region = nullptr;
|
||||
if (iregion >= 0) {
|
||||
region = domain->regions[iregion];
|
||||
region->prematch();
|
||||
|
||||
@ -33,7 +33,7 @@ using namespace FixConst;
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg), idregion(NULL), list(NULL), mark(NULL), random(NULL)
|
||||
Fix(lmp, narg, arg), idregion(nullptr), list(nullptr), mark(nullptr), random(nullptr)
|
||||
{
|
||||
if (narg < 7) error->all(FLERR,"Illegal fix evaporate command");
|
||||
|
||||
@ -84,8 +84,8 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) :
|
||||
ndeleted = 0;
|
||||
|
||||
nmax = 0;
|
||||
list = NULL;
|
||||
mark = NULL;
|
||||
list = nullptr;
|
||||
mark = nullptr;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -41,7 +41,7 @@ using namespace FixConst;
|
||||
|
||||
FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
step_respa(NULL), prony_c(NULL), prony_tau(NULL), s_gld(NULL), random(NULL)
|
||||
step_respa(nullptr), prony_c(nullptr), prony_tau(nullptr), s_gld(nullptr), random(nullptr)
|
||||
{
|
||||
int narg_min = 8;
|
||||
// Check to make sure we have the minimal number of inputs
|
||||
@ -89,7 +89,7 @@ FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) :
|
||||
// allocate memory for Prony series timescale coefficients
|
||||
memory->create(prony_tau, prony_terms, "gld:prony_tau");
|
||||
// allocate memory for Prony series extended variables
|
||||
s_gld = NULL;
|
||||
s_gld = nullptr;
|
||||
grow_arrays(atom->nmax);
|
||||
// add callbacks to enable restarts
|
||||
atom->add_callback(0);
|
||||
|
||||
@ -35,7 +35,7 @@ FixOneWay::FixOneWay(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||
{
|
||||
direction = NONE;
|
||||
regionidx = 0;
|
||||
regionstr = NULL;
|
||||
regionstr = nullptr;
|
||||
|
||||
if (narg < 6) error->all(FLERR,"Illegal fix oneway command");
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ static const char cite_fix_orient_bcc[] =
|
||||
|
||||
FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
xifilename(NULL), chifilename(NULL), order(NULL), nbr(NULL), sort(NULL), list(NULL)
|
||||
xifilename(nullptr), chifilename(nullptr), order(nullptr), nbr(nullptr), sort(nullptr), list(nullptr)
|
||||
{
|
||||
if (lmp->citeme) lmp->citeme->add(cite_fix_orient_bcc);
|
||||
|
||||
@ -114,7 +114,7 @@ FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) :
|
||||
int count;
|
||||
|
||||
FILE *inpfile = fopen(xifilename,"r");
|
||||
if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
|
||||
if (inpfile == nullptr) error->one(FLERR,"Fix orient/bcc file open failed");
|
||||
for (int i = 0; i < 4; i++) {
|
||||
result = fgets(line,IMGMAX,inpfile);
|
||||
if (!result) error->one(FLERR,"Fix orient/bcc file read failed");
|
||||
@ -124,7 +124,7 @@ FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) :
|
||||
fclose(inpfile);
|
||||
|
||||
inpfile = fopen(chifilename,"r");
|
||||
if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
|
||||
if (inpfile == nullptr) error->one(FLERR,"Fix orient/bcc file open failed");
|
||||
for (int i = 0; i < 4; i++) {
|
||||
result = fgets(line,IMGMAX,inpfile);
|
||||
if (!result) error->one(FLERR,"Fix orient/bcc file read failed");
|
||||
|
||||
@ -53,8 +53,8 @@ static const char cite_fix_orient_fcc[] =
|
||||
|
||||
FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
xifilename(NULL), chifilename(NULL), order(NULL), nbr(NULL),
|
||||
sort(NULL), list(NULL)
|
||||
xifilename(nullptr), chifilename(nullptr), order(nullptr), nbr(nullptr),
|
||||
sort(nullptr), list(nullptr)
|
||||
{
|
||||
if (lmp->citeme) lmp->citeme->add(cite_fix_orient_fcc);
|
||||
|
||||
@ -112,7 +112,7 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) :
|
||||
int count;
|
||||
|
||||
FILE *inpfile = fopen(xifilename,"r");
|
||||
if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
|
||||
if (inpfile == nullptr) error->one(FLERR,"Fix orient/fcc file open failed");
|
||||
for (int i = 0; i < 6; i++) {
|
||||
result = fgets(line,IMGMAX,inpfile);
|
||||
if (!result) error->one(FLERR,"Fix orient/fcc file read failed");
|
||||
@ -122,7 +122,7 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) :
|
||||
fclose(inpfile);
|
||||
|
||||
inpfile = fopen(chifilename,"r");
|
||||
if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
|
||||
if (inpfile == nullptr) error->one(FLERR,"Fix orient/fcc file open failed");
|
||||
for (int i = 0; i < 6; i++) {
|
||||
result = fgets(line,IMGMAX,inpfile);
|
||||
if (!result) error->one(FLERR,"Fix orient/fcc file read failed");
|
||||
|
||||
@ -35,7 +35,7 @@ using namespace FixConst;
|
||||
FixThermalConductivity::FixThermalConductivity(LAMMPS *lmp,
|
||||
int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
index_lo(NULL), index_hi(NULL), ke_lo(NULL), ke_hi(NULL)
|
||||
index_lo(nullptr), index_hi(nullptr), ke_lo(nullptr), ke_hi(nullptr)
|
||||
{
|
||||
if (narg < 6) error->all(FLERR,"Illegal fix thermal/conductivity command");
|
||||
|
||||
|
||||
@ -42,11 +42,11 @@ using namespace FixConst;
|
||||
|
||||
FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
random(NULL), fp(NULL), nsum(NULL), nsum_all(NULL),
|
||||
gfactor1(NULL), gfactor2(NULL), ratio(NULL), flangevin(NULL),
|
||||
T_electron(NULL), T_electron_old(NULL), sum_vsq(NULL), sum_mass_vsq(NULL),
|
||||
sum_vsq_all(NULL), sum_mass_vsq_all(NULL), net_energy_transfer(NULL),
|
||||
net_energy_transfer_all(NULL)
|
||||
random(nullptr), fp(nullptr), nsum(nullptr), nsum_all(nullptr),
|
||||
gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), flangevin(nullptr),
|
||||
T_electron(nullptr), T_electron_old(nullptr), sum_vsq(nullptr), sum_mass_vsq(nullptr),
|
||||
sum_vsq_all(nullptr), sum_mass_vsq_all(nullptr), net_energy_transfer(nullptr),
|
||||
net_energy_transfer_all(nullptr)
|
||||
{
|
||||
if (narg < 15) error->all(FLERR,"Illegal fix ttm command");
|
||||
|
||||
@ -74,7 +74,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (narg != 16) error->all(FLERR,"Illegal fix ttm command");
|
||||
if (comm->me == 0) {
|
||||
fp = fopen(arg[15],"w");
|
||||
if (fp == NULL)
|
||||
if (fp == nullptr)
|
||||
error->one(FLERR,fmt::format("Cannot open output file {}: {}",
|
||||
arg[15], utils::getsyserror()));
|
||||
}
|
||||
@ -128,7 +128,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) :
|
||||
memory->create(net_energy_transfer_all,nxnodes,nynodes,nznodes,
|
||||
"TTM:net_energy_transfer_all");
|
||||
|
||||
flangevin = NULL;
|
||||
flangevin = nullptr;
|
||||
grow_arrays(atom->nmax);
|
||||
|
||||
// zero out the flangevin array
|
||||
@ -341,7 +341,7 @@ void FixTTM::read_initial_electron_temperatures(const char *filename)
|
||||
int ixnode,iynode,iznode;
|
||||
double T_tmp;
|
||||
while (1) {
|
||||
if (fgets(line,MAXLINE,fpr) == NULL) break;
|
||||
if (fgets(line,MAXLINE,fpr) == nullptr) break;
|
||||
ValueTokenizer values(line);
|
||||
if (values.has_next()) ixnode = values.next_int();
|
||||
if (values.has_next()) iynode = values.next_int();
|
||||
|
||||
@ -37,7 +37,7 @@ using namespace FixConst;
|
||||
|
||||
FixViscosity::FixViscosity(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
pos_index(NULL), neg_index(NULL), pos_delta(NULL), neg_delta(NULL)
|
||||
pos_index(nullptr), neg_index(nullptr), pos_delta(nullptr), neg_delta(nullptr)
|
||||
{
|
||||
if (narg < 7) error->all(FLERR,"Illegal fix viscosity command");
|
||||
|
||||
|
||||
@ -319,15 +319,15 @@ void PairNMCut::read_restart(FILE *fp)
|
||||
int me = comm->me;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i; j <= atom->ntypes; j++) {
|
||||
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error);
|
||||
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (setflag[i][j]) {
|
||||
if (me == 0) {
|
||||
utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
}
|
||||
MPI_Bcast(&e0[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world);
|
||||
@ -357,10 +357,10 @@ void PairNMCut::write_restart_settings(FILE *fp)
|
||||
void PairNMCut::read_restart_settings(FILE *fp)
|
||||
{
|
||||
if (comm->me == 0) {
|
||||
utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error);
|
||||
}
|
||||
MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&offset_flag,1,MPI_INT,0,world);
|
||||
@ -422,5 +422,5 @@ void *PairNMCut::extract(const char *str, int &dim)
|
||||
if (strcmp(str,"r0") == 0) return (void *) r0;
|
||||
if (strcmp(str,"nn") == 0) return (void *) nn;
|
||||
if (strcmp(str,"mm") == 0) return (void *) mm;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -370,16 +370,16 @@ void PairNMCutCoulCut::read_restart(FILE *fp)
|
||||
int me = comm->me;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i; j <= atom->ntypes; j++) {
|
||||
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error);
|
||||
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (setflag[i][j]) {
|
||||
if (me == 0) {
|
||||
utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
}
|
||||
MPI_Bcast(&e0[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world);
|
||||
@ -411,11 +411,11 @@ void PairNMCutCoulCut::write_restart_settings(FILE *fp)
|
||||
void PairNMCutCoulCut::read_restart_settings(FILE *fp)
|
||||
{
|
||||
if (comm->me == 0) {
|
||||
utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error);
|
||||
}
|
||||
MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world);
|
||||
@ -493,5 +493,5 @@ void *PairNMCutCoulCut::extract(const char *str, int &dim)
|
||||
if (strcmp(str,"r0") == 0) return (void *) r0;
|
||||
if (strcmp(str,"nn") == 0) return (void *) nn;
|
||||
if (strcmp(str,"mm") == 0) return (void *) mm;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ using namespace MathConst;
|
||||
PairNMCutCoulLong::PairNMCutCoulLong(LAMMPS *lmp) : Pair(lmp)
|
||||
{
|
||||
ewaldflag = pppmflag = 1;
|
||||
ftable = NULL;
|
||||
ftable = nullptr;
|
||||
qdist = 0.0;
|
||||
}
|
||||
|
||||
@ -308,13 +308,13 @@ void PairNMCutCoulLong::init_style()
|
||||
cut_coulsq = cut_coul * cut_coul;
|
||||
// insure use of KSpace long-range solver, set g_ewald
|
||||
|
||||
if (force->kspace == NULL)
|
||||
if (force->kspace == nullptr)
|
||||
error->all(FLERR,"Pair style requires a KSpace style");
|
||||
g_ewald = force->kspace->g_ewald;
|
||||
|
||||
// setup force tables
|
||||
|
||||
if (ncoultablebits) init_tables(cut_coul,NULL);
|
||||
if (ncoultablebits) init_tables(cut_coul,nullptr);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -414,15 +414,15 @@ void PairNMCutCoulLong::read_restart(FILE *fp)
|
||||
int me = comm->me;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i; j <= atom->ntypes; j++) {
|
||||
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error);
|
||||
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (setflag[i][j]) {
|
||||
if (me == 0) {
|
||||
utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
}
|
||||
MPI_Bcast(&e0[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world);
|
||||
@ -455,13 +455,13 @@ void PairNMCutCoulLong::write_restart_settings(FILE *fp)
|
||||
void PairNMCutCoulLong::read_restart_settings(FILE *fp)
|
||||
{
|
||||
if (comm->me == 0) {
|
||||
utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error);
|
||||
utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error);
|
||||
}
|
||||
MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world);
|
||||
@ -576,5 +576,5 @@ void *PairNMCutCoulLong::extract(const char *str, int &dim)
|
||||
if (strcmp(str,"r0") == 0) return (void *) r0;
|
||||
if (strcmp(str,"nn") == 0) return (void *) nn;
|
||||
if (strcmp(str,"mm") == 0) return (void *) mm;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -352,7 +352,7 @@ xdr_opaque (XDR *xdrs, char *cp, unsigned int cnt)
|
||||
/*
|
||||
* XDR null terminated ASCII strings
|
||||
* xdr_string deals with "C strings" - arrays of bytes that are
|
||||
* terminated by a NULL character. The parameter cpp references a
|
||||
* terminated by a nullptr character. The parameter cpp references a
|
||||
* pointer to storage; If the pointer is null, then the necessary
|
||||
* storage is allocated. The last parameter is the max allowed length
|
||||
* of the string as specified by a protocol.
|
||||
@ -370,13 +370,13 @@ xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize)
|
||||
switch (xdrs->x_op)
|
||||
{
|
||||
case XDR_FREE:
|
||||
if (sp == NULL)
|
||||
if (sp == nullptr)
|
||||
{
|
||||
return TRUE; /* already free */
|
||||
}
|
||||
/* fall through... */
|
||||
case XDR_ENCODE:
|
||||
if (sp == NULL)
|
||||
if (sp == nullptr)
|
||||
return FALSE;
|
||||
size = strlen (sp);
|
||||
break;
|
||||
@ -404,9 +404,9 @@ xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
if (sp == NULL)
|
||||
if (sp == nullptr)
|
||||
*cpp = sp = (char *) malloc (nodesize);
|
||||
if (sp == NULL)
|
||||
if (sp == nullptr)
|
||||
{
|
||||
(void) fputs ("xdr_string: out of memory\n", stderr);
|
||||
return FALSE;
|
||||
@ -419,7 +419,7 @@ xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize)
|
||||
|
||||
case XDR_FREE:
|
||||
free (sp);
|
||||
*cpp = NULL;
|
||||
*cpp = nullptr;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -660,7 +660,7 @@ xdrstdio_inline (XDR * /*xdrs*/, int /*len*/)
|
||||
* most of the gains to be had here and require storage
|
||||
* management on this buffer, so we don't do this.
|
||||
*/
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool_t
|
||||
|
||||
Reference in New Issue
Block a user