Merge branch 'master' into symbolic-atom-constants

This commit is contained in:
Axel Kohlmeyer
2020-09-15 17:44:31 -04:00
1186 changed files with 8448 additions and 8360 deletions

View File

@ -83,113 +83,113 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
nbondtypes = nangletypes = ndihedraltypes = nimpropertypes = 0;
nbonds = nangles = ndihedrals = nimpropers = 0;
firstgroupname = NULL;
firstgroupname = nullptr;
sortfreq = 1000;
nextsort = 0;
userbinsize = 0.0;
maxbin = maxnext = 0;
binhead = NULL;
next = permute = NULL;
binhead = nullptr;
next = permute = nullptr;
// data structure with info on per-atom vectors/arrays
nperatom = maxperatom = 0;
peratom = NULL;
peratom = nullptr;
// --------------------------------------------------------------------
// 1st customization section: customize by adding new per-atom variables
tag = NULL;
type = mask = NULL;
image = NULL;
x = v = f = NULL;
tag = nullptr;
type = mask = nullptr;
image = nullptr;
x = v = f = nullptr;
// charged and dipolar particles
q = NULL;
mu = NULL;
q = nullptr;
mu = nullptr;
// finite-size particles
omega = angmom = torque = NULL;
radius = rmass = NULL;
ellipsoid = line = tri = body = NULL;
omega = angmom = torque = nullptr;
radius = rmass = nullptr;
ellipsoid = line = tri = body = nullptr;
// molecular systems
molecule = NULL;
molindex = molatom = NULL;
molecule = nullptr;
molindex = molatom = nullptr;
bond_per_atom = extra_bond_per_atom = 0;
num_bond = NULL;
bond_type = NULL;
bond_atom = NULL;
num_bond = nullptr;
bond_type = nullptr;
bond_atom = nullptr;
angle_per_atom = extra_angle_per_atom = 0;
num_angle = NULL;
angle_type = NULL;
angle_atom1 = angle_atom2 = angle_atom3 = NULL;
num_angle = nullptr;
angle_type = nullptr;
angle_atom1 = angle_atom2 = angle_atom3 = nullptr;
dihedral_per_atom = extra_dihedral_per_atom = 0;
num_dihedral = NULL;
dihedral_type = NULL;
dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = NULL;
num_dihedral = nullptr;
dihedral_type = nullptr;
dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = nullptr;
improper_per_atom = extra_improper_per_atom = 0;
num_improper = NULL;
improper_type = NULL;
improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = NULL;
num_improper = nullptr;
improper_type = nullptr;
improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = nullptr;
maxspecial = 1;
nspecial = NULL;
special = NULL;
nspecial = nullptr;
special = nullptr;
// PERI package
vfrac = s0 = NULL;
x0 = NULL;
vfrac = s0 = nullptr;
x0 = nullptr;
// SPIN package
sp = fm = fm_long = NULL;
sp = fm = fm_long = nullptr;
// USER-EFF and USER-AWPMD packages
spin = NULL;
eradius = ervel = erforce = NULL;
ervelforce = NULL;
cs = csforce = vforce = NULL;
etag = NULL;
spin = nullptr;
eradius = ervel = erforce = nullptr;
ervelforce = nullptr;
cs = csforce = vforce = nullptr;
etag = nullptr;
// USER-DPD package
uCond = uMech = uChem = uCG = uCGnew = NULL;
duChem = dpdTheta = NULL;
uCond = uMech = uChem = uCG = uCGnew = nullptr;
duChem = dpdTheta = nullptr;
// USER-MESO package
cc = cc_flux = NULL;
edpd_temp = edpd_flux = edpd_cv = NULL;
cc = cc_flux = nullptr;
edpd_temp = edpd_flux = edpd_cv = nullptr;
// USER-MESONT package
length = NULL;
buckling = NULL;
bond_nt = NULL;
length = nullptr;
buckling = nullptr;
bond_nt = nullptr;
// USER-SMD package
contact_radius = NULL;
smd_data_9 = NULL;
smd_stress = NULL;
eff_plastic_strain = NULL;
eff_plastic_strain_rate = NULL;
damage = NULL;
contact_radius = nullptr;
smd_data_9 = nullptr;
smd_stress = nullptr;
eff_plastic_strain = nullptr;
eff_plastic_strain_rate = nullptr;
damage = nullptr;
// USER-SPH package
rho = drho = esph = desph = cv = NULL;
vest = NULL;
rho = drho = esph = desph = cv = nullptr;
vest = nullptr;
// end of customization section
// --------------------------------------------------------------------
@ -197,14 +197,14 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
// user-defined molecules
nmolecule = 0;
molecules = NULL;
molecules = nullptr;
// custom atom arrays
nivector = ndvector = 0;
ivector = NULL;
dvector = NULL;
iname = dname = NULL;
ivector = nullptr;
dvector = nullptr;
iname = dname = nullptr;
// initialize atom style and array existence flags
@ -216,16 +216,16 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
// ntype-length arrays
mass = NULL;
mass_setflag = NULL;
mass = nullptr;
mass_setflag = nullptr;
// callback lists & extra restart info
nextra_grow = nextra_restart = nextra_border = 0;
extra_grow = extra_restart = extra_border = NULL;
extra_grow = extra_restart = extra_border = nullptr;
nextra_grow_max = nextra_restart_max = nextra_border_max = 0;
nextra_store = 0;
extra = NULL;
extra = nullptr;
// default atom ID and mapping values
@ -235,15 +235,15 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
map_maxarray = map_nhash = map_nbucket = -1;
max_same = 0;
sametag = NULL;
map_array = NULL;
map_bucket = NULL;
map_hash = NULL;
sametag = nullptr;
map_array = nullptr;
map_bucket = nullptr;
map_hash = nullptr;
unique_tags = nullptr;
atom_style = NULL;
avec = NULL;
atom_style = nullptr;
avec = nullptr;
avec_map = new AtomVecCreatorMap();
@ -288,7 +288,7 @@ Atom::~Atom()
delete [] iname[i];
memory->destroy(ivector[i]);
}
if (dvector != NULL) {
if (dvector != nullptr) {
for (int i = 0; i < ndvector; i++) {
delete [] dname[i];
memory->destroy(dvector[i]);
@ -352,7 +352,7 @@ void Atom::peratom_create()
delete [] peratom[i].name;
memory->sfree(peratom);
peratom = NULL;
peratom = nullptr;
nperatom = maxperatom = 0;
// --------------------------------------------------------------------
@ -533,7 +533,7 @@ void Atom::add_peratom(const char *name, void *address,
peratom[nperatom].datatype = datatype;
peratom[nperatom].cols = cols;
peratom[nperatom].threadflag = threadflag;
peratom[nperatom].address_length = NULL;
peratom[nperatom].address_length = nullptr;
nperatom++;
}
@ -629,8 +629,8 @@ void Atom::create_avec(const std::string &style, int narg, char **arg, int trysu
{
delete [] atom_style;
if (avec) delete avec;
atom_style = NULL;
avec = NULL;
atom_style = nullptr;
avec = nullptr;
// unset atom style and array existence flags
// may have been set by old avec
@ -702,7 +702,7 @@ AtomVec *Atom::new_avec(const std::string &style, int trysuffix, int &sflag)
}
error->all(FLERR,utils::check_packages_for_style("atom",style,lmp));
return NULL;
return nullptr;
}
/* ----------------------------------------------------------------------
@ -723,7 +723,7 @@ void Atom::init()
if (nextra_store) {
memory->destroy(extra);
extra = NULL;
extra = nullptr;
nextra_store = 0;
}
@ -756,7 +756,7 @@ void Atom::setup()
/* ----------------------------------------------------------------------
return ptr to AtomVec class if matches style or to matching hybrid sub-class
return NULL if no match
return nullptr if no match
------------------------------------------------------------------------- */
AtomVec *Atom::style_match(const char *style)
@ -768,7 +768,7 @@ AtomVec *Atom::style_match(const char *style)
if (strcmp(avec_hybrid->keywords[i],style) == 0)
return avec_hybrid->styles[i];
}
return NULL;
return nullptr;
}
/* ----------------------------------------------------------------------
@ -807,7 +807,7 @@ void Atom::modify_params(int narg, char **arg)
if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command");
if (strcmp(arg[iarg+1],"all") == 0) {
delete [] firstgroupname;
firstgroupname = NULL;
firstgroupname = nullptr;
} else {
int n = strlen(arg[iarg+1]) + 1;
firstgroupname = new char[n];
@ -983,33 +983,33 @@ void Atom::deallocate_topology()
{
memory->destroy(atom->bond_type);
memory->destroy(atom->bond_atom);
atom->bond_type = NULL;
atom->bond_atom = NULL;
atom->bond_type = nullptr;
atom->bond_atom = nullptr;
memory->destroy(atom->angle_type);
memory->destroy(atom->angle_atom1);
memory->destroy(atom->angle_atom2);
memory->destroy(atom->angle_atom3);
atom->angle_type = NULL;
atom->angle_atom1 = atom->angle_atom2 = atom->angle_atom3 = NULL;
atom->angle_type = nullptr;
atom->angle_atom1 = atom->angle_atom2 = atom->angle_atom3 = nullptr;
memory->destroy(atom->dihedral_type);
memory->destroy(atom->dihedral_atom1);
memory->destroy(atom->dihedral_atom2);
memory->destroy(atom->dihedral_atom3);
memory->destroy(atom->dihedral_atom4);
atom->dihedral_type = NULL;
atom->dihedral_type = nullptr;
atom->dihedral_atom1 = atom->dihedral_atom2 =
atom->dihedral_atom3 = atom->dihedral_atom4 = NULL;
atom->dihedral_atom3 = atom->dihedral_atom4 = nullptr;
memory->destroy(atom->improper_type);
memory->destroy(atom->improper_atom1);
memory->destroy(atom->improper_atom2);
memory->destroy(atom->improper_atom3);
memory->destroy(atom->improper_atom4);
atom->improper_type = NULL;
atom->improper_type = nullptr;
atom->improper_atom1 = atom->improper_atom2 =
atom->improper_atom3 = atom->improper_atom4 = NULL;
atom->improper_atom3 = atom->improper_atom4 = nullptr;
}
/* ----------------------------------------------------------------------
@ -1108,11 +1108,11 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
next = strchr(buf,'\n');
values[0] = strtok(buf," \t\n\r\f");
if (values[0] == NULL)
if (values[0] == nullptr)
error->all(FLERR,"Incorrect atom format in data file");
for (m = 1; m < nwords; m++) {
values[m] = strtok(NULL," \t\n\r\f");
if (values[m] == NULL)
values[m] = strtok(nullptr," \t\n\r\f");
if (values[m] == nullptr)
error->all(FLERR,"Incorrect atom format in data file");
}
@ -1195,7 +1195,7 @@ void Atom::data_vels(int n, char *buf, tagint id_offset)
values[0] = strtok(buf," \t\n\r\f");
for (j = 1; j < nwords; j++)
values[j] = strtok(NULL," \t\n\r\f");
values[j] = strtok(nullptr," \t\n\r\f");
tagdata = ATOTAGINT(values[0]) + id_offset;
if (tagdata <= 0 || tagdata > map_tag_max)
@ -1210,7 +1210,7 @@ void Atom::data_vels(int n, char *buf, tagint id_offset)
/* ----------------------------------------------------------------------
process N bonds read into buf from data files
if count is non-NULL, just count bonds per atom
if count is non-nullptr, just count bonds per atom
else store them with atoms
check that atom IDs are > 0 and <= map_tag_max
------------------------------------------------------------------------- */
@ -1265,7 +1265,7 @@ void Atom::data_bonds(int n, char *buf, int *count, tagint id_offset,
/* ----------------------------------------------------------------------
process N angles read into buf from data files
if count is non-NULL, just count angles per atom
if count is non-nullptr, just count angles per atom
else store them with atoms
check that atom IDs are > 0 and <= map_tag_max
------------------------------------------------------------------------- */
@ -1337,7 +1337,7 @@ void Atom::data_angles(int n, char *buf, int *count, tagint id_offset,
/* ----------------------------------------------------------------------
process N dihedrals read into buf from data files
if count is non-NULL, just count diihedrals per atom
if count is non-nullptr, just count diihedrals per atom
else store them with atoms
check that atom IDs are > 0 and <= map_tag_max
------------------------------------------------------------------------- */
@ -1428,7 +1428,7 @@ void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset,
/* ----------------------------------------------------------------------
process N impropers read into buf from data files
if count is non-NULL, just count impropers per atom
if count is non-nullptr, just count impropers per atom
else store them with atoms
check that atom IDs are > 0 and <= map_tag_max
------------------------------------------------------------------------- */
@ -1547,7 +1547,7 @@ void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus, tagint id_offset)
values[0] = strtok(buf," \t\n\r\f");
for (j = 1; j < nwords; j++)
values[j] = strtok(NULL," \t\n\r\f");
values[j] = strtok(nullptr," \t\n\r\f");
tagdata = ATOTAGINT(values[0]) + id_offset;
if (tagdata <= 0 || tagdata > map_tag_max)
@ -1577,8 +1577,8 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset)
int maxint = 0;
int maxdouble = 0;
int *ivalues = NULL;
double *dvalues = NULL;
int *ivalues = nullptr;
double *dvalues = nullptr;
if (!unique_tags) unique_tags = new std::set<tagint>;
@ -1588,7 +1588,7 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset)
for (int i = 0; i < n; i++) {
if (i == 0) tagdata = ATOTAGINT(strtok(buf," \t\n\r\f")) + id_offset;
else tagdata = ATOTAGINT(strtok(NULL," \t\n\r\f")) + id_offset;
else tagdata = ATOTAGINT(strtok(nullptr," \t\n\r\f")) + id_offset;
if (tagdata <= 0 || tagdata > map_tag_max)
error->one(FLERR,"Invalid atom ID in Bodies section of data file");
@ -1598,8 +1598,8 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset)
else
error->one(FLERR,"Duplicate atom ID in Bodies section of data file");
ninteger = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp);
ndouble = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp);
ninteger = utils::inumeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp);
ndouble = utils::inumeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp);
if ((m = map(tagdata)) >= 0) {
if (ninteger > maxint) {
@ -1614,16 +1614,16 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset)
}
for (j = 0; j < ninteger; j++)
ivalues[j] = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp);
ivalues[j] = utils::inumeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp);
for (j = 0; j < ndouble; j++)
dvalues[j] = utils::numeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp);
dvalues[j] = utils::numeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp);
avec_body->data_body(m,ninteger,ndouble,ivalues,dvalues);
} else {
nvalues = ninteger + ndouble; // number of values to skip
for (j = 0; j < nvalues; j++)
strtok(NULL," \t\n\r\f");
strtok(nullptr," \t\n\r\f");
}
}
@ -1680,7 +1680,7 @@ void Atom::allocate_type_arrays()
void Atom::set_mass(const char *file, int line, const char *str, int type_offset)
{
if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style");
if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style");
int itype;
double mass_one;
@ -1704,7 +1704,7 @@ void Atom::set_mass(const char *file, int line, const char *str, int type_offset
void Atom::set_mass(const char *file, int line, int itype, double value)
{
if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style");
if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style");
if (itype < 1 || itype > ntypes)
error->all(file,line,"Invalid type for mass set");
@ -1721,7 +1721,7 @@ void Atom::set_mass(const char *file, int line, int itype, double value)
void Atom::set_mass(const char *file, int line, int /*narg*/, char **arg)
{
if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style");
if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style");
int lo,hi;
utils::bounds(file,line,arg[0],1,ntypes,lo,hi,error);
@ -1754,7 +1754,7 @@ void Atom::set_mass(double *values)
void Atom::check_mass(const char *file, int line)
{
if (mass == NULL) return;
if (mass == nullptr) return;
if (rmass_flag) return;
for (int itype = 1; itype <= ntypes; itype++)
if (mass_setflag[itype] == 0)
@ -1864,7 +1864,7 @@ void Atom::add_molecule(int narg, char **arg)
int Atom::find_molecule(char *id)
{
if(id == NULL) return -1;
if(id == nullptr) return -1;
int imol;
for (imol = 0; imol < nmolecule; imol++)
if (strcmp(id,molecules[imol]->id) == 0) return imol;
@ -2201,14 +2201,14 @@ void Atom::add_callback(int flag)
int ifix;
// find the fix
// if find NULL ptr:
// if find null pointer:
// it's this one, since it is being replaced and has just been deleted
// at this point in re-creation
// if don't find NULL ptr:
// if don't find null pointer:
// i is set to nfix = new one currently being added at end of list
for (ifix = 0; ifix < modify->nfix; ifix++)
if (modify->fix[ifix] == NULL) break;
if (modify->fix[ifix] == nullptr) break;
// add callback to lists and sort, reallocating if necessary
// sorting is required in cases where fixes were replaced as it ensures atom
@ -2249,7 +2249,7 @@ void Atom::add_callback(int flag)
void Atom::delete_callback(const char *id, int flag)
{
if (id == NULL) return;
if (id == nullptr) return;
int ifix = modify->find_fix(id);
@ -2310,7 +2310,7 @@ void Atom::update_callback(int ifix)
int Atom::find_custom(const char *name, int &flag)
{
if(name == NULL) return -1;
if(name == nullptr) return -1;
for (int i = 0; i < nivector; i++)
if (iname[i] && strcmp(iname[i],name) == 0) {
@ -2374,7 +2374,7 @@ int Atom::add_custom(const char *name, int flag)
\verbatim embed:rst
This will remove a property that was requested e.g. by the
:doc:`fix property/atom <fix_property_atom>` command. It frees the
allocated memory and sets the pointer to ``NULL`` to the entry in
allocated memory and sets the pointer to ``nullptr`` to the entry in
the list can be reused. The lists of those pointers will never be
compacted or never shrink, so that index to name mappings remain valid.
\endverbatim
@ -2386,14 +2386,14 @@ void Atom::remove_custom(int flag, int index)
{
if (flag == 0) {
memory->destroy(ivector[index]);
ivector[index] = NULL;
ivector[index] = nullptr;
delete [] iname[index];
iname[index] = NULL;
iname[index] = nullptr;
} else {
memory->destroy(dvector[index]);
dvector[index] = NULL;
dvector[index] = nullptr;
delete [] dname[index];
dname[index] = NULL;
dname[index] = nullptr;
}
}
@ -2483,7 +2483,7 @@ length of the data area, and a short description.
* - rmass
- double
- 1
- per-atom mass of the particles. ``NULL`` if per-type masses are
- per-atom mass of the particles. ``nullptr`` if per-type masses are
used. See the :cpp:func:`rmass_flag<lammps_extract_setting>` setting.
* - ellipsoid
- int
@ -2506,7 +2506,7 @@ length of the data area, and a short description.
*
* \param name string with the keyword of the desired property.
Typically the name of the pointer variable returned
* \return pointer to the requested data cast to ``void *`` or NULL */
* \return pointer to the requested data cast to ``void *`` or nullptr */
void *Atom::extract(const char *name)
{
@ -2577,7 +2577,7 @@ void *Atom::extract(const char *name)
// end of customization section
// --------------------------------------------------------------------
return NULL;
return nullptr;
}
/* ----------------------------------------------------------------------