create_atoms: direct type label support
This commit is contained in:
@ -10,7 +10,7 @@ Syntax
|
||||
|
||||
create_atoms type style args keyword values ...
|
||||
|
||||
* type = atom type (1-Ntypes) of atoms to create (offset for molecule creation)
|
||||
* type = atom type (1-Ntypes or type label) of atoms to create (offset for molecule creation)
|
||||
* style = *box* or *region* or *single* or *mesh* or *random*
|
||||
|
||||
.. parsed-literal::
|
||||
@ -37,7 +37,7 @@ Syntax
|
||||
seed = random # seed (positive integer)
|
||||
*basis* values = M itype
|
||||
M = which basis atom
|
||||
itype = atom type (1-N) to assign to this basis atom
|
||||
itype = atom type (1-Ntypes or type label) to assign to this basis atom
|
||||
*ratio* values = frac seed
|
||||
frac = fraction of lattice sites (0 to 1) to populate randomly
|
||||
seed = random # seed (positive integer)
|
||||
@ -74,7 +74,13 @@ Examples
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
create_atoms 1 box
|
||||
create_atoms 3 region regsphere basis 2 3
|
||||
|
||||
labelmap atom 1 Pt
|
||||
create_atoms Pt box
|
||||
|
||||
labelmap atom 1 C 2 Si
|
||||
create_atoms C region regsphere basis Si C
|
||||
|
||||
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
|
||||
|
||||
@ -89,7 +89,9 @@ void CreateAtoms::command(int narg, char **arg)
|
||||
// parse arguments
|
||||
|
||||
if (narg < 2) utils::missing_cmd_args(FLERR, "create_atoms", error);
|
||||
ntype = utils::inumeric(FLERR, arg[0], false, lmp);
|
||||
char *typestr = utils::expand_type(FLERR, arg[0], Atom::ATOM, lmp);
|
||||
ntype = utils::inumeric(FLERR, typestr?typestr:arg[0], false, lmp);
|
||||
delete[] typestr;
|
||||
|
||||
const char *meshfile;
|
||||
int iarg;
|
||||
@ -163,7 +165,9 @@ void CreateAtoms::command(int narg, char **arg)
|
||||
if (strcmp(arg[iarg], "basis") == 0) {
|
||||
if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "create_atoms basis", error);
|
||||
int ibasis = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
int itype = utils::inumeric(FLERR, arg[iarg + 2], false, lmp);
|
||||
char *typestr = utils::expand_type(FLERR, arg[iarg + 2], Atom::ATOM, lmp);
|
||||
int itype = utils::inumeric(FLERR, typestr?typestr:arg[iarg + 2], false, lmp);
|
||||
delete[] typestr;
|
||||
if (ibasis <= 0 || ibasis > nbasis || itype <= 0 || itype > atom->ntypes)
|
||||
error->all(FLERR, "Out of range basis setting '{} {}' in create_atoms command", ibasis,
|
||||
itype);
|
||||
|
||||
Reference in New Issue
Block a user