apply clang-format

This commit is contained in:
Axel Kohlmeyer
2024-10-05 22:25:07 -04:00
parent 6ab0b2c249
commit 719a64d9dd
9 changed files with 93 additions and 64 deletions

View File

@ -96,8 +96,7 @@ void BondHybrid::compute(int eflag, int vflag)
bondlist[m][n][0] = bondlist_orig[i][0]; bondlist[m][n][0] = bondlist_orig[i][0];
bondlist[m][n][1] = bondlist_orig[i][1]; bondlist[m][n][1] = bondlist_orig[i][1];
bondlist[m][n][2] = bondlist_orig[i][2]; bondlist[m][n][2] = bondlist_orig[i][2];
if (partial_flag) if (partial_flag) orig_map[m][n] = i;
orig_map[m][n] = i;
nbondlist[m]++; nbondlist[m]++;
} }
} }
@ -381,8 +380,10 @@ void BondHybrid::init_style()
// bond style quartic will set broken bonds to bond type 0, so we need // bond style quartic will set broken bonds to bond type 0, so we need
// to create an entry for it in the bond type to sub-style map // to create an entry for it in the bond type to sub-style map
if (has_quartic >= 0) map[0] = has_quartic; if (has_quartic >= 0)
else map[0] = -1; map[0] = has_quartic;
else
map[0] = -1;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -124,7 +124,8 @@ void ComputeMSDChunk::compute_array()
// first time call, allocate per-chunk arrays // first time call, allocate per-chunk arrays
// thereafter, require nchunk remain the same // thereafter, require nchunk remain the same
if (firstflag) msdnchunk = nchunk; if (firstflag)
msdnchunk = nchunk;
else if (msdnchunk != nchunk) else if (msdnchunk != nchunk)
error->all(FLERR, "Compute msd/chunk nchunk is not static"); error->all(FLERR, "Compute msd/chunk nchunk is not static");

View File

