more changes and some debugging on a test script
This commit is contained in:
@ -345,10 +345,37 @@ new particles into a dense system using the *overlap* keyword),
|
||||
setting the *maxtry* keyword to a large value may result in this
|
||||
command running for a long time.
|
||||
|
||||
Here is an example for the *random* style using these commands
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
units lj
|
||||
dimension 2
|
||||
region box block 0 50 0 50 -0.5 0.5
|
||||
create_box 1 box
|
||||
create_atoms 1 random 2000 13487 NULL overlap 1.0 maxtry 50
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff 1 1 1.0 1.0 2.5
|
||||
|
||||
to produce a system as shown in the image with 1520 particles (out of
|
||||
2000 requested) that are moderately dense and which have no overlaps
|
||||
sufficient to prevent the LJ pair_style from running properly (because
|
||||
the overlap criterion = 1.0). The create_atoms command ran for 0.3 s
|
||||
on a single CPU core.
|
||||
|
||||
.. image:: img/overlap.png
|
||||
:scale: 50%
|
||||
:align: center
|
||||
|
||||
.. raw:: html
|
||||
|
||||
Click on the image for a larger version.
|
||||
|
||||
The *units* keyword determines the meaning of the distance units used
|
||||
to specify the coordinates of the one particle created by the *single*
|
||||
style. A *box* value selects standard distance units as defined by
|
||||
the :doc:`units <units>` command, e.g. Angstroms for units = real or
|
||||
style, or the overlap distance *Doverlap* by the *overlap* keyword. A
|
||||
*box* value selects standard distance units as defined by the
|
||||
:doc:`units <units>` command, e.g. Angstroms for units = real or
|
||||
metal. A *lattice* value means the distance units are in lattice
|
||||
spacings.
|
||||
|
||||
|
||||
BIN
doc/src/img/overlap.png
Normal file
BIN
doc/src/img/overlap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 572 KiB |
@ -97,7 +97,6 @@ void CreateAtoms::command(int narg, char **arg)
|
||||
region->init();
|
||||
region->prematch();
|
||||
iarg = 3;
|
||||
;
|
||||
} else if (strcmp(arg[1], "single") == 0) {
|
||||
style = SINGLE;
|
||||
if (narg < 5) error->all(FLERR, "Illegal create_atoms command");
|
||||
@ -231,13 +230,6 @@ void CreateAtoms::command(int narg, char **arg)
|
||||
subsetseed = utils::inumeric(FLERR, arg[iarg + 2], false, lmp);
|
||||
if (nsubset <= 0 || subsetseed <= 0) error->all(FLERR, "Illegal create_atoms command");
|
||||
iarg += 3;
|
||||
} else if (strcmp(arg[iarg], "maxtrr") == 0) {
|
||||
if (style != RANDOM)
|
||||
error->all(FLERR, "Create_atoms maxtry can only be used with random style");
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal create_atoms command");
|
||||
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], "overlap") == 0) {
|
||||
if (style != RANDOM)
|
||||
error->all(FLERR, "Create_atoms overlap can only be used with random style");
|
||||
@ -246,6 +238,13 @@ void CreateAtoms::command(int narg, char **arg)
|
||||
if (overlap <= 0) error->all(FLERR, "Illegal create_atoms command");
|
||||
overlapflag = 1;
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "maxtry") == 0) {
|
||||
if (style != RANDOM)
|
||||
error->all(FLERR, "Create_atoms maxtry can only be used with random style");
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal create_atoms command");
|
||||
maxtry = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
if (maxtry <= 0) error->all(FLERR,"Illegal create_atoms command");
|
||||
iarg += 2;
|
||||
} else
|
||||
error->all(FLERR, "Illegal create_atoms command");
|
||||
}
|
||||
@ -324,6 +323,7 @@ void CreateAtoms::command(int narg, char **arg)
|
||||
xone[0] *= domain->lattice->xlattice;
|
||||
xone[1] *= domain->lattice->ylattice;
|
||||
xone[2] *= domain->lattice->zlattice;
|
||||
overlap *= domain->lattice->xlattice;
|
||||
}
|
||||
|
||||
// set bounds for my proc in sublo[3] & subhi[3]
|
||||
@ -755,9 +755,9 @@ void CreateAtoms::add_random()
|
||||
|
||||
if (mode == MOLECULE) generate_molecule(xone);
|
||||
|
||||
// check for overlap of new atom with all others
|
||||
// including prior insertions
|
||||
|
||||
// check for overlap of new atom with all others including prior insertions
|
||||
// minimum_image() required to account for distances across PBC
|
||||
|
||||
if (overlapflag) {
|
||||
double **x = atom->x;
|
||||
int nlocal = atom->nlocal;
|
||||
@ -768,6 +768,7 @@ void CreateAtoms::add_random()
|
||||
delx = xone[0] - x[i][0];
|
||||
dely = xone[1] - x[i][1];
|
||||
delz = xone[2] - x[i][2];
|
||||
domain->minimum_image(delx,dely,delz);
|
||||
distsq = delx*delx + dely*dely + delz*delz;
|
||||
if (distsq < odistsq) {
|
||||
reject = 1;
|
||||
|
||||
Reference in New Issue
Block a user