more docs

also, relax I <= J requirement for pair_coeff, as 'required' by type labels
This commit is contained in:
jrgissing
2021-01-30 21:22:49 -05:00
parent e3a6afe1ab
commit 2ee6e8f582
9 changed files with 126 additions and 45 deletions

View File

@ -10,7 +10,7 @@ Syntax
angle_coeff N args
* N = angle type (see asterisk form below)
* N = numeric angle type (see asterisk form below), or type label
* args = coefficients for one or more angle types
Examples
@ -31,10 +31,11 @@ Angle coefficients can also be set in the data file read by the
:doc:`read_data <read_data>` command or in a restart file.
N can be specified in one of two ways. An explicit numeric value can
be used, as in the first example above. Or a wild-card asterisk can be
used to set the coefficients for multiple angle types. This takes the
form "\*" or "\*n" or "n\*" or "m\*n". If N = the number of angle types,
then an asterisk with no numeric values means all types from 1 to N. A
be used, as in the first example above. Or N can be a :doc:`type label <labelmap>`.
For numeric values only, a wild-card asterisk can be used to set the
coefficients for multiple angle types. This takes the form "\*" or
"\*n" or "n\*" or "m\*n". If N = the number of angle types, then an
asterisk with no numeric values means all types from 1 to N. A
leading asterisk means all types from 1 to n (inclusive). A trailing
asterisk means all types from n to N (inclusive). A middle asterisk
means all types from m to n (inclusive).

View File

@ -10,7 +10,7 @@ Syntax
bond_coeff N args
* N = bond type (see asterisk form below)
* N = numeric bond type (see asterisk form below), or type label
* args = coefficients for one or more bond types
Examples
@ -31,11 +31,12 @@ The number and meaning of the coefficients depends on the bond style.
Bond coefficients can also be set in the data file read by the
:doc:`read_data <read_data>` command or in a restart file.
N can be specified in one of two ways. An explicit numeric value can
be used, as in the first example above. Or a wild-card asterisk can be
used to set the coefficients for multiple bond types. This takes the
form "\*" or "\*n" or "n\*" or "m\*n". If N = the number of bond types,
then an asterisk with no numeric values means all types from 1 to N. A
N can be specified in one of several ways. An explicit numeric value can
be used, as in the first example above. Or N can be a :doc:`type label <labelmap>`.
For numeric values only, a wild-card asterisk can be used to set the
coefficients for multiple bond types. This takes the form "\*" or
"\*n" or "n\*" or "m\*n". If N = the number of bond types, then an
asterisk with no numeric values means all types from 1 to N. A
leading asterisk means all types from 1 to n (inclusive). A trailing
asterisk means all types from n to N (inclusive). A middle asterisk
means all types from m to n (inclusive).

View File

@ -10,7 +10,7 @@ Syntax
dihedral_coeff N args
* N = dihedral type (see asterisk form below)
* N = numeric dihedral type (see asterisk form below), or type label
* args = coefficients for one or more dihedral types
Examples
@ -31,10 +31,11 @@ Dihedral coefficients can also be set in the data file read by the
:doc:`read_data <read_data>` command or in a restart file.
N can be specified in one of two ways. An explicit numeric value can
be used, as in the first example above. Or a wild-card asterisk can be
used to set the coefficients for multiple dihedral types. This takes the
form "\*" or "\*n" or "n\*" or "m\*n". If N = the number of dihedral types,
then an asterisk with no numeric values means all types from 1 to N. A
be used, as in the first example above. Or N can be a :doc:`type label <labelmap>`.
For numeric values only, a wild-card asterisk can be used to set the
coefficients for multiple dihedral types. This takes the form "\*" or
"\*n" or "n\*" or "m\*n". If N = the number of dihedral types, then
an asterisk with no numeric values means all types from 1 to N. A
leading asterisk means all types from 1 to n (inclusive). A trailing
asterisk means all types from n to N (inclusive). A middle asterisk
means all types from m to n (inclusive).

View File