@ -184,7 +184,8 @@ void CreateAtoms::command(int narg, char **arg)
if (imol == -1) if (imol == -1)
error->all(FLERR, "Molecule template ID {} for create_atoms does not exist", arg[iarg + 1]); error->all(FLERR, "Molecule template ID {} for create_atoms does not exist", arg[iarg + 1]);
if ((atom->molecules[imol]->nset > 1) && (comm->me == 0)) if ((atom->molecules[imol]->nset > 1) && (comm->me == 0))
error->warning(FLERR, "Molecule template for create_atoms has multiple molecule sets. " error->warning(FLERR,
"Molecule template for create_atoms has multiple molecule sets. "
"Only the first set will be used."); "Only the first set will be used.");
mode = MOLECULE; mode = MOLECULE;
onemol = atom->molecules[imol]; onemol = atom->molecules[imol];
@ -1207,7 +1208,8 @@ void CreateAtoms::add_lattice()
// verify lattice was defined with triclinic/general option // verify lattice was defined with triclinic/general option
if (!domain->triclinic_general && domain->lattice->is_general_triclinic()) if (!domain->triclinic_general && domain->lattice->is_general_triclinic())
error->all(FLERR,"Create_atoms for non general triclinic box cannot use triclinic/general lattice"); error->all(FLERR,
"Create_atoms for non general triclinic box cannot use triclinic/general lattice");
if (domain->triclinic_general && !domain->lattice->is_general_triclinic()) if (domain->triclinic_general && !domain->lattice->is_general_triclinic())
error->all(FLERR, "Create_atoms for general triclinic box requires triclinic/general lattice"); error->all(FLERR, "Create_atoms for general triclinic box requires triclinic/general lattice");
@ -1273,31 +1275,47 @@ void CreateAtoms::add_lattice()
} else if (domain->triclinic_general) { } else if (domain->triclinic_general) {
double point[3]; double point[3];
point[0] = bboxlo[0]; point[1] = bboxlo[1]; point[2] = bboxlo[2]; point[0] = bboxlo[0];
point[1] = bboxlo[1];
point[2] = bboxlo[2];
domain->restricted_to_general_coords(point); domain->restricted_to_general_coords(point);
domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax);
point[0] = bboxhi[0]; point[1] = bboxlo[1]; point[2] = bboxlo[2]; point[0] = bboxhi[0];
point[1] = bboxlo[1];
point[2] = bboxlo[2];
domain->restricted_to_general_coords(point); domain->restricted_to_general_coords(point);
domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax);
point[0] = bboxlo[0]; point[1] = bboxhi[1]; point[2] = bboxlo[2]; point[0] = bboxlo[0];
point[1] = bboxhi[1];
point[2] = bboxlo[2];
domain->restricted_to_general_coords(point); domain->restricted_to_general_coords(point);
domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax);
point[0] = bboxhi[0]; point[1] = bboxhi[1]; point[2] = bboxlo[2]; point[0] = bboxhi[0];
point[1] = bboxhi[1];
point[2] = bboxlo[2];
domain->restricted_to_general_coords(point); domain->restricted_to_general_coords(point);
domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax);
point[0] = bboxlo[0]; point[1] = bboxlo[1]; point[2] = bboxhi[2]; point[0] = bboxlo[0];
point[1] = bboxlo[1];
point[2] = bboxhi[2];
domain->restricted_to_general_coords(point); domain->restricted_to_general_coords(point);
domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax);
point[0] = bboxhi[0]; point[1] = bboxlo[1]; point[2] = bboxhi[2]; point[0] = bboxhi[0];
point[1] = bboxlo[1];
point[2] = bboxhi[2];
domain->restricted_to_general_coords(point); domain->restricted_to_general_coords(point);
domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax);
point[0] = bboxlo[0]; point[1] = bboxhi[1]; point[2] = bboxhi[2]; point[0] = bboxlo[0];
point[1] = bboxhi[1];
point[2] = bboxhi[2];
domain->restricted_to_general_coords(point); domain->restricted_to_general_coords(point);
domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax);
point[0] = bboxhi[0]; point[1] = bboxhi[1]; point[2] = bboxhi[2]; point[0] = bboxhi[0];
point[1] = bboxhi[1];
point[2] = bboxhi[2];
domain->restricted_to_general_coords(point); domain->restricted_to_general_coords(point);
domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax);
} }
@ -1510,8 +1528,7 @@ void CreateAtoms::get_xmol(double *center)
for (int m = 0; m < natoms; m++) { for (int m = 0; m < natoms; m++) {
MathExtra::matvec(rotmat, onemol->dx[m], xnew); MathExtra::matvec(rotmat, onemol->dx[m], xnew);
MathExtra::add3(xnew, center, xnew); MathExtra::add3(xnew, center, xnew);
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++) xmol[m][i] = xnew[i];
xmol[m][i] = xnew[i];
} }
} }

View File

