make radscale and radthresh class members
This commit is contained in:
@ -44,7 +44,7 @@ Syntax
|
|||||||
color = *type*
|
color = *type*
|
||||||
bflag1,bflag2 = 2 numeric flags to affect how bodies are drawn
|
bflag1,bflag2 = 2 numeric flags to affect how bodies are drawn
|
||||||
*fix* = fixID color fflag1 fflag2
|
*fix* = fixID color fflag1 fflag2
|
||||||
fixID = ID of fix that generates objects to dray
|
fixID = ID of fix that generates objects to draw
|
||||||
color = *type*
|
color = *type*
|
||||||
fflag1,fflag2 = 2 numeric flags to affect how fix objects are drawn
|
fflag1,fflag2 = 2 numeric flags to affect how fix objects are drawn
|
||||||
*size* values = width height = size of images
|
*size* values = width height = size of images
|
||||||
|
|||||||
@ -86,7 +86,7 @@ void CreateAtoms::command(int narg, char **arg)
|
|||||||
ntype = utils::inumeric(FLERR, arg[0], false, lmp);
|
ntype = utils::inumeric(FLERR, arg[0], false, lmp);
|
||||||
|
|
||||||
const char *meshfile;
|
const char *meshfile;
|
||||||
double radiusscale = 1.0;
|
radthresh = 1.0;
|
||||||
int iarg;
|
int iarg;
|
||||||
if (strcmp(arg[1], "box") == 0) {
|
if (strcmp(arg[1], "box") == 0) {
|
||||||
style = BOX;
|
style = BOX;
|
||||||
@ -146,6 +146,8 @@ void CreateAtoms::command(int narg, char **arg)
|
|||||||
int subsetseed;
|
int subsetseed;
|
||||||
overlapflag = 0;
|
overlapflag = 0;
|
||||||
maxtry = DEFAULT_MAXTRY;
|
maxtry = DEFAULT_MAXTRY;
|
||||||
|
radscale = 1.0;
|
||||||
|
radthresh = domain->lattice->xlattice;
|
||||||
|
|
||||||
nbasis = domain->lattice->nbasis;
|
nbasis = domain->lattice->nbasis;
|
||||||
basistype = new int[nbasis];
|
basistype = new int[nbasis];
|
||||||
@ -255,13 +257,19 @@ void CreateAtoms::command(int narg, char **arg)
|
|||||||
maxtry = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
maxtry = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||||
if (maxtry <= 0) error->all(FLERR, "Illegal create_atoms command");
|
if (maxtry <= 0) error->all(FLERR, "Illegal create_atoms command");
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg], "radiusscale") == 0) {
|
} else if (strcmp(arg[iarg], "radscale") == 0) {
|
||||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_atoms radiusscale", error);
|
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_atoms radscale", error);
|
||||||
if (style != MESH)
|
if (style != MESH)
|
||||||
error->all(FLERR, "Create_atoms radiusscale can only be used with mesh style");
|
error->all(FLERR, "Create_atoms radscale can only be used with mesh style");
|
||||||
if (!atom->radius_flag)
|
if (!atom->radius_flag)
|
||||||
error->all(FLERR, "Must have atom attribute radius to set radiusscale factor");
|
error->all(FLERR, "Must have atom attribute radius to set radscale factor");
|
||||||
radiusscale = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
|
radscale = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
|
||||||
|
iarg += 2;
|
||||||
|
} else if (strcmp(arg[iarg], "radthresh") == 0) {
|
||||||
|
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_atoms radthresh", error);
|
||||||
|
if (style != MESH)
|
||||||
|
error->all(FLERR, "Create_atoms radthresh can only be used with mesh style");
|
||||||
|
radthresh = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else
|
} else
|
||||||
error->all(FLERR, "Illegal create_atoms command option {}", arg[iarg]);
|
error->all(FLERR, "Illegal create_atoms command option {}", arg[iarg]);
|
||||||
@ -437,7 +445,7 @@ void CreateAtoms::command(int narg, char **arg)
|
|||||||
else if (style == RANDOM)
|
else if (style == RANDOM)
|
||||||
add_random();
|
add_random();
|
||||||
else if (style == MESH)
|
else if (style == MESH)
|
||||||
add_mesh(meshfile, radiusscale);
|
add_mesh(meshfile);
|
||||||
else
|
else
|
||||||
add_lattice();
|
add_lattice();
|
||||||
|
|
||||||
@ -841,9 +849,8 @@ void CreateAtoms::add_random()
|
|||||||
or split into two halves along the longest side and recurse
|
or split into two halves along the longest side and recurse
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int CreateAtoms::add_tricenter(const double vert[3][3], tagint molid, double radiusscale)
|
int CreateAtoms::add_tricenter(const double vert[3][3], tagint molid)
|
||||||
{
|
{
|
||||||
const double xlat = domain->lattice->xlattice;
|
|
||||||
double center[3], temp[3];
|
double center[3], temp[3];
|
||||||
|
|
||||||
MathExtra::add3(vert[0], vert[1], center);
|
MathExtra::add3(vert[0], vert[1], center);
|
||||||
@ -862,14 +869,15 @@ int CreateAtoms::add_tricenter(const double vert[3][3], tagint molid, double rad
|
|||||||
// lattice parameter, the triangle is split it in half along its longest side
|
// lattice parameter, the triangle is split it in half along its longest side
|
||||||
|
|
||||||
int ilocal = 0;
|
int ilocal = 0;
|
||||||
if (ravg > xlat) {
|
if (ravg > radthresh) {
|
||||||
double vert1[3][3], vert2[3][3], side[3][3];
|
double vert1[3][3], vert2[3][3], side[3][3];
|
||||||
|
|
||||||
// determine side vectors and longest side
|
// determine side vectors
|
||||||
MathExtra::sub3(vert[0], vert[1], side[0]);
|
MathExtra::sub3(vert[0], vert[1], side[0]);
|
||||||
MathExtra::sub3(vert[1], vert[2], side[1]);
|
MathExtra::sub3(vert[1], vert[2], side[1]);
|
||||||
MathExtra::sub3(vert[2], vert[0], side[2]);
|
MathExtra::sub3(vert[2], vert[0], side[2]);
|
||||||
|
|
||||||
|
// determine longest side
|
||||||
const double l1 = MathExtra::len3(side[0]);
|
const double l1 = MathExtra::len3(side[0]);
|
||||||
const double l2 = MathExtra::len3(side[1]);
|
const double l2 = MathExtra::len3(side[1]);
|
||||||
const double l3 = MathExtra::len3(side[2]);
|
const double l3 = MathExtra::len3(side[2]);
|
||||||
@ -894,8 +902,8 @@ int CreateAtoms::add_tricenter(const double vert[3][3], tagint molid, double rad
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ilocal = add_tricenter(vert1, molid, radiusscale);
|
ilocal = add_tricenter(vert1, molid);
|
||||||
ilocal += add_tricenter(vert2, molid, radiusscale);
|
ilocal += add_tricenter(vert2, molid);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -908,8 +916,8 @@ int CreateAtoms::add_tricenter(const double vert[3][3], tagint molid, double rad
|
|||||||
(center[1] < subhi[1]) && (center[2] >= sublo[2]) && (center[2] < subhi[2])) {
|
(center[1] < subhi[1]) && (center[2] >= sublo[2]) && (center[2] < subhi[2])) {
|
||||||
|
|
||||||
atom->avec->create_atom(ntype, center);
|
atom->avec->create_atom(ntype, center);
|
||||||
int idx = atom->nlocal-1;
|
int idx = atom->nlocal - 1;
|
||||||
if (atom->radius_flag) atom->radius[idx] = ravg * radiusscale;
|
if (atom->radius_flag) atom->radius[idx] = ravg * radscale;
|
||||||
if (atom->molecule_flag) atom->molecule[idx] = molid;
|
if (atom->molecule_flag) atom->molecule[idx] = molid;
|
||||||
++ilocal;
|
++ilocal;
|
||||||
}
|
}
|
||||||
@ -921,7 +929,7 @@ int CreateAtoms::add_tricenter(const double vert[3][3], tagint molid, double rad
|
|||||||
add atoms at center of triangulated mesh
|
add atoms at center of triangulated mesh
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void CreateAtoms::add_mesh(const char *filename, double radiusscale)
|
void CreateAtoms::add_mesh(const char *filename)
|
||||||
{
|
{
|
||||||
double vert[3][3];
|
double vert[3][3];
|
||||||
tagint *mol = atom->molecule;
|
tagint *mol = atom->molecule;
|
||||||
@ -985,7 +993,7 @@ void CreateAtoms::add_mesh(const char *filename, double radiusscale)
|
|||||||
// now we have three vertices ... proceed with adding atom in center of triangle
|
// now we have three vertices ... proceed with adding atom in center of triangle
|
||||||
// or splitting recursively into halves as needed to get the desired density
|
// or splitting recursively into halves as needed to get the desired density
|
||||||
++ntriangle;
|
++ntriangle;
|
||||||
atomlocal += add_tricenter(vert, molid, radiusscale);
|
atomlocal += add_tricenter(vert, molid);
|
||||||
}
|
}
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
error->all(FLERR, "Error reading triangles from file {}: {}", filename, e.what());
|
error->all(FLERR, "Error reading triangles from file {}: {}", filename, e.what());
|
||||||
|
|||||||
@ -41,6 +41,7 @@ class CreateAtoms : public Command {
|
|||||||
double subsetfrac;
|
double subsetfrac;
|
||||||
int *basistype;
|
int *basistype;
|
||||||
double xone[3], quatone[4];
|
double xone[3], quatone[4];
|
||||||
|
double radthresh, radscale;
|
||||||
|
|
||||||
int varflag, vvar, xvar, yvar, zvar;
|
int varflag, vvar, xvar, yvar, zvar;
|
||||||
char *vstr, *xstr, *ystr, *zstr;
|
char *vstr, *xstr, *ystr, *zstr;
|
||||||
@ -64,8 +65,8 @@ class CreateAtoms : public Command {
|
|||||||
|
|
||||||
void add_single();
|
void add_single();
|
||||||
void add_random();
|
void add_random();
|
||||||
void add_mesh(const char *, double);
|
void add_mesh(const char *);
|
||||||
int add_tricenter(const double [3][3], tagint, double);
|
int add_tricenter(const double [3][3], tagint);
|
||||||
void add_lattice();
|
void add_lattice();
|
||||||
void loop_lattice(int);
|
void loop_lattice(int);
|
||||||
void add_molecule(double *);
|
void add_molecule(double *);
|
||||||
|
|||||||
Reference in New Issue
Block a user