Changed "exclude" keyword to "overlap"

+ added new error description to header file
+ minor fix in the doc file
This commit is contained in:
Eugen Rožić
2022-02-14 12:46:44 +01:00
parent 78cf0365e6
commit 374a172246
3 changed files with 33 additions and 29 deletions

View File

@ -26,7 +26,7 @@ Syntax
region-ID = create atoms within this region, use NULL for entire simulation box
* zero or more keyword/value pairs may be appended
* keyword = *mol* or *basis* or *ratio* or *subset* or *remap* or *var* or *set* or *rotate* or *units*
* keyword = *mol* or *basis* or *ratio* or *subset* or *remap* or *var* or *set* or *rotate* or *maxtries* or *overlap* or *units*
.. parsed-literal::
@ -50,8 +50,8 @@ Syntax
*rotate* values = theta Rx Ry Rz
theta = rotation angle for single molecule (degrees)
Rx,Ry,Rz = rotation vector for single molecule
*maxtries* value = N = number of tries (for a single particle) before failure
*exclude* value = radius = radius of exclusion area around existing atoms
*maxtries* value = N = number of tries (for a single particle to be created) before failure
*overlap* value = radius = the minimum distance from existing atoms (to avoid overlapping/huge forces)
*units* value = *lattice* or *box*
*lattice* = the geometry is defined in lattice units
*box* = the geometry is defined in simulation box units
@ -66,7 +66,7 @@ Examples
create_atoms 3 region regsphere basis 2 3 ratio 0.5 74637
create_atoms 3 single 0 0 5
create_atoms 1 box var v set x xpos set y ypos
create_atoms 2 random 50 12345 NULL maxtries 10 exclude 2.0
create_atoms 2 random 50 12345 NULL maxtries 10 overlap 2.0
Description
"""""""""""
@ -131,7 +131,7 @@ outside a geometric boundary.
.. note::
Particles generated by the *random* style (without the *exclude* keyword)
Particles generated by the *random* style (without the *overlap* keyword)
will typically be highly overlapped which will cause many interatomic
potentials to compute large energies and forces. Thus you should either
perform an :doc:`energy minimization <minimize>` or run dynamics with
@ -151,7 +151,7 @@ solvated with a surrounding box of water molecules.
In all these cases, care should be taken to insure that new atoms do
not overlap existing atoms inappropriately, especially if molecules
are being added. For this reason the *exclude* keyword is provided,
are being added. For this reason the *overlap* keyword is provided,
also the :doc:`delete_atoms <delete_atoms>` command can be used to remove
overlapping atoms or molecules.
@ -297,14 +297,14 @@ rule: if your right-hand's thumb points along *R*, then your fingers
wrap around the axis in the direction of rotation.
The *maxtries* keyword limits the number of tries to generate coordinates
for a new particle that satisfies all requirements (region, var, exclude,
for a new particle that satisfies all requirements (region, var, overlap,
...) before the command fails. This keyword is available only with the
*random* style and the default number of tries is 1000 per particle. The
use of this keyword is recommended when using the *exclude* keyword,
use of this keyword is recommended when using the *overlap* keyword,
otherwise it is usually not necessary (but can be useful).
The *exclude* keyword can be used with the *random* style (and only the
*random* style) to prevent the newly created particles overlapping or being
The *overlap* keyword can be used with the *random* style (and only the
*random* style) to prevent the newly created particles from overlapping or being
created too close to others. When the particles being created are **single
atoms** the *radius* parameter passed with the keyword denotes the distance
between particle locations/centers, meaning that all new atoms will be created

View File

@ -14,7 +14,7 @@
/* ----------------------------------------------------------------------
Contributing author (ratio and subset) : Jake Gissinger (U Colorado)
Contributing author (maxtries & exclude) : Eugen Rozic (IRB, Zagreb)
Contributing author (maxtries & overlap) : Eugen Rozic (IRB, Zagreb)
------------------------------------------------------------------------- */
#include "create_atoms.h"
@ -140,7 +140,7 @@ void CreateAtoms::command(int narg, char **arg)
quatone[0] = quatone[1] = quatone[2] = quatone[3] = 0.0;
subsetflag = NONE;
int subsetseed;
excludeflag = 0;
overlapflag = 0;
maxtries = DEFAULT_MAXTRIES;
nbasis = domain->lattice->nbasis;
@ -238,14 +238,14 @@ void CreateAtoms::command(int narg, char **arg)
if (maxtries <= 0)
error->all(FLERR,"Illegal create_atoms command");
iarg += 2;
} else if (strcmp(arg[iarg],"exclude") == 0) {
} else if (strcmp(arg[iarg],"overlap") == 0) {
if (style != RANDOM) error->all(FLERR,"Illegal create_atoms command: "
"'exclude' can only be combined with 'random' style!");
"'overlap' can only be combined with 'random' style!");
if (iarg+2 > narg) error->all(FLERR,"Illegal create_atoms command");
exclude_radius = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (exclude_radius <= 0)
overlap_radius = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (overlap_radius <= 0)
error->all(FLERR,"Illegal create_atoms command");
excludeflag = 1;
overlapflag = 1;
iarg += 2;
} else error->all(FLERR,"Illegal create_atoms command");
}
@ -273,7 +273,7 @@ void CreateAtoms::command(int narg, char **arg)
// molecule random number generator, different for each proc
ranmol = new RanMars(lmp, molseed+me);
// a bit of memory for tries to create molecules (if exclude/maxtries)
// a bit of memory for tries to create molecules (if overlap/maxtries)
memory->create(temp_mol_coords, onemol->natoms, 3, "create_atoms:temp_mol_coords");
}
@ -673,17 +673,17 @@ void CreateAtoms::add_random()
double lamda[3],*coord;
double *boxlo,*boxhi;
// stuff needed for the exclude option
// stuff needed for the overlap option
int nlocal = atom->nlocal;
double **x = atom->x;
double delx, dely, delz, distsq;
double excut, excutsq;
if (excludeflag) {
excut = exclude_radius;
// exclude option takes into account the radius of the molecule
double ocut, ocutsq;
if (overlapflag) {
ocut = overlap_radius;
// overlap option takes into account the radius of the molecule
// but not the radius of a single atom (even if it is defined)
if (mode == MOLECULE) excut += onemol->molradius;
excutsq = excut*excut;
if (mode == MOLECULE) ocut += onemol->molradius;
ocutsq = ocut*ocut;
}
// random number generator, same for all procs
@ -751,14 +751,14 @@ void CreateAtoms::add_random()
if (mode == MOLECULE)
gen_mol_coords(xone, quatone);
if (excludeflag) {
if (overlapflag) {
int reject = 0;
for (int i = 0; i < nlocal; i++){
delx = xone[0] - x[i][0];
dely = xone[1] - x[i][1];
delz = xone[2] - x[i][2];
distsq = delx*delx + dely*dely + delz*delz;
if (distsq < excutsq){
if (distsq < ocutsq){
reject = 1;
break;
}

View File

@ -34,8 +34,8 @@ class CreateAtoms : public Command {
int ntype, style, mode, nregion, nbasis, nrandom, seed;
int remapflag;
int maxtries;
int excludeflag;
double exclude_radius;
int overlapflag;
double overlap_radius;
int subsetflag;
bigint nsubset;
double subsetfrac;
@ -179,4 +179,8 @@ W: Specifying an 'subset' value of '0' is equivalent to no 'subset' keyword
Self-explanatory.
E: Exceeded max number of tries in create_atoms
Self-explanatory.
*/