enable and apply clang-format, revert to some older code constructs where equivalent
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
|
||||||
@ -41,8 +40,7 @@ enum{INSIDE, OUTSIDE};
|
|||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) :
|
FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) :
|
||||||
Fix(lmp, narg, arg),
|
Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), rstr(nullptr), pstr(nullptr),
|
||||||
xstr(nullptr), ystr(nullptr), zstr(nullptr), rstr(nullptr), pstr(nullptr),
|
|
||||||
rlostr(nullptr), rhistr(nullptr), lostr(nullptr), histr(nullptr)
|
rlostr(nullptr), rhistr(nullptr), lostr(nullptr), histr(nullptr)
|
||||||
{
|
{
|
||||||
if (narg < 4) utils::missing_cmd_args(FLERR, "fix indent", error);
|
if (narg < 4) utils::missing_cmd_args(FLERR, "fix indent", error);
|
||||||
@ -104,11 +102,15 @@ FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (!histr) hivalue *= scaling_factor;
|
if (!histr) hivalue *= scaling_factor;
|
||||||
|
|
||||||
} else if (istyle == PLANE) {
|
} else if (istyle == PLANE) {
|
||||||
if (cdim == 0 && !pstr) pvalue *= xscale;
|
if (cdim == 0 && !pstr)
|
||||||
else if (cdim == 1 && !pstr) pvalue *= yscale;
|
pvalue *= xscale;
|
||||||
else if (cdim == 2 && !pstr) pvalue *= zscale;
|
else if (cdim == 1 && !pstr)
|
||||||
|
pvalue *= yscale;
|
||||||
|
else if (cdim == 2 && !pstr)
|
||||||
|
pvalue *= zscale;
|
||||||
|
|
||||||
} else error->all(FLERR,"Unknown fix indent keyword: {}", istyle);
|
} else
|
||||||
|
error->all(FLERR, "Unknown fix indent keyword: {}", istyle);
|
||||||
|
|
||||||
varflag = 0;
|
varflag = 0;
|
||||||
if (xstr || ystr || zstr || rstr || pstr || rlostr || rhistr || lostr || histr) varflag = 1;
|
if (xstr || ystr || zstr || rstr || pstr || rlostr || rhistr || lostr || histr) varflag = 1;
|
||||||
@ -149,64 +151,55 @@ void FixIndent::init()
|
|||||||
{
|
{
|
||||||
if (xstr) {
|
if (xstr) {
|
||||||
xvar = input->variable->find(xstr);
|
xvar = input->variable->find(xstr);
|
||||||
if (xvar < 0)
|
if (xvar < 0) error->all(FLERR, "Variable {} for fix indent does not exist", xstr);
|
||||||
error->all(FLERR,"Variable {} for fix indent does not exist", xstr);
|
|
||||||
if (!input->variable->equalstyle(xvar))
|
if (!input->variable->equalstyle(xvar))
|
||||||
error->all(FLERR, "Variable {} for fix indent is invalid style", xstr);
|
error->all(FLERR, "Variable {} for fix indent is invalid style", xstr);
|
||||||
}
|
}
|
||||||
if (ystr) {
|
if (ystr) {
|
||||||
yvar = input->variable->find(ystr);
|
yvar = input->variable->find(ystr);
|
||||||
if (yvar < 0)
|
if (yvar < 0) error->all(FLERR, "Variable {} for fix indent does not exist", ystr);
|
||||||
error->all(FLERR,"Variable {} for fix indent does not exist", ystr);
|
|
||||||
if (!input->variable->equalstyle(yvar))
|
if (!input->variable->equalstyle(yvar))
|
||||||
error->all(FLERR, "Variable {} for fix indent is invalid style", ystr);
|
error->all(FLERR, "Variable {} for fix indent is invalid style", ystr);
|
||||||
}
|
}
|
||||||
if (zstr) {
|
if (zstr) {
|
||||||
zvar = input->variable->find(zstr);
|
zvar = input->variable->find(zstr);
|
||||||
if (zvar < 0)
|
if (zvar < 0) error->all(FLERR, "Variable {} for fix indent does not exist", zstr);
|
||||||
error->all(FLERR,"Variable {} for fix indent does not exist", zstr);
|
|
||||||
if (!input->variable->equalstyle(zvar))
|
if (!input->variable->equalstyle(zvar))
|
||||||
error->all(FLERR, "Variable {} for fix indent is invalid style", zstr);
|
error->all(FLERR, "Variable {} for fix indent is invalid style", zstr);
|
||||||
}
|
}
|
||||||
if (rstr) {
|
if (rstr) {
|
||||||
rvar = input->variable->find(rstr);
|
rvar = input->variable->find(rstr);
|
||||||
if (rvar < 0)
|
if (rvar < 0) error->all(FLERR, "Variable {} for fix indent does not exist", rstr);
|
||||||
error->all(FLERR,"Variable {} for fix indent does not exist", rstr);
|
|
||||||
if (!input->variable->equalstyle(rvar))
|
if (!input->variable->equalstyle(rvar))
|
||||||
error->all(FLERR, "Variable {} for fix indent is invalid style", rstr);
|
error->all(FLERR, "Variable {} for fix indent is invalid style", rstr);
|
||||||
}
|
}
|
||||||
if (pstr) {
|
if (pstr) {
|
||||||
pvar = input->variable->find(pstr);
|
pvar = input->variable->find(pstr);
|
||||||
if (pvar < 0)
|
if (pvar < 0) error->all(FLERR, "Variable {} for fix indent does not exist", pstr);
|
||||||
error->all(FLERR,"Variable {} for fix indent does not exist", pstr);
|
|
||||||
if (!input->variable->equalstyle(pvar))
|
if (!input->variable->equalstyle(pvar))
|
||||||
error->all(FLERR, "Variable {} for fix indent is invalid style", pstr);
|
error->all(FLERR, "Variable {} for fix indent is invalid style", pstr);
|
||||||
}
|
}
|
||||||
if (rlostr) {
|
if (rlostr) {
|
||||||
rlovar = input->variable->find(rlostr);
|
rlovar = input->variable->find(rlostr);
|
||||||
if (rlovar < 0)
|
if (rlovar < 0) error->all(FLERR, "Variable {} for fix indent does not exist", rlostr);
|
||||||
error->all(FLERR,"Variable {} for fix indent does not exist", rlostr);
|
|
||||||
if (!input->variable->equalstyle(rlovar))
|
if (!input->variable->equalstyle(rlovar))
|
||||||
error->all(FLERR, "Variable {} for fix indent is invalid style", rlostr);
|
error->all(FLERR, "Variable {} for fix indent is invalid style", rlostr);
|
||||||
}
|
}
|
||||||
if (rhistr) {
|
if (rhistr) {
|
||||||
rhivar = input->variable->find(rhistr);
|
rhivar = input->variable->find(rhistr);
|
||||||
if (rhivar < 0)
|
if (rhivar < 0) error->all(FLERR, "Variable {} for fix indent does not exist", rhistr);
|
||||||
error->all(FLERR,"Variable {} for fix indent does not exist", rhistr);
|
|
||||||
if (!input->variable->equalstyle(rhivar))
|
if (!input->variable->equalstyle(rhivar))
|
||||||
error->all(FLERR, "Variable {} for fix indent is invalid style", rhistr);
|
error->all(FLERR, "Variable {} for fix indent is invalid style", rhistr);
|
||||||
}
|
}
|
||||||
if (lostr) {
|
if (lostr) {
|
||||||
lovar = input->variable->find(lostr);
|
lovar = input->variable->find(lostr);
|
||||||
if (lovar < 0)
|
if (lovar < 0) error->all(FLERR, "Variable {} for fix indent does not exist", lostr);
|
||||||
error->all(FLERR,"Variable {} for fix indent does not exist", lostr);
|
|
||||||
if (!input->variable->equalstyle(lovar))
|
if (!input->variable->equalstyle(lovar))
|
||||||
error->all(FLERR, "Variable {} for fix indent is invalid style", lostr);
|
error->all(FLERR, "Variable {} for fix indent is invalid style", lostr);
|
||||||
}
|
}
|
||||||
if (histr) {
|
if (histr) {
|
||||||
hivar = input->variable->find(histr);
|
hivar = input->variable->find(histr);
|
||||||
if (hivar < 0)
|
if (hivar < 0) error->all(FLERR, "Variable {} for fix indent does not exist", histr);
|
||||||
error->all(FLERR,"Variable {} for fix indent does not exist", histr);
|
|
||||||
if (!input->variable->equalstyle(hivar))
|
if (!input->variable->equalstyle(hivar))
|
||||||
error->all(FLERR, "Variable {} for fix indent is invalid style", histr);
|
error->all(FLERR, "Variable {} for fix indent is invalid style", histr);
|
||||||
}
|
}
|
||||||
@ -251,7 +244,7 @@ void FixIndent::post_force(int /*vflag*/)
|
|||||||
|
|
||||||
// ctr = current indenter centerz
|
// ctr = current indenter centerz
|
||||||
|
|
||||||
double ctr[3] {xvalue, yvalue, zvalue};
|
double ctr[3] = {xvalue, yvalue, zvalue};
|
||||||
if (xstr) ctr[0] = input->variable->compute_equal(xvar);
|
if (xstr) ctr[0] = input->variable->compute_equal(xvar);
|
||||||
if (ystr) ctr[1] = input->variable->compute_equal(yvar);
|
if (ystr) ctr[1] = input->variable->compute_equal(yvar);
|
||||||
if (zstr) ctr[2] = input->variable->compute_equal(zvar);
|
if (zstr) ctr[2] = input->variable->compute_equal(zvar);
|
||||||
@ -271,7 +264,7 @@ void FixIndent::post_force(int /*vflag*/)
|
|||||||
|
|
||||||
domain->remap(ctr);
|
domain->remap(ctr);
|
||||||
|
|
||||||
double radius { rstr ? input->variable->compute_equal(rvar) : rvalue};
|
double radius = rstr ? input->variable->compute_equal(rvar) : rvalue;
|
||||||
if (radius < 0.0) error->all(FLERR, "Illegal fix indent sphere radius: {}", radius);
|
if (radius < 0.0) error->all(FLERR, "Illegal fix indent sphere radius: {}", radius);
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++)
|
for (int i = 0; i < nlocal; i++)
|
||||||
@ -317,7 +310,7 @@ void FixIndent::post_force(int /*vflag*/)
|
|||||||
|
|
||||||
for (int i = 0; i < nlocal; i++)
|
for (int i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
double del[3] {x[i][0] - ctr[0], x[i][1] - ctr[1], x[i][2] - ctr[2]};
|
double del[3] = {x[i][0] - ctr[0], x[i][1] - ctr[1], x[i][2] - ctr[2]};
|
||||||
del[cdim] = 0;
|
del[cdim] = 0;
|
||||||
domain->minimum_image(del[0], del[1], del[2]);
|
domain->minimum_image(del[0], del[1], del[2]);
|
||||||
r = sqrt(del[0] * del[0] + del[1] * del[1] + del[2] * del[2]);
|
r = sqrt(del[0] * del[0] + del[1] * del[1] + del[2] * del[2]);
|
||||||
@ -368,7 +361,7 @@ void FixIndent::post_force(int /*vflag*/)
|
|||||||
delz = x[i][2] - ctr[2];
|
delz = x[i][2] - ctr[2];
|
||||||
domain->minimum_image(delx, dely, delz);
|
domain->minimum_image(delx, dely, delz);
|
||||||
|
|
||||||
double x0[3] {delx + ctr[0], dely + ctr[1], delz + ctr[2]};
|
double x0[3] = {delx + ctr[0], dely + ctr[1], delz + ctr[2]};
|
||||||
r = sqrt(delx * delx + dely * dely + delz * delz);
|
r = sqrt(delx * delx + dely * dely + delz * delz);
|
||||||
|
|
||||||
// check if particle is inside or outside the cone
|
// check if particle is inside or outside the cone
|
||||||
@ -493,16 +486,20 @@ int FixIndent::geometry(int narg, char **arg)
|
|||||||
|
|
||||||
if (utils::strmatch(arg[1], "^v_")) {
|
if (utils::strmatch(arg[1], "^v_")) {
|
||||||
xstr = utils::strdup(arg[1] + 2);
|
xstr = utils::strdup(arg[1] + 2);
|
||||||
} else xvalue = utils::numeric(FLERR,arg[1],false,lmp);
|
} else
|
||||||
|
xvalue = utils::numeric(FLERR, arg[1], false, lmp);
|
||||||
if (utils::strmatch(arg[2], "^v_")) {
|
if (utils::strmatch(arg[2], "^v_")) {
|
||||||
ystr = utils::strdup(arg[2] + 2);
|
ystr = utils::strdup(arg[2] + 2);
|
||||||
} else yvalue = utils::numeric(FLERR,arg[2],false,lmp);
|
} else
|
||||||
|
yvalue = utils::numeric(FLERR, arg[2], false, lmp);
|
||||||
if (utils::strmatch(arg[3], "^v_")) {
|
if (utils::strmatch(arg[3], "^v_")) {
|
||||||
zstr = utils::strdup(arg[3] + 2);
|
zstr = utils::strdup(arg[3] + 2);
|
||||||
} else zvalue = utils::numeric(FLERR,arg[3],false,lmp);
|
} else
|
||||||
|
zvalue = utils::numeric(FLERR, arg[3], false, lmp);
|
||||||
if (utils::strmatch(arg[4], "^v_")) {
|
if (utils::strmatch(arg[4], "^v_")) {
|
||||||
rstr = utils::strdup(arg[4] + 2);
|
rstr = utils::strdup(arg[4] + 2);
|
||||||
} else rvalue = utils::numeric(FLERR,arg[4],false,lmp);
|
} else
|
||||||
|
rvalue = utils::numeric(FLERR, arg[4], false, lmp);
|
||||||
|
|
||||||
istyle = SPHERE;
|
istyle = SPHERE;
|
||||||
return 5;
|
return 5;
|
||||||
@ -518,31 +515,39 @@ int FixIndent::geometry(int narg, char **arg)
|
|||||||
cdim = 0;
|
cdim = 0;
|
||||||
if (utils::strmatch(arg[2], "^v_")) {
|
if (utils::strmatch(arg[2], "^v_")) {
|
||||||
ystr = utils::strdup(arg[2] + 2);
|
ystr = utils::strdup(arg[2] + 2);
|
||||||
} else yvalue = utils::numeric(FLERR,arg[2],false,lmp);
|
} else
|
||||||
|
yvalue = utils::numeric(FLERR, arg[2], false, lmp);
|
||||||
if (utils::strmatch(arg[3], "^v_")) {
|
if (utils::strmatch(arg[3], "^v_")) {
|
||||||
zstr = utils::strdup(arg[3] + 2);
|
zstr = utils::strdup(arg[3] + 2);
|
||||||
} else zvalue = utils::numeric(FLERR,arg[3],false,lmp);
|
} else
|
||||||
|
zvalue = utils::numeric(FLERR, arg[3], false, lmp);
|
||||||
} else if (strcmp(arg[1], "y") == 0) {
|
} else if (strcmp(arg[1], "y") == 0) {
|
||||||
cdim = 1;
|
cdim = 1;
|
||||||
if (utils::strmatch(arg[2], "^v_")) {
|
if (utils::strmatch(arg[2], "^v_")) {
|
||||||
xstr = utils::strdup(arg[2] + 2);
|
xstr = utils::strdup(arg[2] + 2);
|
||||||
} else xvalue = utils::numeric(FLERR,arg[2],false,lmp);
|
} else
|
||||||
|
xvalue = utils::numeric(FLERR, arg[2], false, lmp);
|
||||||
if (utils::strmatch(arg[3], "^v_")) {
|
if (utils::strmatch(arg[3], "^v_")) {
|
||||||
zstr = utils::strdup(arg[3] + 2);
|
zstr = utils::strdup(arg[3] + 2);
|
||||||
} else zvalue = utils::numeric(FLERR,arg[3],false,lmp);
|
} else
|
||||||
|
zvalue = utils::numeric(FLERR, arg[3], false, lmp);
|
||||||
} else if (strcmp(arg[1], "z") == 0) {
|
} else if (strcmp(arg[1], "z") == 0) {
|
||||||
cdim = 2;
|
cdim = 2;
|
||||||
if (utils::strmatch(arg[2], "^v_")) {
|
if (utils::strmatch(arg[2], "^v_")) {
|
||||||
xstr = utils::strdup(arg[2] + 2);
|
xstr = utils::strdup(arg[2] + 2);
|
||||||
} else xvalue = utils::numeric(FLERR,arg[2],false,lmp);
|
} else
|
||||||
|
xvalue = utils::numeric(FLERR, arg[2], false, lmp);
|
||||||
if (utils::strmatch(arg[3], "^v_")) {
|
if (utils::strmatch(arg[3], "^v_")) {
|
||||||
ystr = utils::strdup(arg[3] + 2);
|
ystr = utils::strdup(arg[3] + 2);
|
||||||
} else yvalue = utils::numeric(FLERR,arg[3],false,lmp);
|
} else
|
||||||
} else error->all(FLERR,"Unknown fix indent cylinder argument: {}", arg[1]);
|
yvalue = utils::numeric(FLERR, arg[3], false, lmp);
|
||||||
|
} else
|
||||||
|
error->all(FLERR, "Unknown fix indent cylinder argument: {}", arg[1]);
|
||||||
|
|
||||||
if (utils::strmatch(arg[4], "^v_")) {
|
if (utils::strmatch(arg[4], "^v_")) {
|
||||||
rstr = utils::strdup(arg[4] + 2);
|
rstr = utils::strdup(arg[4] + 2);
|
||||||
} else rvalue = utils::numeric(FLERR,arg[4],false,lmp);
|
} else
|
||||||
|
rvalue = utils::numeric(FLERR, arg[4], false, lmp);
|
||||||
|
|
||||||
istyle = CYLINDER;
|
istyle = CYLINDER;
|
||||||
return 5;
|
return 5;
|
||||||
@ -558,43 +563,54 @@ int FixIndent::geometry(int narg, char **arg)
|
|||||||
cdim = 0;
|
cdim = 0;
|
||||||
if (utils::strmatch(arg[2], "^v_")) {
|
if (utils::strmatch(arg[2], "^v_")) {
|
||||||
ystr = utils::strdup(arg[2] + 2);
|
ystr = utils::strdup(arg[2] + 2);
|
||||||
} else yvalue = utils::numeric(FLERR,arg[2],false,lmp);
|
} else
|
||||||
|
yvalue = utils::numeric(FLERR, arg[2], false, lmp);
|
||||||
if (utils::strmatch(arg[3], "^v_")) {
|
if (utils::strmatch(arg[3], "^v_")) {
|
||||||
zstr = utils::strdup(arg[3] + 2);
|
zstr = utils::strdup(arg[3] + 2);
|
||||||
} else zvalue = utils::numeric(FLERR,arg[3],false,lmp);
|
} else
|
||||||
|
zvalue = utils::numeric(FLERR, arg[3], false, lmp);
|
||||||
|
|
||||||
} else if (strcmp(arg[1], "y") == 0) {
|
} else if (strcmp(arg[1], "y") == 0) {
|
||||||
cdim = 1;
|
cdim = 1;
|
||||||
if (utils::strmatch(arg[2], "^v_")) {
|
if (utils::strmatch(arg[2], "^v_")) {
|
||||||
xstr = utils::strdup(arg[2] + 2);
|
xstr = utils::strdup(arg[2] + 2);
|
||||||
} else xvalue = utils::numeric(FLERR,arg[2],false,lmp);
|
} else
|
||||||
|
xvalue = utils::numeric(FLERR, arg[2], false, lmp);
|
||||||
if (utils::strmatch(arg[3], "^v_")) {
|
if (utils::strmatch(arg[3], "^v_")) {
|
||||||
zstr = utils::strdup(arg[3] + 2);
|
zstr = utils::strdup(arg[3] + 2);
|
||||||
} else zvalue = utils::numeric(FLERR,arg[3],false,lmp);
|
} else
|
||||||
|
zvalue = utils::numeric(FLERR, arg[3], false, lmp);
|
||||||
|
|
||||||
} else if (strcmp(arg[1], "z") == 0) {
|
} else if (strcmp(arg[1], "z") == 0) {
|
||||||
cdim = 2;
|
cdim = 2;
|
||||||
if (utils::strmatch(arg[2], "^v_")) {
|
if (utils::strmatch(arg[2], "^v_")) {
|
||||||
xstr = utils::strdup(arg[2] + 2);
|
xstr = utils::strdup(arg[2] + 2);
|
||||||
} else xvalue = utils::numeric(FLERR,arg[2],false,lmp);
|
} else
|
||||||
|
xvalue = utils::numeric(FLERR, arg[2], false, lmp);
|
||||||
if (utils::strmatch(arg[3], "^v_")) {
|
if (utils::strmatch(arg[3], "^v_")) {
|
||||||
ystr = utils::strdup(arg[3] + 2);
|
ystr = utils::strdup(arg[3] + 2);
|
||||||
} else yvalue = utils::numeric(FLERR,arg[3],false,lmp);
|
} else
|
||||||
|
yvalue = utils::numeric(FLERR, arg[3], false, lmp);
|
||||||
|
|
||||||
} else error->all(FLERR,"Unknown fix indent cone argument: {}", arg[1]);
|
} else
|
||||||
|
error->all(FLERR, "Unknown fix indent cone argument: {}", arg[1]);
|
||||||
|
|
||||||
if (utils::strmatch(arg[4], "^v_")) {
|
if (utils::strmatch(arg[4], "^v_")) {
|
||||||
rlostr = utils::strdup(arg[4] + 2);
|
rlostr = utils::strdup(arg[4] + 2);
|
||||||
} else rlovalue = utils::numeric(FLERR,arg[4],false,lmp);
|
} else
|
||||||
|
rlovalue = utils::numeric(FLERR, arg[4], false, lmp);
|
||||||
if (utils::strmatch(arg[5], "^v_")) {
|
if (utils::strmatch(arg[5], "^v_")) {
|
||||||
rhistr = utils::strdup(arg[5] + 2);
|
rhistr = utils::strdup(arg[5] + 2);
|
||||||
} else rhivalue = utils::numeric(FLERR,arg[5],false,lmp);
|
} else
|
||||||
|
rhivalue = utils::numeric(FLERR, arg[5], false, lmp);
|
||||||
if (utils::strmatch(arg[6], "^v_")) {
|
if (utils::strmatch(arg[6], "^v_")) {
|
||||||
lostr = utils::strdup(arg[6] + 2);
|
lostr = utils::strdup(arg[6] + 2);
|
||||||
} else lovalue = utils::numeric(FLERR,arg[6],false,lmp);
|
} else
|
||||||
|
lovalue = utils::numeric(FLERR, arg[6], false, lmp);
|
||||||
if (utils::strmatch(arg[7], "^v_")) {
|
if (utils::strmatch(arg[7], "^v_")) {
|
||||||
histr = utils::strdup(arg[7] + 2);
|
histr = utils::strdup(arg[7] + 2);
|
||||||
} else hivalue = utils::numeric(FLERR,arg[7],false,lmp);
|
} else
|
||||||
|
hivalue = utils::numeric(FLERR, arg[7], false, lmp);
|
||||||
|
|
||||||
istyle = CONE;
|
istyle = CONE;
|
||||||
return 8;
|
return 8;
|
||||||
@ -605,18 +621,26 @@ int FixIndent::geometry(int narg, char **arg)
|
|||||||
if (strcmp(arg[0], "plane") == 0) {
|
if (strcmp(arg[0], "plane") == 0) {
|
||||||
if (istyle != NONE) error->all(FLERR, "Fix indent requires a single geometry keyword");
|
if (istyle != NONE) error->all(FLERR, "Fix indent requires a single geometry keyword");
|
||||||
if (4 > narg) utils::missing_cmd_args(FLERR, "fix indent plane", error);
|
if (4 > narg) utils::missing_cmd_args(FLERR, "fix indent plane", error);
|
||||||
if (strcmp(arg[1],"x") == 0) cdim = 0;
|
if (strcmp(arg[1], "x") == 0)
|
||||||
else if (strcmp(arg[1],"y") == 0) cdim = 1;
|
cdim = 0;
|
||||||
else if (strcmp(arg[1],"z") == 0) cdim = 2;
|
else if (strcmp(arg[1], "y") == 0)
|
||||||
else error->all(FLERR,"Unknown fix indent plane argument: {}", arg[1]);
|
cdim = 1;
|
||||||
|
else if (strcmp(arg[1], "z") == 0)
|
||||||
|
cdim = 2;
|
||||||
|
else
|
||||||
|
error->all(FLERR, "Unknown fix indent plane argument: {}", arg[1]);
|
||||||
|
|
||||||
if (utils::strmatch(arg[2], "^v_")) {
|
if (utils::strmatch(arg[2], "^v_")) {
|
||||||
pstr = utils::strdup(arg[2] + 2);
|
pstr = utils::strdup(arg[2] + 2);
|
||||||
} else pvalue = utils::numeric(FLERR,arg[2],false,lmp);
|
} else
|
||||||
|
pvalue = utils::numeric(FLERR, arg[2], false, lmp);
|
||||||
|
|
||||||
if (strcmp(arg[3],"lo") == 0) planeside = -1;
|
if (strcmp(arg[3], "lo") == 0)
|
||||||
else if (strcmp(arg[3],"hi") == 0) planeside = 1;
|
planeside = -1;
|
||||||
else error->all(FLERR,"Unknown fix indent plane argument: {}", arg[3]);
|
else if (strcmp(arg[3], "hi") == 0)
|
||||||
|
planeside = 1;
|
||||||
|
else
|
||||||
|
error->all(FLERR, "Unknown fix indent plane argument: {}", arg[3]);
|
||||||
istyle = PLANE;
|
istyle = PLANE;
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
@ -642,19 +666,26 @@ void FixIndent::options(int narg, char **arg)
|
|||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg], "units") == 0) {
|
if (strcmp(arg[iarg], "units") == 0) {
|
||||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix indent units", error);
|
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix indent units", error);
|
||||||
if (strcmp(arg[iarg+1],"box") == 0) scaleflag = 0;
|
if (strcmp(arg[iarg + 1], "box") == 0)
|
||||||
else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = 1;
|
scaleflag = 0;
|
||||||
else error->all(FLERR,"Unknown fix indent units argument: {}", arg[iarg+1]);
|
else if (strcmp(arg[iarg + 1], "lattice") == 0)
|
||||||
|
scaleflag = 1;
|
||||||
|
else
|
||||||
|
error->all(FLERR, "Unknown fix indent units argument: {}", arg[iarg + 1]);
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
|
|
||||||
} else if (strcmp(arg[iarg], "side") == 0) {
|
} else if (strcmp(arg[iarg], "side") == 0) {
|
||||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix indent side", error);
|
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix indent side", error);
|
||||||
if (strcmp(arg[iarg+1],"in") == 0) side = INSIDE;
|
if (strcmp(arg[iarg + 1], "in") == 0)
|
||||||
else if (strcmp(arg[iarg+1],"out") == 0) side = OUTSIDE;
|
side = INSIDE;
|
||||||
else error->all(FLERR,"Unknown fix indent side argument: {}", arg[iarg+1]);
|
else if (strcmp(arg[iarg + 1], "out") == 0)
|
||||||
|
side = OUTSIDE;
|
||||||
|
else
|
||||||
|
error->all(FLERR, "Unknown fix indent side argument: {}", arg[iarg + 1]);
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
|
|
||||||
} else error->all(FLERR,"Unknown fix indent argument: {}", arg[iarg]);
|
} else
|
||||||
|
error->all(FLERR, "Unknown fix indent argument: {}", arg[iarg]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -662,12 +693,12 @@ void FixIndent::options(int narg, char **arg)
|
|||||||
determines if a point is inside (true) or outside (false) of a cone
|
determines if a point is inside (true) or outside (false) of a cone
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
bool FixIndent::PointInsideCone(int dir, double *center, double lo,
|
bool FixIndent::PointInsideCone(int dir, double *center, double lo, double hi, double rlo,
|
||||||
double hi, double rlo, double rhi, double *x)
|
double rhi, double *x)
|
||||||
{
|
{
|
||||||
if ((x[dir] > hi) || (x[dir] < lo)) return false;
|
if ((x[dir] > hi) || (x[dir] < lo)) return false;
|
||||||
|
|
||||||
double del[3] {x[0] - center[0], x[1] - center[1], x[2] - center[2]};
|
double del[3] = {x[0] - center[0], x[1] - center[1], x[2] - center[2]};
|
||||||
del[dir] = 0.0;
|
del[dir] = 0.0;
|
||||||
|
|
||||||
double dist = sqrt(del[0] * del[0] + del[1] * del[1] + del[2] * del[2]);
|
double dist = sqrt(del[0] * del[0] + del[1] * del[1] + del[2] * del[2]);
|
||||||
@ -682,17 +713,14 @@ bool FixIndent::PointInsideCone(int dir, double *center, double lo,
|
|||||||
distance between an exterior point and a cone
|
distance between an exterior point and a cone
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixIndent::DistanceExteriorPoint(int dir, double *center, double lo, double hi,
|
void FixIndent::DistanceExteriorPoint(int dir, double *center, double lo, double hi, double rlo,
|
||||||
double rlo, double rhi,
|
double rhi, double &x, double &y, double &z)
|
||||||
double &x, double &y, double &z)
|
|
||||||
{
|
{
|
||||||
double xp[3], nearest[3], corner1[3], corner2[3];
|
double xp[3], nearest[3], corner1[3], corner2[3];
|
||||||
|
double point[3] = {x, y, z};
|
||||||
|
double del[3] = {x - center[0], y - center[1], z - center[2]};
|
||||||
|
|
||||||
double point[3] {x, y, z};
|
|
||||||
|
|
||||||
double del[3] {x - center[0], y - center[1], z - center[2]};
|
|
||||||
del[dir] = 0.0;
|
del[dir] = 0.0;
|
||||||
|
|
||||||
double r = sqrt(del[0] * del[0] + del[1] * del[1] + del[2] * del[2]);
|
double r = sqrt(del[0] * del[0] + del[1] * del[1] + del[2] * del[2]);
|
||||||
|
|
||||||
corner1[0] = center[0] + del[0] * rlo / r;
|
corner1[0] = center[0] + del[0] * rlo / r;
|
||||||
@ -705,10 +733,10 @@ void FixIndent::DistanceExteriorPoint(int dir, double *center, double lo, double
|
|||||||
corner2[2] = center[2] + del[2] * rhi / r;
|
corner2[2] = center[2] + del[2] * rhi / r;
|
||||||
corner2[dir] = hi;
|
corner2[dir] = hi;
|
||||||
|
|
||||||
double corner3[3] {center[0], center[1], center[2]};
|
double corner3[3] = {center[0], center[1], center[2]};
|
||||||
corner3[dir] = lo;
|
corner3[dir] = lo;
|
||||||
|
|
||||||
double corner4[3] {center[0], center[1], center[2]};
|
double corner4[3] = {center[0], center[1], center[2]};
|
||||||
corner4[dir] = hi;
|
corner4[dir] = hi;
|
||||||
|
|
||||||
// initialize distance to a big number
|
// initialize distance to a big number
|
||||||
@ -741,14 +769,13 @@ void FixIndent::DistanceExteriorPoint(int dir, double *center, double lo, double
|
|||||||
distance between an interior point and a cone
|
distance between an interior point and a cone
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixIndent::DistanceInteriorPoint(int dir, double *center,
|
void FixIndent::DistanceInteriorPoint(int dir, double *center, double lo, double hi, double rlo,
|
||||||
double lo, double hi, double rlo, double rhi, double &x,
|
double rhi, double &x, double &y, double &z)
|
||||||
double &y, double &z)
|
|
||||||
{
|
{
|
||||||
double r, dist_disk, dist_surf;
|
double r, dist_disk, dist_surf;
|
||||||
double surflo[3], surfhi[3], xs[3];
|
double surflo[3], surfhi[3], xs[3];
|
||||||
double initial_point[3] {x, y, z};
|
double initial_point[3] = {x, y, z};
|
||||||
double point[3] {0.0, 0.0, 0.0};
|
double point[3] = {0.0, 0.0, 0.0};
|
||||||
|
|
||||||
// initial check with the two disks
|
// initial check with the two disks
|
||||||
|
|
||||||
@ -762,7 +789,7 @@ void FixIndent::DistanceInteriorPoint(int dir, double *center,
|
|||||||
|
|
||||||
// check with the points in the conical surface
|
// check with the points in the conical surface
|
||||||
|
|
||||||
double del[3] {x - center[0], y - center[1], z - center[2]};
|
double del[3] = {x - center[0], y - center[1], z - center[2]};
|
||||||
del[dir] = 0.0;
|
del[dir] = 0.0;
|
||||||
r = sqrt(del[0] * del[0] + del[1] * del[1] + del[2] * del[2]);
|
r = sqrt(del[0] * del[0] + del[1] * del[1] + del[2] * del[2]);
|
||||||
|
|
||||||
@ -778,7 +805,7 @@ void FixIndent::DistanceInteriorPoint(int dir, double *center,
|
|||||||
|
|
||||||
point_on_line_segment(surflo, surfhi, initial_point, xs);
|
point_on_line_segment(surflo, surfhi, initial_point, xs);
|
||||||
|
|
||||||
double dx[3] {initial_point[0] - xs[0], initial_point[1] - xs[1], initial_point[2] - xs[2]};
|
double dx[3] = {initial_point[0] - xs[0], initial_point[1] - xs[1], initial_point[2] - xs[2]};
|
||||||
dist_surf = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2];
|
dist_surf = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2];
|
||||||
if (dist_surf < dist_disk) {
|
if (dist_surf < dist_disk) {
|
||||||
x = dx[0];
|
x = dx[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user