apply clang-format to have some files with changes

This commit is contained in:
Axel Kohlmeyer
2024-08-22 11:40:26 -04:00
parent 10dce38a76
commit 61fd2ba25c
6 changed files with 92 additions and 61 deletions

View File

@ -326,8 +326,8 @@ void DihedralMultiHarmonic::write_data(FILE *fp)
/* ---------------------------------------------------------------------- */
void DihedralMultiHarmonic::born_matrix(int nd, int i1, int i2, int i3, int i4,
double &du, double &du2)
void DihedralMultiHarmonic::born_matrix(int nd, int i1, int i2, int i3, int i4, double &du,
double &du2)
{
double vb1x, vb1y, vb1z, vb2x, vb2y, vb2z, vb3x, vb3y, vb3z, vb2xm, vb2ym, vb2zm;
double sb1, sb3, rb1, rb3, c0, b1mag2, b1mag, b2mag2;

View File

@ -336,8 +336,7 @@ void DihedralOPLS::write_data(FILE *fp)
/* ----------------------------------------------------------------------*/
void DihedralOPLS::born_matrix(int nd, int i1, int i2, int i3, int i4,
double &du, double &du2)
void DihedralOPLS::born_matrix(int nd, int i1, int i2, int i3, int i4, double &du, double &du2)
{
double vb1x, vb1y, vb1z, vb2x, vb2y, vb2z, vb3x, vb3y, vb3z, vb2xm, vb2ym, vb2zm;
double sb1, sb3, rb1, rb3, c0, b1mag2, b1mag, b2mag2;
@ -425,9 +424,10 @@ void DihedralOPLS::born_matrix(int nd, int i1, int i2, int i3, int i4,
si = sin(phi);
if (fabs(si) < SMALLER) si = SMALLER;
du = k1[type] - 2.0 * k2[type] * sin(2.0 * phi) / si + 3.0 * k3[type] * sin(3.0 * phi) / si
- 4.0 * k4[type] * sin(4.0 * phi) / si;
du2 = (4.0 * k2[type] * si * cos(2.0 * phi) - 2.0 * k2[type] * sin(2.0 * phi)
- 9.0 * k3[type] * si * cos(3.0 * phi) + 3.0 * k3[type] * sin(3.0 * phi)
+ 16.0 * k4[type] * si * cos(4.0 * phi) - 4.0 * k4[type] * sin(4.0 * phi)) / (si * si * si);
du = k1[type] - 2.0 * k2[type] * sin(2.0 * phi) / si + 3.0 * k3[type] * sin(3.0 * phi) / si -
4.0 * k4[type] * sin(4.0 * phi) / si;
du2 = (4.0 * k2[type] * si * cos(2.0 * phi) - 2.0 * k2[type] * sin(2.0 * phi) -
9.0 * k3[type] * si * cos(3.0 * phi) + 3.0 * k3[type] * sin(3.0 * phi) +
16.0 * k4[type] * si * cos(4.0 * phi) - 4.0 * k4[type] * sin(4.0 * phi)) /
(si * si * si);
}

View File

@ -214,8 +214,10 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) :
iarg += 2;
} else if (strcmp(arg[iarg], "inputs") == 0) {
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, mycmd + " inputs", error);
if (strcmp(arg[iarg+1], "peratom") == 0) input_mode = PERATOM;
else if (strcmp(arg[iarg+1], "local") == 0) input_mode = LOCAL;
if (strcmp(arg[iarg + 1], "peratom") == 0)
input_mode = PERATOM;
else if (strcmp(arg[iarg + 1], "local") == 0)
input_mode = LOCAL;
iarg += 2;
} else
error->all(FLERR, "Unknown compute {} keyword: {}", style, arg[iarg]);
@ -251,11 +253,14 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) :
if (input_mode == PERATOM) {
if (!val.val.c->peratom_flag)
error->all(FLERR, "Compute {} compute {} does not calculate per-atom values", style, val.id);
error->all(FLERR, "Compute {} compute {} does not calculate per-atom values", style,
val.id);
if (val.argindex == 0 && val.val.c->size_peratom_cols != 0)
error->all(FLERR, "Compute {} compute {} does not calculate a per-atom vector", style, val.id);
error->all(FLERR, "Compute {} compute {} does not calculate a per-atom vector", style,
val.id);
if (val.argindex && val.val.c->size_peratom_cols == 0)
error->all(FLERR, "Compute {} compute {} does not calculate a per-atom array", style, val.id);
error->all(FLERR, "Compute {} compute {} does not calculate a per-atom array", style,
val.id);
if (val.argindex && val.argindex > val.val.c->size_peratom_cols)
error->all(FLERR, "Compute {} compute {} array is accessed out-of-range", style, val.id);
@ -263,9 +268,11 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) :
if (!val.val.c->local_flag)
error->all(FLERR, "Compute {} compute {} does not calculate local values", style, val.id);
if (val.argindex == 0 && val.val.c->size_local_cols != 0)
error->all(FLERR, "Compute {} compute {} does not calculate a local vector", style, val.id);
error->all(FLERR, "Compute {} compute {} does not calculate a local vector", style,
val.id);
if (val.argindex && val.val.c->size_local_cols == 0)
error->all(FLERR, "Compute {} compute {} does not calculate a local array", style, val.id);
error->all(FLERR, "Compute {} compute {} does not calculate a local array", style,
val.id);
if (val.argindex && val.argindex > val.val.c->size_local_cols)
error->all(FLERR, "Compute {} compute {} array is accessed out-of-range", style, val.id);
}
@ -278,7 +285,8 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) :
if (!val.val.f->peratom_flag)
error->all(FLERR, "Compute {} fix {} does not calculate per-atom values", style, val.id);
if (val.argindex == 0 && (val.val.f->size_peratom_cols != 0))
error->all(FLERR, "Compute {} fix {} does not calculate a per-atom vector", style, val.id);
error->all(FLERR, "Compute {} fix {} does not calculate a per-atom vector", style,
val.id);
if (val.argindex && (val.val.f->size_peratom_cols == 0))
error->all(FLERR, "Compute {} fix {} does not calculate a per-atom array", style, val.id);
if (val.argindex && (val.argindex > val.val.f->size_peratom_cols))
@ -417,7 +425,8 @@ void ComputeReduce::compute_vector()
} else if (mode == MINN) {
if (!replace) {
for (int m = 0; m < nvalues; m++)
MPI_Allreduce(&onevec[m], &vector[m], 1, MPI_DOUBLE, this->scalar_reduction_operation, world);
MPI_Allreduce(&onevec[m], &vector[m], 1, MPI_DOUBLE, this->scalar_reduction_operation,
world);
} else {
for (int m = 0; m < nvalues; m++)
@ -437,7 +446,8 @@ void ComputeReduce::compute_vector()
} else if (mode == MAXX) {
if (!replace) {
for (int m = 0; m < nvalues; m++)
MPI_Allreduce(&onevec[m], &vector[m], 1, MPI_DOUBLE, this->scalar_reduction_operation, world);
MPI_Allreduce(&onevec[m], &vector[m], 1, MPI_DOUBLE, this->scalar_reduction_operation,
world);
} else {
for (int m = 0; m < nvalues; m++)

View File

@ -49,11 +49,13 @@ void CreateBox::command(int narg, char **arg)
Region *region = nullptr;
int triclinic_general = 0;
if (strcmp(arg[1],"NULL") == 0) triclinic_general = 1;
if (strcmp(arg[1], "NULL") == 0)
triclinic_general = 1;
else {
region = domain->get_region_by_id(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();
}
@ -130,25 +132,33 @@ void CreateBox::command(int narg, char **arg)
double avec[3], bvec[3], cvec[3], origin[3];
double px, py, pz;
px = alo; py = blo; pz = clo;
px = alo;
py = blo;
pz = clo;
domain->lattice->lattice2box(px, py, pz);
origin[0] = px;
origin[1] = py;
origin[2] = pz;
px = ahi; py = blo; pz = clo;
px = ahi;
py = blo;
pz = clo;
domain->lattice->lattice2box(px, py, pz);
avec[0] = px - origin[0];
avec[1] = py - origin[1];
avec[2] = pz - origin[2];
px = alo; py = bhi; pz = clo;
px = alo;
py = bhi;
pz = clo;
domain->lattice->lattice2box(px, py, pz);
bvec[0] = px - origin[0];
bvec[1] = py - origin[1];
bvec[2] = pz - origin[2];
px = alo; py = blo; pz = chi;
px = alo;
py = blo;
pz = chi;
domain->lattice->lattice2box(px, py, pz);
cvec[0] = px - origin[0];
cvec[1] = py - origin[1];

View File

@ -114,7 +114,8 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) :
}
if (estr && pstr)
error->all(FLERR, "Must not use energy and potential keywords at the same time with fix efield");
error->all(FLERR,
"Must not use energy and potential keywords at the same time with fix efield");
force_flag = 0;
fsum[0] = fsum[1] = fsum[2] = fsum[3] = 0.0;
@ -171,7 +172,8 @@ void FixEfield::init()
if (xstr) {
xvar = input->variable->find(xstr);
if (xvar < 0) error->all(FLERR, "Variable {} for x-field in fix {} does not exist", xstr, style);
if (xvar < 0)
error->all(FLERR, "Variable {} for x-field in fix {} does not exist", xstr, style);
if (input->variable->equalstyle(xvar))
xstyle = EQUAL;
else if (input->variable->atomstyle(xvar))
@ -182,7 +184,8 @@ void FixEfield::init()
if (ystr) {
yvar = input->variable->find(ystr);
if (yvar < 0) error->all(FLERR, "Variable {} for y-field in fix {} does not exist", ystr, style);
if (yvar < 0)
error->all(FLERR, "Variable {} for y-field in fix {} does not exist", ystr, style);
if (input->variable->equalstyle(yvar))
ystyle = EQUAL;
else if (input->variable->atomstyle(yvar))
@ -193,7 +196,8 @@ void FixEfield::init()
if (zstr) {
zvar = input->variable->find(zstr);
if (zvar < 0) error->all(FLERR, "Variable {} for z-field in fix {} does not exist", zstr, style);
if (zvar < 0)
error->all(FLERR, "Variable {} for z-field in fix {} does not exist", zstr, style);
if (input->variable->equalstyle(zvar))
zstyle = EQUAL;
else if (input->variable->atomstyle(zvar))
@ -213,7 +217,8 @@ void FixEfield::init()
if (pstr) {
pvar = input->variable->find(pstr);
if (pvar < 0) error->all(FLERR, "Variable {} for potential in fix {} does not exist", pstr, style);
if (pvar < 0)
error->all(FLERR, "Variable {} for potential in fix {} does not exist", pstr, style);
if (input->variable->atomstyle(pvar))
pstyle = ATOM;
else
@ -244,8 +249,10 @@ void FixEfield::init()
error->all(FLERR, "Cannot use variable energy with constant efield in fix {}", style);
if (varflag == CONSTANT && pstyle != NONE)
error->all(FLERR, "Cannot use variable potential with constant efield in fix {}", style);
if ((varflag == EQUAL || varflag == ATOM) && update->whichflag == 2 && estyle == NONE && pstyle == NONE)
error->all(FLERR, "Must use variable energy or potential with fix {} during minimization", style);
if ((varflag == EQUAL || varflag == ATOM) && update->whichflag == 2 && estyle == NONE &&
pstyle == NONE)
error->all(FLERR, "Must use variable energy or potential with fix {} during minimization",
style);
if (utils::strmatch(update->integrate_style, "^respa")) {
ilevel_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels - 1;
@ -403,8 +410,10 @@ void FixEfield::post_force(int vflag)
}
f[i][2] += fz;
fsum[3] += fz;
if (pstyle == ATOM) fsum[0] += qe2f * q[i] * efield[i][3];
else if (estyle == ATOM) fsum[0] += efield[i][3];
if (pstyle == ATOM)
fsum[0] += qe2f * q[i] * efield[i][3];
else if (estyle == ATOM)
fsum[0] += efield[i][3];
}
}
@ -504,8 +513,10 @@ void FixEfield::update_efield_variables()
} else if (zstyle == ATOM) {
input->variable->compute_atom(zvar, igroup, &efield[0][2], 4, 0);
}
if (pstyle == ATOM) input->variable->compute_atom(pvar, igroup, &efield[0][3], 4, 0);
else if (estyle == ATOM) input->variable->compute_atom(evar, igroup, &efield[0][3], 4, 0);
if (pstyle == ATOM)
input->variable->compute_atom(pvar, igroup, &efield[0][3], 4, 0);
else if (estyle == ATOM)
input->variable->compute_atom(evar, igroup, &efield[0][3], 4, 0);
modify->addstep_compute(update->ntimestep + 1);
}