@ -10,7 +10,7 @@ Syntax
improper_coeff N args
* N = improper type (see asterisk form below)
* N = numeric improper type (see asterisk form below), or type label
* args = coefficients for one or more improper types
Examples
@ -32,13 +32,14 @@ file read by the :doc:`read_data <read_data>` command or in a restart
file.
N can be specified in one of two ways. An explicit numeric value can
be used, as in the first example above. Or a wild-card asterisk can be
used to set the coefficients for multiple improper types. This takes
the form "\*" or "\*n" or "n\*" or "m\*n". If N = the number of improper
types, then an asterisk with no numeric values means all types from 1
to N. A leading asterisk means all types from 1 to n (inclusive). A
trailing asterisk means all types from n to N (inclusive). A middle
asterisk means all types from m to n (inclusive).
be used, as in the first example above. Or N can be a :doc:`type label <labelmap>`.
For numeric values only, a wild-card asterisk can be used to set the
coefficients for multiple improper types. This takes the form "\*" or
"\*n" or "n\*" or "m\*n". If N = the number of improper types, then
an asterisk with no numeric values means all types from 1 to N. A
leading asterisk means all types from 1 to n (inclusive). A trailing
asterisk means all types from n to N (inclusive). A middle asterisk
means all types from m to n (inclusive).
Note that using an improper_coeff command can override a previous
setting for the same improper type. For example, these commands set

View File

@ -10,7 +10,7 @@ Syntax
pair_coeff I J args
* I,J = atom types (see asterisk form below)
* I,J = numeric atom types (see asterisk form below), or type labels
* args = coefficients for one or more pairs of atom types
Examples
@ -34,20 +34,22 @@ atom types. The number and meaning of the coefficients depends on the
pair style. Pair coefficients can also be set in the data file read
by the :doc:`read_data <read_data>` command or in a restart file.
I and J can be specified in one of two ways. Explicit numeric values
can be used for each, as in the first example above. I <= J is
required. LAMMPS sets the coefficients for the symmetric J,I
interaction to the same values.
I and J can be specified in one of several ways. Explicit numeric
values can be used for each, as in the first example above. Or, one
or both of the types in the I,J pair may be a :doc:`type label <labelmap>`.
LAMMPS sets the coefficients for the symmetric J,I interaction to the
same values.
A wildcard asterisk can be used in place of or in conjunction with the
I,J arguments to set the coefficients for multiple pairs of atom
types. This takes the form "\*" or "\*n" or "n\*" or "m\*n". If N = the
number of atom types, then an asterisk with no numeric values means all
types from 1 to N. A leading asterisk means all types from 1 to n
(inclusive). A trailing asterisk means all types from n to N
(inclusive). A middle asterisk means all types from m to n
(inclusive). Note that only type pairs with I <= J are considered; if
asterisks imply type pairs where J < I, they are ignored.
For numeric values only, a wildcard asterisk can be used in place of
or in conjunction with the I,J arguments to set the coefficients for
multiple pairs of atom types. This takes the form "\*" or "\*n" or
"n\*" or "m\*n". If N = the number of atom types, then an asterisk
with no numeric values means all types from 1 to N. A leading
asterisk means all types from 1 to n (inclusive). A trailing asterisk
means all types from n to N (inclusive). A middle asterisk means all
types from m to n (inclusive). Note that only type pairs with I <= J
are considered; if asterisks imply type pairs where J < I, they are
ignored.
Note that a pair_coeff command can override a previous setting for the
same I,J pair. For example, these commands set the coeffs for all I,J

View File

