apply clang-format to have some files with changes
This commit is contained in:
@ -276,17 +276,17 @@ void AngleHarmonic::born_matrix(int type, int i1, int i2, int i3, double &du, do
|
||||
double delx1 = x[i1][0] - x[i2][0];
|
||||
double dely1 = x[i1][1] - x[i2][1];
|
||||
double delz1 = x[i1][2] - x[i2][2];
|
||||
domain->minimum_image(delx1,dely1,delz1);
|
||||
double r1 = sqrt(delx1*delx1 + dely1*dely1 + delz1*delz1);
|
||||
domain->minimum_image(delx1, dely1, delz1);
|
||||
double r1 = sqrt(delx1 * delx1 + dely1 * dely1 + delz1 * delz1);
|
||||
|
||||
double delx2 = x[i3][0] - x[i2][0];
|
||||
double dely2 = x[i3][1] - x[i2][1];
|
||||
double delz2 = x[i3][2] - x[i2][2];
|
||||
domain->minimum_image(delx2,dely2,delz2);
|
||||
double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2);
|
||||
domain->minimum_image(delx2, dely2, delz2);
|
||||
double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2);
|
||||
|
||||
double c = delx1*delx2 + dely1*dely2 + delz1*delz2;
|
||||
c /= r1*r2;
|
||||
double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2;
|
||||
c /= r1 * r2;
|
||||
if (c > 1.0) c = 1.0;
|
||||
if (c < -1.0) c = -1.0;
|
||||
double theta = acos(c);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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]);
|
||||
@ -242,7 +244,7 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
for (auto &val : values) {
|
||||
if (val.which == ArgInfo::X || val.which == ArgInfo::V || val.which == ArgInfo::F) {
|
||||
if (input_mode == LOCAL) error->all(FLERR,"Compute {} inputs must be all local");
|
||||
if (input_mode == LOCAL) error->all(FLERR, "Compute {} inputs must be all local");
|
||||
|
||||
} else if (val.which == ArgInfo::COMPUTE) {
|
||||
val.val.c = modify->get_compute_by_id(val.id);
|
||||
@ -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))
|
||||
@ -296,7 +304,7 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) :
|
||||
}
|
||||
|
||||
} else if (val.which == ArgInfo::VARIABLE) {
|
||||
if (input_mode == LOCAL) error->all(FLERR,"Compute {} inputs must be all local");
|
||||
if (input_mode == LOCAL) error->all(FLERR, "Compute {} inputs must be all local");
|
||||
val.val.v = input->variable->find(val.id.c_str());
|
||||
if (val.val.v < 0)
|
||||
error->all(FLERR, "Variable name {} for compute {} does not exist", val.id, style);
|
||||
@ -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++)
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -77,9 +79,9 @@ void CreateBox::command(int narg, char **arg)
|
||||
domain->boxlo[2] = region->extent_zlo;
|
||||
domain->boxhi[2] = region->extent_zhi;
|
||||
|
||||
// region is prism
|
||||
// seutp restricted triclinic box
|
||||
// set simulation domain from prism params
|
||||
// region is prism
|
||||
// seutp restricted triclinic box
|
||||
// set simulation domain from prism params
|
||||
|
||||
} else {
|
||||
domain->triclinic = 1;
|
||||
@ -97,17 +99,17 @@ void CreateBox::command(int narg, char **arg)
|
||||
|
||||
if (domain->dimension == 2) {
|
||||
if (domain->boxlo[2] >= 0.0 || domain->boxhi[2] <= 0.0)
|
||||
error->all(FLERR,"Create_box region zlo/zhi for 2d simulation must straddle 0.0");
|
||||
error->all(FLERR, "Create_box region zlo/zhi for 2d simulation must straddle 0.0");
|
||||
}
|
||||
|
||||
// setup general triclinic box (with no region)
|
||||
// read next box extent arguments to create ABC edge vectors + origin
|
||||
// define_general_triclinic() converts
|
||||
// ABC edge vectors + origin to restricted triclinic
|
||||
// setup general triclinic box (with no region)
|
||||
// read next box extent arguments to create ABC edge vectors + origin
|
||||
// define_general_triclinic() converts
|
||||
// ABC edge vectors + origin to restricted triclinic
|
||||
|
||||
} else if (triclinic_general) {
|
||||
if (!domain->lattice->is_general_triclinic())
|
||||
error->all(FLERR,"Create_box for general triclinic requires triclnic/general lattice");
|
||||
error->all(FLERR, "Create_box for general triclinic requires triclnic/general lattice");
|
||||
|
||||
if (iarg + 6 > narg) utils::missing_cmd_args(FLERR, "create_box general triclinic", error);
|
||||
|
||||
@ -121,42 +123,50 @@ void CreateBox::command(int narg, char **arg)
|
||||
|
||||
if (domain->dimension == 2)
|
||||
if (clo != -0.5 || chi != 0.5)
|
||||
error->all(FLERR,"Create_box for general triclinic requires clo = -0.5 and chi = 0.5");
|
||||
error->all(FLERR, "Create_box for general triclinic requires clo = -0.5 and chi = 0.5");
|
||||
|
||||
// use lattice2box() to generate origin and ABC vectors
|
||||
// origin = abc lo
|
||||
// ABC vectors = hi in one dim - origin
|
||||
|
||||
double avec[3],bvec[3],cvec[3],origin[3];
|
||||
double px,py,pz;
|
||||
double avec[3], bvec[3], cvec[3], origin[3];
|
||||
double px, py, pz;
|
||||
|
||||
px = alo; py = blo; pz = clo;
|
||||
domain->lattice->lattice2box(px,py,pz);
|
||||
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;
|
||||
domain->lattice->lattice2box(px,py,pz);
|
||||
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;
|
||||
domain->lattice->lattice2box(px,py,pz);
|
||||
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;
|
||||
domain->lattice->lattice2box(px,py,pz);
|
||||
px = alo;
|
||||
py = blo;
|
||||
pz = chi;
|
||||
domain->lattice->lattice2box(px, py, pz);
|
||||
cvec[0] = px - origin[0];
|
||||
cvec[1] = py - origin[1];
|
||||
cvec[2] = pz - origin[2];
|
||||
|
||||
// define general triclinic box within Domain class
|
||||
|
||||
domain->define_general_triclinic(avec,bvec,cvec,origin);
|
||||
domain->define_general_triclinic(avec, bvec, cvec, origin);
|
||||
}
|
||||
|
||||
// if molecular, zero out topology info
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user