diff --git a/doc/src/dump_image.rst b/doc/src/dump_image.rst index 9b8c7febf4..0aeab34f60 100644 --- a/doc/src/dump_image.rst +++ b/doc/src/dump_image.rst @@ -44,7 +44,7 @@ Syntax color = *type* bflag1,bflag2 = 2 numeric flags to affect how bodies are drawn *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* fflag1,fflag2 = 2 numeric flags to affect how fix objects are drawn *size* values = width height = size of images diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index f409d667c0..ad75284498 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -86,7 +86,7 @@ void CreateAtoms::command(int narg, char **arg) ntype = utils::inumeric(FLERR, arg[0], false, lmp); const char *meshfile; - double radiusscale = 1.0; + radthresh = 1.0; int iarg; if (strcmp(arg[1], "box") == 0) { style = BOX; @@ -146,6 +146,8 @@ void CreateAtoms::command(int narg, char **arg) int subsetseed; overlapflag = 0; maxtry = DEFAULT_MAXTRY; + radscale = 1.0; + radthresh = domain->lattice->xlattice; nbasis = domain->lattice->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); if (maxtry <= 0) error->all(FLERR, "Illegal create_atoms command"); iarg += 2; - } else if (strcmp(arg[iarg], "radiusscale") == 0) { - if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_atoms radiusscale", error); + } else if (strcmp(arg[iarg], "radscale") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_atoms radscale", error); 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) - error->all(FLERR, "Must have atom attribute radius to set radiusscale factor"); - radiusscale = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + error->all(FLERR, "Must have atom attribute radius to set radscale factor"); + 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; } else 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) add_random(); else if (style == MESH) - add_mesh(meshfile, radiusscale); + add_mesh(meshfile); else add_lattice(); @@ -841,9 +849,8 @@ void CreateAtoms::add_random() 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]; 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 int ilocal = 0; - if (ravg > xlat) { + if (ravg > radthresh) { 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[1], vert[2], side[1]); MathExtra::sub3(vert[2], vert[0], side[2]); + // determine longest side const double l1 = MathExtra::len3(side[0]); const double l2 = MathExtra::len3(side[1]); 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(vert2, molid, radiusscale); + ilocal = add_tricenter(vert1, molid); + ilocal += add_tricenter(vert2, molid); } 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])) { atom->avec->create_atom(ntype, center); - int idx = atom->nlocal-1; - if (atom->radius_flag) atom->radius[idx] = ravg * radiusscale; + int idx = atom->nlocal - 1; + if (atom->radius_flag) atom->radius[idx] = ravg * radscale; if (atom->molecule_flag) atom->molecule[idx] = molid; ++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 ------------------------------------------------------------------------- */ -void CreateAtoms::add_mesh(const char *filename, double radiusscale) +void CreateAtoms::add_mesh(const char *filename) { double vert[3][3]; 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 // or splitting recursively into halves as needed to get the desired density ++ntriangle; - atomlocal += add_tricenter(vert, molid, radiusscale); + atomlocal += add_tricenter(vert, molid); } } catch (std::exception &e) { error->all(FLERR, "Error reading triangles from file {}: {}", filename, e.what()); diff --git a/src/create_atoms.h b/src/create_atoms.h index 6062f19a5f..f9d96f24a3 100644 --- a/src/create_atoms.h +++ b/src/create_atoms.h @@ -41,6 +41,7 @@ class CreateAtoms : public Command { double subsetfrac; int *basistype; double xone[3], quatone[4]; + double radthresh, radscale; int varflag, vvar, xvar, yvar, zvar; char *vstr, *xstr, *ystr, *zstr; @@ -64,8 +65,8 @@ class CreateAtoms : public Command { void add_single(); void add_random(); - void add_mesh(const char *, double); - int add_tricenter(const double [3][3], tagint, double); + void add_mesh(const char *); + int add_tricenter(const double [3][3], tagint); void add_lattice(); void loop_lattice(int); void add_molecule(double *);