clang-format
This commit is contained in:
@ -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
|
||||||
@ -47,8 +46,7 @@ void CreateBonds::command(int narg, char **arg)
|
|||||||
{
|
{
|
||||||
if (domain->box_exist == 0)
|
if (domain->box_exist == 0)
|
||||||
error->all(FLERR, "Create_bonds command before simulation box is defined");
|
error->all(FLERR, "Create_bonds command before simulation box is defined");
|
||||||
if (atom->tag_enable == 0)
|
if (atom->tag_enable == 0) error->all(FLERR, "Cannot use create_bonds unless atoms have IDs");
|
||||||
error->all(FLERR,"Cannot use create_bonds unless atoms have IDs");
|
|
||||||
if (atom->molecular != Atom::MOLECULAR)
|
if (atom->molecular != Atom::MOLECULAR)
|
||||||
error->all(FLERR, "Cannot use create_bonds with non-molecular system");
|
error->all(FLERR, "Cannot use create_bonds with non-molecular system");
|
||||||
|
|
||||||
@ -79,8 +77,7 @@ void CreateBonds::command(int narg, char **arg)
|
|||||||
btype = utils::inumeric(FLERR, arg[1], false, lmp);
|
btype = utils::inumeric(FLERR, arg[1], false, lmp);
|
||||||
batom1 = utils::tnumeric(FLERR, arg[2], false, lmp);
|
batom1 = utils::tnumeric(FLERR, arg[2], false, lmp);
|
||||||
batom2 = utils::tnumeric(FLERR, arg[3], false, lmp);
|
batom2 = utils::tnumeric(FLERR, arg[3], false, lmp);
|
||||||
if (batom1 == batom2)
|
if (batom1 == batom2) error->all(FLERR, "Illegal create_bonds command");
|
||||||
error->all(FLERR,"Illegal create_bonds command");
|
|
||||||
iarg = 4;
|
iarg = 4;
|
||||||
} else if (strcmp(arg[0], "single/angle") == 0) {
|
} else if (strcmp(arg[0], "single/angle") == 0) {
|
||||||
style = SANGLE;
|
style = SANGLE;
|
||||||
@ -100,8 +97,8 @@ void CreateBonds::command(int narg, char **arg)
|
|||||||
datom2 = utils::tnumeric(FLERR, arg[3], false, lmp);
|
datom2 = utils::tnumeric(FLERR, arg[3], false, lmp);
|
||||||
datom3 = utils::tnumeric(FLERR, arg[4], false, lmp);
|
datom3 = utils::tnumeric(FLERR, arg[4], false, lmp);
|
||||||
datom4 = utils::tnumeric(FLERR, arg[5], false, lmp);
|
datom4 = utils::tnumeric(FLERR, arg[5], false, lmp);
|
||||||
if ((datom1 == datom2) || (datom1 == datom3) || (datom1 == datom4) ||
|
if ((datom1 == datom2) || (datom1 == datom3) || (datom1 == datom4) || (datom2 == datom3) ||
|
||||||
(datom2 == datom3) || (datom2 == datom4) || (datom3 == datom4))
|
(datom2 == datom4) || (datom3 == datom4))
|
||||||
error->all(FLERR, "Illegal create_bonds command");
|
error->all(FLERR, "Illegal create_bonds command");
|
||||||
iarg = 6;
|
iarg = 6;
|
||||||
} else if (strcmp(arg[0], "single/improper") == 0) {
|
} else if (strcmp(arg[0], "single/improper") == 0) {
|
||||||
@ -112,11 +109,12 @@ void CreateBonds::command(int narg, char **arg)
|
|||||||
datom2 = utils::tnumeric(FLERR, arg[3], false, lmp);
|
datom2 = utils::tnumeric(FLERR, arg[3], false, lmp);
|
||||||
datom3 = utils::tnumeric(FLERR, arg[4], false, lmp);
|
datom3 = utils::tnumeric(FLERR, arg[4], false, lmp);
|
||||||
datom4 = utils::tnumeric(FLERR, arg[5], false, lmp);
|
datom4 = utils::tnumeric(FLERR, arg[5], false, lmp);
|
||||||
if ((datom1 == datom2) || (datom1 == datom3) || (datom1 == datom4) ||
|
if ((datom1 == datom2) || (datom1 == datom3) || (datom1 == datom4) || (datom2 == datom3) ||
|
||||||
(datom2 == datom3) || (datom2 == datom4) || (datom3 == datom4))
|
(datom2 == datom4) || (datom3 == datom4))
|
||||||
error->all(FLERR, "Illegal create_bonds command");
|
error->all(FLERR, "Illegal create_bonds command");
|
||||||
iarg = 6;
|
iarg = 6;
|
||||||
} else error->all(FLERR,"Illegal create_bonds command");
|
} else
|
||||||
|
error->all(FLERR, "Illegal create_bonds command");
|
||||||
|
|
||||||
// optional args
|
// optional args
|
||||||
|
|
||||||
@ -127,7 +125,8 @@ void CreateBonds::command(int narg, char **arg)
|
|||||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal create_bonds command");
|
if (iarg + 2 > narg) error->all(FLERR, "Illegal create_bonds command");
|
||||||
specialflag = utils::logical(FLERR, arg[iarg + 1], false, lmp);
|
specialflag = utils::logical(FLERR, arg[iarg + 1], false, lmp);
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else error->all(FLERR,"Illegal create_bonds command");
|
} else
|
||||||
|
error->all(FLERR, "Illegal create_bonds command");
|
||||||
}
|
}
|
||||||
|
|
||||||
// error checks
|
// error checks
|
||||||
@ -135,8 +134,7 @@ void CreateBonds::command(int narg, char **arg)
|
|||||||
if (style == MANY) {
|
if (style == MANY) {
|
||||||
if (btype <= 0 || btype > atom->nbondtypes)
|
if (btype <= 0 || btype > atom->nbondtypes)
|
||||||
error->all(FLERR, "Invalid bond type in create_bonds command");
|
error->all(FLERR, "Invalid bond type in create_bonds command");
|
||||||
if (specialflag == 0)
|
if (specialflag == 0) error->all(FLERR, "Cannot use special no with create_bonds many");
|
||||||
error->all(FLERR,"Cannot use special no with create_bonds many");
|
|
||||||
} else if (style == SBOND) {
|
} else if (style == SBOND) {
|
||||||
if (btype <= 0 || btype > atom->nbondtypes)
|
if (btype <= 0 || btype > atom->nbondtypes)
|
||||||
error->all(FLERR, "Invalid bond type in create_bonds command");
|
error->all(FLERR, "Invalid bond type in create_bonds command");
|
||||||
@ -153,11 +151,16 @@ void CreateBonds::command(int narg, char **arg)
|
|||||||
|
|
||||||
// invoke creation method
|
// invoke creation method
|
||||||
|
|
||||||
if (style == MANY) many();
|
if (style == MANY)
|
||||||
else if (style == SBOND) single_bond();
|
many();
|
||||||
else if (style == SANGLE) single_angle();
|
else if (style == SBOND)
|
||||||
else if (style == SDIHEDRAL) single_dihedral();
|
single_bond();
|
||||||
else if (style == SIMPROPER) single_improper();
|
else if (style == SANGLE)
|
||||||
|
single_angle();
|
||||||
|
else if (style == SDIHEDRAL)
|
||||||
|
single_dihedral();
|
||||||
|
else if (style == SIMPROPER)
|
||||||
|
single_improper();
|
||||||
|
|
||||||
// trigger special list build
|
// trigger special list build
|
||||||
|
|
||||||
@ -190,8 +193,7 @@ void CreateBonds::many()
|
|||||||
// error check on cutoff
|
// error check on cutoff
|
||||||
// if no pair style, neighbor list will be empty
|
// if no pair style, neighbor list will be empty
|
||||||
|
|
||||||
if (force->pair == nullptr)
|
if (force->pair == nullptr) error->all(FLERR, "Create_bonds requires a pair style be defined");
|
||||||
error->all(FLERR,"Create_bonds requires a pair style be defined");
|
|
||||||
if (rmax > neighbor->cutneighmax)
|
if (rmax > neighbor->cutneighmax)
|
||||||
error->all(FLERR, "Create_bonds max distance > neighbor cutoff");
|
error->all(FLERR, "Create_bonds max distance > neighbor cutoff");
|
||||||
if (rmax > neighbor->cutneighmin && comm->me == 0)
|
if (rmax > neighbor->cutneighmin && comm->me == 0)
|
||||||
@ -204,11 +206,8 @@ void CreateBonds::many()
|
|||||||
// note that with KSpace, pair with weight = 0 could still be in neigh list
|
// note that with KSpace, pair with weight = 0 could still be in neigh list
|
||||||
|
|
||||||
if (force->special_lj[1] != 0.0 || force->special_coul[1] != 0.0)
|
if (force->special_lj[1] != 0.0 || force->special_coul[1] != 0.0)
|
||||||
error->all(FLERR,"Create_bonds command requires "
|
error->all(FLERR, "Create_bonds command requires special_bonds 1-2 weights be 0.0");
|
||||||
"special_bonds 1-2 weights be 0.0");
|
if (force->kspace) error->all(FLERR, "Create_bonds command requires no kspace_style be defined");
|
||||||
if (force->kspace)
|
|
||||||
error->all(FLERR,"Create_bonds command requires "
|
|
||||||
"no kspace_style be defined");
|
|
||||||
|
|
||||||
// setup domain, communication and neighboring
|
// setup domain, communication and neighboring
|
||||||
// acquire ghosts and build standard neighbor lists
|
// acquire ghosts and build standard neighbor lists
|
||||||
@ -275,7 +274,8 @@ void CreateBonds::many()
|
|||||||
delx = x[j][0] - xtmp;
|
delx = x[j][0] - xtmp;
|
||||||
dely = x[j][1] - ytmp;
|
dely = x[j][1] - ytmp;
|
||||||
delz = x[j][2] - ztmp;
|
delz = x[j][2] - ztmp;
|
||||||
} else continue;
|
} else
|
||||||
|
continue;
|
||||||
rsq = delx * delx + dely * dely + delz * delz;
|
rsq = delx * delx + dely * dely + delz * delz;
|
||||||
if (rsq < rminsq || rsq > rmaxsq) continue;
|
if (rsq < rminsq || rsq > rmaxsq) continue;
|
||||||
|
|
||||||
@ -291,8 +291,8 @@ void CreateBonds::many()
|
|||||||
|
|
||||||
if (!newton_bond || tag[i] < tag[j]) {
|
if (!newton_bond || tag[i] < tag[j]) {
|
||||||
if (num_bond[i] == atom->bond_per_atom)
|
if (num_bond[i] == atom->bond_per_atom)
|
||||||
error->one(FLERR,"New bond exceeded bonds per atom limit "
|
error->one(FLERR, "New bond exceeded bonds per atom limit of {} in create_bonds",
|
||||||
" of {} in create_bonds",atom->bond_per_atom);
|
atom->bond_per_atom);
|
||||||
bond_type[i][num_bond[i]] = btype;
|
bond_type[i][num_bond[i]] = btype;
|
||||||
bond_atom[i][num_bond[i]] = tag[j];
|
bond_atom[i][num_bond[i]] = tag[j];
|
||||||
num_bond[i]++;
|
num_bond[i]++;
|
||||||
@ -313,8 +313,7 @@ void CreateBonds::many()
|
|||||||
bigint nadd_bonds = atom->nbonds - nbonds_previous;
|
bigint nadd_bonds = atom->nbonds - nbonds_previous;
|
||||||
|
|
||||||
if (comm->me == 0)
|
if (comm->me == 0)
|
||||||
utils::logmesg(lmp,"Added {} bonds, new total = {}\n",
|
utils::logmesg(lmp, "Added {} bonds, new total = {}\n", nadd_bonds, atom->nbonds);
|
||||||
nadd_bonds,atom->nbonds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -335,8 +334,7 @@ void CreateBonds::single_bond()
|
|||||||
|
|
||||||
int allcount;
|
int allcount;
|
||||||
MPI_Allreduce(&count, &allcount, 1, MPI_INT, MPI_SUM, world);
|
MPI_Allreduce(&count, &allcount, 1, MPI_INT, MPI_SUM, world);
|
||||||
if (allcount != 2)
|
if (allcount != 2) error->all(FLERR, "Create_bonds single/bond atoms do not exist");
|
||||||
error->all(FLERR,"Create_bonds single/bond atoms do not exist");
|
|
||||||
|
|
||||||
// create bond once or 2x if newton_bond set
|
// create bond once or 2x if newton_bond set
|
||||||
|
|
||||||
@ -384,8 +382,7 @@ void CreateBonds::single_angle()
|
|||||||
|
|
||||||
int allcount;
|
int allcount;
|
||||||
MPI_Allreduce(&count, &allcount, 1, MPI_INT, MPI_SUM, world);
|
MPI_Allreduce(&count, &allcount, 1, MPI_INT, MPI_SUM, world);
|
||||||
if (allcount != 3)
|
if (allcount != 3) error->all(FLERR, "Create_bonds single/angle atoms do not exist");
|
||||||
error->all(FLERR,"Create_bonds single/angle atoms do not exist");
|
|
||||||
|
|
||||||
// create angle once or 3x if newton_bond set
|
// create angle once or 3x if newton_bond set
|
||||||
|
|
||||||
@ -451,8 +448,7 @@ void CreateBonds::single_dihedral()
|
|||||||
|
|
||||||
int allcount;
|
int allcount;
|
||||||
MPI_Allreduce(&count, &allcount, 1, MPI_INT, MPI_SUM, world);
|
MPI_Allreduce(&count, &allcount, 1, MPI_INT, MPI_SUM, world);
|
||||||
if (allcount != 4)
|
if (allcount != 4) error->all(FLERR, "Create_bonds single/dihedral atoms do not exist");
|
||||||
error->all(FLERR,"Create_bonds single/dihedral atoms do not exist");
|
|
||||||
|
|
||||||
// create bond once or 4x if newton_bond set
|
// create bond once or 4x if newton_bond set
|
||||||
|
|
||||||
@ -465,8 +461,7 @@ void CreateBonds::single_dihedral()
|
|||||||
|
|
||||||
if ((m = idx2) >= 0) {
|
if ((m = idx2) >= 0) {
|
||||||
if (num_dihedral[m] == atom->dihedral_per_atom)
|
if (num_dihedral[m] == atom->dihedral_per_atom)
|
||||||
error->one(FLERR,
|
error->one(FLERR, "New dihedral exceeded dihedrals per atom in create_bonds");
|
||||||
"New dihedral exceeded dihedrals per atom in create_bonds");
|
|
||||||
dihedral_type[m][num_dihedral[m]] = dtype;
|
dihedral_type[m][num_dihedral[m]] = dtype;
|
||||||
dihedral_atom1[m][num_dihedral[m]] = datom1;
|
dihedral_atom1[m][num_dihedral[m]] = datom1;
|
||||||
dihedral_atom2[m][num_dihedral[m]] = datom2;
|
dihedral_atom2[m][num_dihedral[m]] = datom2;
|
||||||
@ -480,8 +475,7 @@ void CreateBonds::single_dihedral()
|
|||||||
|
|
||||||
if ((m = idx1) >= 0) {
|
if ((m = idx1) >= 0) {
|
||||||
if (num_dihedral[m] == atom->dihedral_per_atom)
|
if (num_dihedral[m] == atom->dihedral_per_atom)
|
||||||
error->one(FLERR,
|
error->one(FLERR, "New dihedral exceeded dihedrals per atom in create_bonds");
|
||||||
"New dihedral exceeded dihedrals per atom in create_bonds");
|
|
||||||
dihedral_type[m][num_dihedral[m]] = dtype;
|
dihedral_type[m][num_dihedral[m]] = dtype;
|
||||||
dihedral_atom1[m][num_dihedral[m]] = datom1;
|
dihedral_atom1[m][num_dihedral[m]] = datom1;
|
||||||
dihedral_atom2[m][num_dihedral[m]] = datom2;
|
dihedral_atom2[m][num_dihedral[m]] = datom2;
|
||||||
@ -492,8 +486,7 @@ void CreateBonds::single_dihedral()
|
|||||||
|
|
||||||
if ((m = idx3) >= 0) {
|
if ((m = idx3) >= 0) {
|
||||||
if (num_dihedral[m] == atom->dihedral_per_atom)
|
if (num_dihedral[m] == atom->dihedral_per_atom)
|
||||||
error->one(FLERR,
|
error->one(FLERR, "New dihedral exceeded dihedrals per atom in create_bonds");
|
||||||
"New dihedral exceeded dihedrals per atom in create_bonds");
|
|
||||||
dihedral_type[m][num_dihedral[m]] = dtype;
|
dihedral_type[m][num_dihedral[m]] = dtype;
|
||||||
dihedral_atom1[m][num_dihedral[m]] = datom1;
|
dihedral_atom1[m][num_dihedral[m]] = datom1;
|
||||||
dihedral_atom2[m][num_dihedral[m]] = datom2;
|
dihedral_atom2[m][num_dihedral[m]] = datom2;
|
||||||
@ -504,8 +497,7 @@ void CreateBonds::single_dihedral()
|
|||||||
|
|
||||||
if ((m = idx4) >= 0) {
|
if ((m = idx4) >= 0) {
|
||||||
if (num_dihedral[m] == atom->dihedral_per_atom)
|
if (num_dihedral[m] == atom->dihedral_per_atom)
|
||||||
error->one(FLERR,
|
error->one(FLERR, "New dihedral exceeded dihedrals per atom in create_bonds");
|
||||||
"New dihedral exceeded dihedrals per atom in create_bonds");
|
|
||||||
dihedral_type[m][num_dihedral[m]] = dtype;
|
dihedral_type[m][num_dihedral[m]] = dtype;
|
||||||
dihedral_atom1[m][num_dihedral[m]] = datom1;
|
dihedral_atom1[m][num_dihedral[m]] = datom1;
|
||||||
dihedral_atom2[m][num_dihedral[m]] = datom2;
|
dihedral_atom2[m][num_dihedral[m]] = datom2;
|
||||||
@ -537,8 +529,7 @@ void CreateBonds::single_improper()
|
|||||||
|
|
||||||
int allcount;
|
int allcount;
|
||||||
MPI_Allreduce(&count, &allcount, 1, MPI_INT, MPI_SUM, world);
|
MPI_Allreduce(&count, &allcount, 1, MPI_INT, MPI_SUM, world);
|
||||||
if (allcount != 4)
|
if (allcount != 4) error->all(FLERR, "Create_bonds single/improper atoms do not exist");
|
||||||
error->all(FLERR,"Create_bonds single/improper atoms do not exist");
|
|
||||||
|
|
||||||
// create bond once or 4x if newton_bond set
|
// create bond once or 4x if newton_bond set
|
||||||
|
|
||||||
@ -551,8 +542,7 @@ void CreateBonds::single_improper()
|
|||||||
|
|
||||||
if ((m = idx2) >= 0) {
|
if ((m = idx2) >= 0) {
|
||||||
if (num_improper[m] == atom->improper_per_atom)
|
if (num_improper[m] == atom->improper_per_atom)
|
||||||
error->one(FLERR,
|
error->one(FLERR, "New improper exceeded impropers per atom in create_bonds");
|
||||||
"New improper exceeded impropers per atom in create_bonds");
|
|
||||||
improper_type[m][num_improper[m]] = dtype;
|
improper_type[m][num_improper[m]] = dtype;
|
||||||
improper_atom1[m][num_improper[m]] = datom1;
|
improper_atom1[m][num_improper[m]] = datom1;
|
||||||
improper_atom2[m][num_improper[m]] = datom2;
|
improper_atom2[m][num_improper[m]] = datom2;
|
||||||
@ -566,8 +556,7 @@ void CreateBonds::single_improper()
|
|||||||
|
|
||||||
if ((m = idx1) >= 0) {
|
if ((m = idx1) >= 0) {
|
||||||
if (num_improper[m] == atom->improper_per_atom)
|
if (num_improper[m] == atom->improper_per_atom)
|
||||||
error->one(FLERR,
|
error->one(FLERR, "New improper exceeded impropers per atom in create_bonds");
|
||||||
"New improper exceeded impropers per atom in create_bonds");
|
|
||||||
improper_type[m][num_improper[m]] = dtype;
|
improper_type[m][num_improper[m]] = dtype;
|
||||||
improper_atom1[m][num_improper[m]] = datom1;
|
improper_atom1[m][num_improper[m]] = datom1;
|
||||||
improper_atom2[m][num_improper[m]] = datom2;
|
improper_atom2[m][num_improper[m]] = datom2;
|
||||||
@ -578,8 +567,7 @@ void CreateBonds::single_improper()
|
|||||||
|
|
||||||
if ((m = idx3) >= 0) {
|
if ((m = idx3) >= 0) {
|
||||||
if (num_improper[m] == atom->improper_per_atom)
|
if (num_improper[m] == atom->improper_per_atom)
|
||||||
error->one(FLERR,
|
error->one(FLERR, "New improper exceeded impropers per atom in create_bonds");
|
||||||
"New improper exceeded impropers per atom in create_bonds");
|
|
||||||
improper_type[m][num_improper[m]] = dtype;
|
improper_type[m][num_improper[m]] = dtype;
|
||||||
improper_atom1[m][num_improper[m]] = datom1;
|
improper_atom1[m][num_improper[m]] = datom1;
|
||||||
improper_atom2[m][num_improper[m]] = datom2;
|
improper_atom2[m][num_improper[m]] = datom2;
|
||||||
@ -590,8 +578,7 @@ void CreateBonds::single_improper()
|
|||||||
|
|
||||||
if ((m = idx4) >= 0) {
|
if ((m = idx4) >= 0) {
|
||||||
if (num_improper[m] == atom->improper_per_atom)
|
if (num_improper[m] == atom->improper_per_atom)
|
||||||
error->one(FLERR,
|
error->one(FLERR, "New improper exceeded impropers per atom in create_bonds");
|
||||||
"New improper exceeded impropers per atom in create_bonds");
|
|
||||||
improper_type[m][num_improper[m]] = dtype;
|
improper_type[m][num_improper[m]] = dtype;
|
||||||
improper_atom1[m][num_improper[m]] = datom1;
|
improper_atom1[m][num_improper[m]] = datom1;
|
||||||
improper_atom2[m][num_improper[m]] = datom2;
|
improper_atom2[m][num_improper[m]] = datom2;
|
||||||
|
|||||||
Reference in New Issue
Block a user