@ -540,7 +540,13 @@ input script.
.. parsed-literal::
ID = angle type (1-N)
label = alphanumeric type label (see the :doc:`labelmap <labelmap>` command)
label = alphanumeric type label
See the *Atom Type Labels* section for more details about how angle
types are interpreted when reading one or more data files that contain
angle type label sections. See the :doc:`labelmap <labelmap>` command
for a discussion about how to format angle type labels and use type
label maps.
----------
@ -612,8 +618,28 @@ integers (1, not 1.0).
.. parsed-literal::
ID = atom type (1-N)
label = alphanumeric type label (see the :doc:`labelmap <labelmap>` command)
ID = numeric atom type (1-N)
label = alphanumeric type label
Type labels can be used to make data files more general, by defining
atom, bond, etc. types in terms of user-provided strings instead of
numbers. If a type label section exists for a given interaction, the
numeric types listed in the *Atoms*, *Bonds*, etc. section are first
converted into their corresponding type label before being read into
LAMMPS; type labels cannot be directly substituted for numeric types
used in data files. Data files can also be used to populate the
default label map; if the type label does not already exist, the type
label is created as a new type and assigned to the default label map.
The corresponding interaction coefficients listed in the data file are
associated to this type. When reading multiple data files, or if the
default label map already exists, there must be enough space in the
per-type data arrays to create new types; see the *extra/atom/types*
keyword for how to reserve extra space for new types. Note that, in
this case, the numeric-to-label mapping within a data file does not
necessary correspond to that of the simulation; the :doc:`write_data <write_data>`
command can be used to print out the default label map at a given
point in a simulation. See the :doc:`labelmap <labelmap>` command for
more discussion on how to use type label maps.
----------
@ -950,7 +976,13 @@ script.
.. parsed-literal::
ID = bond type (1-N)
label = alphanumeric type label (see the :doc:`labelmap <labelmap>` command)
label = alphanumeric type label
See the *Atom Type Labels* section for more details about how bond
types are interpreted when reading one or more data files that contain
bond type label sections. See the :doc:`labelmap <labelmap>` command
for a discussion about how to format bond type labels and use type
label maps.
----------
@ -1044,7 +1076,13 @@ Coefficients can also be set via the
.. parsed-literal::
ID = dihedral type (1-N)
label = alphanumeric type label (see the :doc:`labelmap <labelmap>` command)
label = alphanumeric type label
See the *Atom Type Labels* section for more details about how dihedral
types are interpreted when reading one or more data files that contain
dihedral type label sections. See the :doc:`labelmap <labelmap>`
command for a discussion about how to format dihedral type labels and
use type label maps.
----------
@ -1157,7 +1195,13 @@ Coefficients can also be set via the
.. parsed-literal::
ID = improper type (1-N)
label = alphanumeric type label (see the :doc:`labelmap <labelmap>` command)
label = alphanumeric type label
See the *Atom Type Labels* section for more details about how improper
types are interpreted when reading one or more data files that contain
improper type label sections. See the :doc:`labelmap <labelmap>`
command for a discussion about how to format improper type labels and
use type label maps.
----------

View File

@ -66,6 +66,7 @@ Syntax
angmom(group,dim,region), torque(group,dim,region),
inertia(group,dimdim,region), omega(group,dim,region)
special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x)
labelmap functions = label(typelabel), blabel(typelabel), alabel(typelabel), dlabel(typelabel), ilabel(typelabel)
feature functions = is_active(category,feature,exact), is_defined(category,id,exact)
atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i]
atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q
@ -481,6 +482,8 @@ references, and references to other variables.
+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Special functions | sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x) |
+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Labelmap functions | label(typelabel), blabel(typelabel), alabel(typelabel), dlabel(typelabel), ilabel(typelabel) |
+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Atom values | id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i] |
+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Atom vectors | id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q |
@ -901,6 +904,18 @@ operates.
----------
Labelmap Functions
-----------------
Labelmap functions convert type labels into numeric types, using label
maps created by the :doc:`labelmap <labelmap>` or :doc:`read_data <read_data>`
commands. Their argument must be a valid type label, and they return
the corresponding integer numeric type. The argument for the *label()*\ ,
*blabel()*\ , *alabel()*\ , *dlabel()*\ , and *ilabel()*\ , must be
an atom, bond, angle, dihedral, or improper type label, respectively.
----------
Feature Functions
-----------------

View File

@ -1753,6 +1753,22 @@ void Input::pair_coeff()
error->all(FLERR,"Pair_coeff command before pair_style is defined");
readtype(arg[0],atom->ATOM);
readtype(arg[1],atom->ATOM);
// if arg[1] < arg[0], and neither contain a wildcard, reorder
int itype,jtype;
int *ptr;
char *str;
if (strchr(arg[0],'*') == nullptr && strchr(arg[1],'*') == nullptr) {
itype = utils::numeric(FLERR,arg[0],false,lmp);
jtype = utils::numeric(FLERR,arg[1],false,lmp);
if (jtype < itype) {
str = arg[0];
arg[0] = arg[1];
arg[1] = str;
}
}
force->pair->coeff(narg,arg);
}

View File

@ -106,7 +106,7 @@ void LabelMap::modify_lmap(int narg, char **arg)
itype = utils::inumeric(FLERR,arg[iarg++],false,lmp);
charlabel = arg[iarg++];
if (itype > ntypes) error->all(FLERR,"Topology type exceeds system topology type");
if (!isalpha(charlabel[0])) error->all(FLERR,"Type labels must begin with a letter");
if (isdigit(charlabel[0])) error->all(FLERR,"Type labels must begin with a letter");
(*labels)[itype-1] = charlabel;
}
}