@ -49,11 +49,13 @@ void CreateBox::command(int narg, char **arg)
Region *region = nullptr; Region *region = nullptr;
int triclinic_general = 0; int triclinic_general = 0;
if (strcmp(arg[1],"NULL") == 0) triclinic_general = 1; if (strcmp(arg[1], "NULL") == 0)
triclinic_general = 1;
else { else {
region = domain->get_region_by_id(arg[1]); region = domain->get_region_by_id(arg[1]);
if (!region) error->all(FLERR, "Create_box region {} does not exist", arg[1]); if (!region) error->all(FLERR, "Create_box region {} does not exist", arg[1]);
if (region->bboxflag == 0) error->all(FLERR, "Create_box region does not support a bounding box"); if (region->bboxflag == 0)
error->all(FLERR, "Create_box region does not support a bounding box");
region->init(); region->init();
} }
@ -130,25 +132,33 @@ void CreateBox::command(int narg, char **arg)
double avec[3], bvec[3], cvec[3], origin[3]; double avec[3], bvec[3], cvec[3], origin[3];
double px, py, pz; double px, py, pz;
px = alo; py = blo; pz = clo; px = alo;
py = blo;
pz = clo;
domain->lattice->lattice2box(px, py, pz); domain->lattice->lattice2box(px, py, pz);
origin[0] = px; origin[0] = px;
origin[1] = py; origin[1] = py;
origin[2] = pz; origin[2] = pz;
px = ahi; py = blo; pz = clo; px = ahi;
py = blo;
pz = clo;
domain->lattice->lattice2box(px, py, pz); domain->lattice->lattice2box(px, py, pz);
avec[0] = px - origin[0]; avec[0] = px - origin[0];
avec[1] = py - origin[1]; avec[1] = py - origin[1];
avec[2] = pz - origin[2]; avec[2] = pz - origin[2];
px = alo; py = bhi; pz = clo; px = alo;
py = bhi;
pz = clo;
domain->lattice->lattice2box(px, py, pz); domain->lattice->lattice2box(px, py, pz);
bvec[0] = px - origin[0]; bvec[0] = px - origin[0];
bvec[1] = py - origin[1]; bvec[1] = py - origin[1];
bvec[2] = pz - origin[2]; bvec[2] = pz - origin[2];
px = alo; py = blo; pz = chi; px = alo;
py = blo;
pz = chi;
domain->lattice->lattice2box(px, py, pz); domain->lattice->lattice2box(px, py, pz);
cvec[0] = px - origin[0]; cvec[0] = px - origin[0];
cvec[1] = py - origin[1]; cvec[1] = py - origin[1];

View File

@ -149,8 +149,7 @@ void DihedralWrite::command(int narg, char **arg)
FILE *coeffs; FILE *coeffs;
char line[MAXLINE] = {'\0'}; char line[MAXLINE] = {'\0'};
coeffs = fopen(coeffs_file.c_str(), "r"); coeffs = fopen(coeffs_file.c_str(), "r");
if (!coeffs) if (!coeffs) error->one(FLERR, "Unable to open temporary file {}: {}", utils::getsyserror());
error->one(FLERR, "Unable to open temporary file {}: {}", utils::getsyserror());
for (int i = 0; i < atom->ndihedraltypes; ++i) { for (int i = 0; i < atom->ndihedraltypes; ++i) {
utils::sfgets(FLERR, line, MAXLINE, coeffs, coeffs_file.c_str(), error); utils::sfgets(FLERR, line, MAXLINE, coeffs, coeffs_file.c_str(), error);
writer->input->one(fmt::format("dihedral_coeff {}", line)); writer->input->one(fmt::format("dihedral_coeff {}", line));

View File

@ -200,9 +200,12 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
int flag = 0; int flag = 0;
for (int i = 0; i < nvalue; i++) for (int i = 0; i < nvalue; i++)
if (styles[i] == MOLECULE || styles[i] == CHARGE || styles[i] == RMASS || if (styles[i] == MOLECULE || styles[i] == CHARGE || styles[i] == RMASS ||
styles[i] == TEMPERATURE || styles[i] == HEATFLOW) flag = 1; styles[i] == TEMPERATURE || styles[i] == HEATFLOW)
flag = 1;
if (flag && comm->me == 0) if (flag && comm->me == 0)
error->warning(FLERR, "Fix property/atom mol, charge, rmass, temperature, or heatflow w/out ghost communication"); error->warning(FLERR,
"Fix property/atom mol, charge, rmass, temperature, or heatflow w/out ghost "
"communication");
} }
// store current atom style // store current atom style
@ -216,7 +219,6 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
if (border) atom->add_callback(Atom::BORDER); if (border) atom->add_callback(Atom::BORDER);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixPropertyAtom::post_constructor() void FixPropertyAtom::post_constructor()

View File

@ -24,8 +24,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) :
xstr(nullptr), ystr(nullptr), zstr(nullptr) Region(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr)
{ {
xvar = yvar = zvar = 0.0; xvar = yvar = zvar = 0.0;
@ -203,4 +203,3 @@ void RegPlane::variable_check()
error->all(FLERR, "Variable {} for region plane is invalid style", zstr); error->all(FLERR, "Variable {} for region plane is invalid style", zstr);
} }
} }