Merge pull request #4145 from jrgissing/improve_type_label_support
Improve type label support
This commit is contained in:
@ -13,8 +13,8 @@ Syntax
|
||||
* ID, group-ID are documented in :doc:`compute <compute>` command
|
||||
* rdf = style name of this compute command
|
||||
* Nbin = number of RDF bins
|
||||
* itypeN = central atom type for Nth RDF histogram (see asterisk form below)
|
||||
* jtypeN = distribution atom type for Nth RDF histogram (see asterisk form below)
|
||||
* itypeN = central atom type for Nth RDF histogram (integer, type label, or asterisk form)
|
||||
* jtypeN = distribution atom type for Nth RDF histogram (integer, type label, or asterisk form)
|
||||
* zero or more keyword/value pairs may be appended
|
||||
* keyword = *cutoff*
|
||||
|
||||
@ -96,14 +96,16 @@ is computed for :math:`g(r)` between all atom types. If one or more pairs are
|
||||
listed, then a separate histogram is generated for each
|
||||
*itype*,\ *jtype* pair.
|
||||
|
||||
The *itypeN* and *jtypeN* settings can be specified in one of two
|
||||
ways. An explicit numeric value can be used, as in the fourth example
|
||||
above. Or a wild-card asterisk can be used to specify a range of atom
|
||||
types. This takes the form "\*" or "\*n" or "m\*" or "m\*n". If
|
||||
:math:`N` is the number of atom types, then an asterisk with no numeric values
|
||||
means all types from 1 to :math:`N`. A leading asterisk means all types from 1
|
||||
to n (inclusive). A trailing asterisk means all types from m to :math:`N`
|
||||
(inclusive). A middle asterisk means all types from m to n (inclusive).
|
||||
The *itypeN* and *jtypeN* settings can be specified in one of three
|
||||
ways. One or both of the types in the I,J pair can be a
|
||||
:doc:`type label <Howto_type_labels>`. Or an explicit numeric value can be
|
||||
used, as in the fourth example above. Or a wild-card asterisk can be used
|
||||
to specify a range of atom types. This takes the form "\*" or "\*n" or
|
||||
"m\*" or "m\*n". If :math:`N` is the number of atom types, then an asterisk
|
||||
with no numeric values means all types from 1 to :math:`N`. A leading
|
||||
asterisk means all types from 1 to n (inclusive). A trailing asterisk
|
||||
means all types from m to :math:`N` (inclusive). A middle asterisk means
|
||||
all types from m to n (inclusive).
|
||||
|
||||
If both *itypeN* and *jtypeN* are single values, as in the fourth example
|
||||
above, this means that a :math:`g(r)` is computed where atoms of type *itypeN*
|
||||
|
||||
@ -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,6 +74,13 @@ Examples
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
create_atoms 1 box
|
||||
|
||||
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
|
||||
create_atoms 3 region regsphere basis 2 3 ratio 0.5 74637
|
||||
create_atoms 3 single 0 0 5
|
||||
|
||||
@ -43,6 +43,9 @@ Examples
|
||||
delete_bonds all bond 0*3 special
|
||||
delete_bonds all stats
|
||||
|
||||
labelmap atom 4 hc
|
||||
delete_bonds all atom hc special
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
@ -59,19 +62,20 @@ For all styles, by default, an interaction is only turned off (or on)
|
||||
if all the atoms involved are in the specified group. See the *any*
|
||||
keyword to change the behavior.
|
||||
|
||||
Several of the styles (\ *atom*, *bond*, *angle*, *dihedral*,
|
||||
*improper*\ ) take a *type* as an argument. The specified *type* should
|
||||
be an integer from 0 to :math:`N`, where :math:`N` is the number of relevant
|
||||
Several of the styles (\ *atom*, *bond*, *angle*, *dihedral*, *improper*\ )
|
||||
take a *type* as an argument. The specified *type* can be a
|
||||
:doc:`type label <Howto_type_labels>`. Otherwise, the type should be an
|
||||
integer from 0 to :math:`N`, where :math:`N` is the number of relevant
|
||||
types (atom types, bond types, etc.). A value of 0 is only relevant for
|
||||
style *bond*\ ; see details below. In all cases, a wildcard asterisk
|
||||
style *bond*\ ; see details below. For numeric types, a wildcard asterisk
|
||||
can be used in place of or in conjunction with the *type* argument to
|
||||
specify a range of types. This takes the form "\*" or "\*n" or "m\*" or
|
||||
"m\*n". If :math:`N` is the number of types, then an asterisk with no numeric
|
||||
values means all types from 0 to :math:`N`. A leading asterisk means all
|
||||
types from 0 to n (inclusive). A trailing asterisk means all types
|
||||
from m to N (inclusive). A middle asterisk means all types from m to
|
||||
n (inclusive). Note that it is fine to include a type of 0 for
|
||||
non-bond styles; it will simply be ignored.
|
||||
"m\*n". If :math:`N` is the number of types, then an asterisk with no
|
||||
numeric values means all types from 0 to :math:`N`. A leading asterisk
|
||||
means all types from 0 to n (inclusive). A trailing asterisk means all
|
||||
types from m to N (inclusive). A middle asterisk means all types from m to
|
||||
n (inclusive). Note that it is fine to include a type of 0 for non-bond
|
||||
styles; it will simply be ignored.
|
||||
|
||||
For style *multi* all bond, angle, dihedral, and improper interactions
|
||||
of any type, involving atoms in the group, are turned off.
|
||||
|
||||
@ -114,6 +114,7 @@ Syntax
|
||||
proc = ID of processor that owns atom
|
||||
procp1 = ID+1 of processor that owns atom
|
||||
type = atom type
|
||||
typelabel = atom :doc:`type label <Howto_type_labels>`
|
||||
element = name of atom element, as defined by :doc:`dump_modify <dump_modify>` command
|
||||
mass = atom mass
|
||||
x,y,z = unscaled atom coordinates
|
||||
@ -470,8 +471,9 @@ followed by one line per atom with the atom type and the :math:`x`-,
|
||||
:math:`y`-, and :math:`z`-coordinate of that atom. You can use the
|
||||
:doc:`dump_modify element <dump_modify>` option to change the output
|
||||
from using the (numerical) atom type to an element name (or some other
|
||||
label). This will help many visualization programs to guess bonds and
|
||||
colors.
|
||||
label). This option will help many visualization programs to guess bonds
|
||||
and colors. You can use the :doc:`dump_modify types labels <dump_modify>`
|
||||
option to replace numeric atom types with :doc:`type labels <Howto_type_labels>`.
|
||||
|
||||
.. versionadded:: 22Dec2022
|
||||
|
||||
@ -774,21 +776,21 @@ command creates a per-atom array with six columns:
|
||||
|
||||
Per-atom attributes used as arguments to the *custom* and *cfg* styles:
|
||||
|
||||
The *id*, *mol*, *proc*, *procp1*, *type*, *element*, *mass*, *vx*,
|
||||
*vy*, *vz*, *fx*, *fy*, *fz*, *q* attributes are self-explanatory.
|
||||
The *id*, *mol*, *proc*, *procp1*, *type*, *typelabel*, *element*, *mass*,
|
||||
*vx*, *vy*, *vz*, *fx*, *fy*, *fz*, *q* attributes are self-explanatory.
|
||||
|
||||
*Id* is the atom ID. *Mol* is the molecule ID, included in the data
|
||||
file for molecular systems. *Proc* is the ID of the processor (0 to
|
||||
*Id* is the atom ID. *Mol* is the molecule ID, included in the data file
|
||||
for molecular systems. *Proc* is the ID of the processor (0 to
|
||||
:math:`N_\text{procs}-1`) that currently owns the atom. *Procp1* is the
|
||||
proc ID+1, which can be convenient in place of a *type* attribute (1 to
|
||||
:math:`N_\text{types}`) for coloring atoms in a visualization program.
|
||||
*Type* is the atom type (1 to :math:`N_\text{types}`). *Element* is
|
||||
typically the chemical name of an element, which you must assign to each
|
||||
type via the :doc:`dump_modify element <dump_modify>` command. More
|
||||
generally, it can be any string you wish to associated with an atom
|
||||
type. *Mass* is the atom mass. The quantities *vx*, *vy*, *vz*, *fx*,
|
||||
*fy*, *fz*, and *q* are components of atom velocity and force and atomic
|
||||
charge.
|
||||
*Type* is the atom type (1 to :math:`N_\text{types}`). *Typelabel* is the
|
||||
atom :doc:`type label <Howto_type_labels>`. *Element* is typically the
|
||||
chemical name of an element, which you must assign to each type via the
|
||||
:doc:`dump_modify element <dump_modify>` command. More generally, it can
|
||||
be any string you wish to associated with an atom type. *Mass* is the atom
|
||||
mass. The quantities *vx*, *vy*, *vz*, *fx*, *fy*, *fz*, and *q* are
|
||||
components of atom velocity and force and atomic charge.
|
||||
|
||||
There are several options for outputting atom coordinates. The *x*,
|
||||
*y*, and *z* attributes write atom coordinates "unscaled", in the
|
||||
|
||||
@ -17,7 +17,7 @@ Syntax
|
||||
* one or more keyword/value pairs may be appended
|
||||
|
||||
* these keywords apply to various dump styles
|
||||
* keyword = *append* or *at* or *balance* or *buffer* or *colname* or *delay* or *element* or *every* or *every/time* or *fileper* or *first* or *flush* or *format* or *header* or *image* or *label* or *maxfiles* or *nfile* or *pad* or *pbc* or *precision* or *region* or *refresh* or *scale* or *sfactor* or *skip* or *sort* or *tfactor* or *thermo* or *thresh* or *time* or *triclinic/general* or *units* or *unwrap*
|
||||
* keyword = *append* or *at* or *balance* or *buffer* or *colname* or *delay* or *element* or *every* or *every/time* or *fileper* or *first* or *flush* or *format* or *header* or *image* or *label* or *maxfiles* or *nfile* or *pad* or *pbc* or *precision* or *region* or *refresh* or *scale* or *sfactor* or *skip* or *sort* or *tfactor* or *thermo* or *thresh* or *time* or *triclinic/general* or *types* or *units* or *unwrap*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -81,6 +81,7 @@ Syntax
|
||||
these 3 args can be replaced by the word "none" to turn off thresholding
|
||||
*time* arg = *yes* or *no*
|
||||
*triclinic/general* arg = *yes* or *no*
|
||||
*types* value = *numeric* or *labels*
|
||||
*units* arg = *yes* or *no*
|
||||
*unwrap* arg = *yes* or *no*
|
||||
|
||||
@ -849,6 +850,13 @@ The default setting is *no*\ .
|
||||
|
||||
----------
|
||||
|
||||
The *types* keyword applies only to the dump xyz style. If this keyword is
|
||||
used with a value of *numeric*, then numeric atom types are printed in the
|
||||
xyz file (default). If the value *labels* is specified, then
|
||||
:doc:`type labels <Howto_type_labels>` are printed for atom types.
|
||||
|
||||
----------
|
||||
|
||||
The *triclinic/general* keyword only applies to the dump *atom* and
|
||||
*custom* styles. It can only be used with a value of *yes* if the
|
||||
simulation box was created as a general triclinic box. See the
|
||||
@ -960,11 +968,11 @@ The option defaults are
|
||||
* sort = id for dump styles *dcd*, *xtc*, and *xyz*
|
||||
* thresh = none
|
||||
* time = no
|
||||
* triclinic/general no
|
||||
* triclinic/general = no
|
||||
* types = numeric
|
||||
* units = no
|
||||
* unwrap = no
|
||||
|
||||
* compression_level = 9 (gz variants)
|
||||
* compression_level = 0 (zstd variants)
|
||||
* checksum = yes (zstd variants)
|
||||
|
||||
|
||||
@ -21,17 +21,17 @@ Syntax
|
||||
*pair* args = pstyle pparam I J v_name
|
||||
pstyle = pair style name (e.g., lj/cut)
|
||||
pparam = parameter to adapt over time
|
||||
I,J = type pair(s) to set parameter for
|
||||
I,J = type pair(s) to set parameter for (integer or type label)
|
||||
v_name = variable with name that calculates value of pparam
|
||||
*bond* args = bstyle bparam I v_name
|
||||
bstyle = bond style name (e.g., harmonic)
|
||||
bparam = parameter to adapt over time
|
||||
I = type bond to set parameter for
|
||||
I = type bond to set parameter for (integer or type label)
|
||||
v_name = variable with name that calculates value of bparam
|
||||
*angle* args = astyle aparam I v_name
|
||||
astyle = angle style name (e.g., harmonic)
|
||||
aparam = parameter to adapt over time
|
||||
I = type angle to set parameter for
|
||||
I = type angle to set parameter for (integer or type label)
|
||||
v_name = variable with name that calculates value of aparam
|
||||
*kspace* arg = v_name
|
||||
v_name = variable with name that calculates scale factor on :math:`k`-space terms
|
||||
@ -67,6 +67,9 @@ Examples
|
||||
variable ramp_up equal "ramp(0.01,0.5)"
|
||||
fix stretch all adapt 1 bond harmonic r0 1 v_ramp_up
|
||||
|
||||
labelmap atom 1 c1
|
||||
fix 1 all adapt 1 pair soft a c1 c1 v_prefactor
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
@ -254,10 +257,12 @@ should be specified to indicate which type pairs to apply it to. If a global
|
||||
parameter is specified, the :math:`I` and :math:`J` settings still need to be
|
||||
specified, but are ignored.
|
||||
|
||||
Similar to the :doc:`pair_coeff command <pair_coeff>`, :math:`I` and :math:`J`
|
||||
can be specified in one of two ways. Explicit numeric values can be used for
|
||||
each, as in the first example above. :math:`I \le J` is required. LAMMPS sets
|
||||
the coefficients for the symmetric :math:`J,I` interaction to the same values.
|
||||
Similar to the :doc:`pair_coeff command <pair_coeff>`, :math:`I` and
|
||||
:math:`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 can be a :doc:`type label <Howto_type_labels>`.
|
||||
LAMMPS sets the coefficients for the symmetric :math:`J,I` interaction to
|
||||
the same values.
|
||||
|
||||
A wild-card asterisk can be used in place of or in conjunction with
|
||||
the :math:`I,J` arguments to set the coefficients for multiple pairs of atom
|
||||
@ -266,8 +271,9 @@ is the number of atom types, then an asterisk with no numeric values
|
||||
means all types from 1 to :math:`N`. A leading asterisk means all types from
|
||||
1 to n (inclusive). A trailing asterisk means all types from m to :math:`N`
|
||||
(inclusive). A middle asterisk means all types from m to n
|
||||
(inclusive). Note that only type pairs with :math:`I \le J` are considered; if
|
||||
asterisks imply type pairs where :math:`J < I`, they are ignored.
|
||||
(inclusive). For the asterisk syntax, note that only type pairs with
|
||||
:math:`I \le J` are considered; if asterisks imply type pairs where
|
||||
:math:`J < I`, they are ignored.
|
||||
|
||||
IMPORTANT NOTE: If :doc:`pair_style hybrid or hybrid/overlay
|
||||
<pair_hybrid>` is being used, then the *pstyle* will be a sub-style
|
||||
|
||||
@ -21,13 +21,13 @@ Syntax
|
||||
*pair* args = pstyle pparam I J v_name
|
||||
pstyle = pair style name (e.g., lj/cut)
|
||||
pparam = parameter to adapt over time
|
||||
I,J = type pair(s) to set parameter for
|
||||
I,J = type pair(s) to set parameter for (integer or type label)
|
||||
v_name = variable with name that calculates value of pparam
|
||||
*kspace* arg = v_name
|
||||
v_name = variable with name that calculates scale factor on K-space terms
|
||||
*atom* args = aparam v_name
|
||||
aparam = parameter to adapt over time
|
||||
I = type(s) to set parameter for
|
||||
I = type(s) to set parameter for (integer or type label)
|
||||
v_name = variable with name that calculates value of aparam
|
||||
|
||||
* zero or more keyword/value pairs may be appended
|
||||
@ -56,6 +56,9 @@ Examples
|
||||
fix 1 all adapt/fep 1 pair lj/cut epsilon * * v_scale1 coul/cut scale 3 3 v_scale2 scale yes reset yes
|
||||
fix 1 all adapt/fep 10 atom diameter 1 v_size
|
||||
|
||||
labelmap atom 1 c1
|
||||
fix 1 all adapt/fep 1 pair soft a c1 c1 v_prefactor
|
||||
|
||||
|
||||
Example input scripts available: examples/PACKAGES/fep
|
||||
|
||||
@ -218,10 +221,12 @@ be specified to indicate which type pairs to apply it to. If a global
|
||||
parameter is specified, the *I* and *J* settings still need to be
|
||||
specified, but are ignored.
|
||||
|
||||
Similar to the :doc:`pair_coeff command <pair_coeff>`, 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. :math:`I \le J` is required. LAMMPS sets
|
||||
the coefficients for the symmetric J,I interaction to the same values.
|
||||
Similar to the :doc:`pair_coeff command <pair_coeff>`, :math:`I` and
|
||||
:math:`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 can be a :doc:`type label <Howto_type_labels>`.
|
||||
LAMMPS sets the coefficients for the symmetric :math:`J,I` interaction to
|
||||
the same values.
|
||||
|
||||
A wild-card asterisk can be used in place of or in conjunction with
|
||||
the :math:`I,J` arguments to set the coefficients for multiple pairs of atom
|
||||
@ -230,8 +235,9 @@ the number of atom types, then an asterisk with no numeric values means
|
||||
all types from 1 to :math:`N`. A leading asterisk means all types from 1 to n
|
||||
(inclusive). A trailing asterisk means all types from m to :math:`N`
|
||||
(inclusive). A middle asterisk means all types from m to n
|
||||
(inclusive). Note that only type pairs with :math:`I \le J` are considered; if
|
||||
asterisks imply type pairs where :math:`J < I`, they are ignored.
|
||||
(inclusive). For the asterisk syntax, note that only type pairs with
|
||||
:math:`I \le J` are considered; if asterisks imply type pairs where
|
||||
:math:`J < I`, they are ignored.
|
||||
|
||||
IMPROTANT NOTE: If :doc:`pair_style hybrid or hybrid/overlay <pair_hybrid>` is
|
||||
being used, then the *pstyle* will be a sub-style name. You must specify
|
||||
|
||||
@ -21,7 +21,7 @@ Syntax
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*types* values = two or more atom types
|
||||
*types* values = two or more atom types (1-Ntypes or type label)
|
||||
*mu* values = chemical potential of swap types (energy units)
|
||||
*ke* value = *no* or *yes*
|
||||
*no* = no conservation of kinetic energy after atom swaps
|
||||
|
||||
@ -13,7 +13,7 @@ Syntax
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* bond/break = style name of this fix command
|
||||
* Nevery = attempt bond breaking every this many steps
|
||||
* bondtype = type of bonds to break
|
||||
* bondtype = type of bonds to break (integer or type label)
|
||||
* Rmax = bond longer than Rmax can break (distance units)
|
||||
* zero or more keyword/value pairs may be appended
|
||||
* keyword = *prob*
|
||||
|
||||
@ -17,9 +17,9 @@ Syntax
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* bond/create = style name of this fix command
|
||||
* Nevery = attempt bond creation every this many steps
|
||||
* itype,jtype = atoms of itype can bond to atoms of jtype
|
||||
* itype,jtype = atoms of itype can bond to atoms of jtype (1-Ntypes or type label)
|
||||
* Rmin = 2 atoms separated by less than Rmin can bond (distance units)
|
||||
* bondtype = type of created bonds
|
||||
* bondtype = type of created bonds (integer or type label)
|
||||
* zero or more keyword/value pairs may be appended to args
|
||||
* keyword = *iparam* or *jparam* or *prob* or *atype* or *dtype* or *itype* or *aconstrain*
|
||||
|
||||
@ -27,19 +27,19 @@ Syntax
|
||||
|
||||
*iparam* values = maxbond, newtype
|
||||
maxbond = max # of bonds of bondtype the itype atom can have
|
||||
newtype = change the itype atom to this type when maxbonds exist
|
||||
newtype = change the itype atom to this type when maxbonds exist (1-Ntypes or type label)
|
||||
*jparam* values = maxbond, newtype
|
||||
maxbond = max # of bonds of bondtype the jtype atom can have
|
||||
newtype = change the jtype atom to this type when maxbonds exist
|
||||
newtype = change the jtype atom to this type when maxbonds exist (1-Ntypes or type label)
|
||||
*prob* values = fraction seed
|
||||
fraction = create a bond with this probability if otherwise eligible
|
||||
seed = random number seed (positive integer)
|
||||
*atype* value = angletype
|
||||
angletype = type of created angles
|
||||
angletype = type of created angles (integer or type label)
|
||||
*dtype* value = dihedraltype
|
||||
dihedraltype = type of created dihedrals
|
||||
dihedraltype = type of created dihedrals (integer or type label)
|
||||
*itype* value = impropertype
|
||||
impropertype = type of created impropers
|
||||
impropertype = type of created impropers (integer or type label)
|
||||
*aconstrain* value = amin amax
|
||||
amin = minimal angle at which new bonds can be created
|
||||
amax = maximal angle at which new bonds can be created
|
||||
@ -54,6 +54,10 @@ Examples
|
||||
fix 5 all bond/create 1 3 3 0.8 1 prob 0.5 85784 iparam 2 3 atype 1 dtype 2
|
||||
fix 5 all bond/create/angle 10 1 2 1.122 1 aconstrain 120 180 prob 1 4928459 iparam 2 1 jparam 2 2
|
||||
|
||||
labelmap atom 1 c1 2 n2
|
||||
labelmap bond 1 c1-n2
|
||||
fix 5 all bond/create 10 c1 n2 0.8 c1-n2
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
|
||||
@ -13,8 +13,8 @@ Syntax
|
||||
|
||||
* ID, group-ID are documented in fix command
|
||||
* charge/regulation = style name of this fix command
|
||||
* cation_type = atom type of free cations
|
||||
* anion_type = atom type of free anions
|
||||
* cation_type = atom type of free cations (integer or type label)
|
||||
* anion_type = atom type of free anions (integer or type label)
|
||||
|
||||
* zero or more keyword/value pairs may be appended
|
||||
|
||||
@ -27,8 +27,8 @@ Syntax
|
||||
*pIp* value = activity (effective concentration) of free cations (in the -log10 representation)
|
||||
*pIm* value = activity (effective concentration) of free anions (in the -log10 representation)
|
||||
*pKs* value = solvent self-dissociation constant (in the -log10 representation)
|
||||
*acid_type* = atom type of acid groups
|
||||
*base_type* = atom type of base groups
|
||||
*acid_type* = atom type of acid groups (integer or type label)
|
||||
*base_type* = atom type of base groups (integer or type label)
|
||||
*lunit_nm* value = unit length used by LAMMPS (# in the units of nanometers)
|
||||
*temp* value = temperature
|
||||
*tempfixid* value = fix ID of temperature thermostat
|
||||
@ -51,6 +51,9 @@ Examples
|
||||
fix chareg all charge/regulation 1 2 acid_type 3 base_type 4 pKa 5.0 pKb 6.0 pH 7.0 pIp 3.0 pIm 3.0 nevery 200 nmc 200 seed 123 tempfixid fT
|
||||
fix chareg all charge/regulation 1 2 pIp 3 pIm 3 onlysalt yes 2 -1 seed 123 tag yes temp 1.0
|
||||
|
||||
labelmap atom 1 H+ 2 OH-
|
||||
fix chareg all charge/regulation H+ OH- pIp 3 pIm 3 onlysalt yes 2 -1 seed 123 tag yes temp 1.0
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ Syntax
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* deposit = style name of this fix command
|
||||
* N = # of atoms or molecules to insert
|
||||
* type = atom type to assign to inserted atoms (offset for molecule insertion)
|
||||
* type = atom type (1-Ntypes or type label) to assign to inserted atoms (offset for molecule insertion)
|
||||
* M = insert a single atom or molecule every M steps
|
||||
* seed = random # seed (positive integer)
|
||||
* one or more keyword/value pairs may be appended to args
|
||||
@ -76,6 +76,9 @@ Examples
|
||||
fix 4 sputter deposit 1000 2 500 12235 region sphere vz -1.0 -1.0 target 5.0 5.0 0.0 units lattice
|
||||
fix 5 insert deposit 200 2 100 777 region disk gaussian 5.0 5.0 9.0 1.0 units box
|
||||
|
||||
labelmap atom 1 Au
|
||||
fix 4 sputter deposit 1000 Au 500 12235 region sphere vz -1.0 -1.0 target 5.0 5.0 0.0 units lattice
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ Syntax
|
||||
* N = invoke this fix every N steps
|
||||
* X = average number of GCMC exchanges to attempt every N steps
|
||||
* M = average number of MC moves to attempt every N steps
|
||||
* type = atom type for inserted atoms (must be 0 if mol keyword used)
|
||||
* type = atom type (1-Ntypes or type label) for inserted atoms (must be 0 if mol keyword used)
|
||||
* seed = random # seed (positive integer)
|
||||
* T = temperature of the ideal gas reservoir (temperature units)
|
||||
* mu = chemical potential of the ideal gas reservoir (energy units)
|
||||
@ -45,7 +45,7 @@ Syntax
|
||||
*group* value = group-ID
|
||||
group-ID = group-ID for inserted atoms (string)
|
||||
*grouptype* values = type group-ID
|
||||
type = atom type (int)
|
||||
type = atom type (1-Ntypes or type label)
|
||||
group-ID = group-ID for inserted atoms (string)
|
||||
*intra_energy* value = intramolecular energy (energy units)
|
||||
*tfac_insert* value = scale up/down temperature of inserted atoms (unitless)
|
||||
@ -62,52 +62,47 @@ Examples
|
||||
fix 3 water gcmc 10 100 100 0 3456543 3.0 -2.5 0.1 mol my_one_water maxangle 180 full_energy
|
||||
fix 4 my_gas gcmc 1 10 10 1 123456543 300.0 -12.5 1.0 region disk
|
||||
|
||||
labelmap atom 1 Li
|
||||
fix 2 ion gcmc 10 1000 1000 Li 29494 298.0 -0.5 0.01
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
This fix performs grand canonical Monte Carlo (GCMC) exchanges of
|
||||
atoms or molecules with an imaginary ideal gas
|
||||
reservoir at the specified T and chemical potential (mu) as discussed
|
||||
in :ref:`(Frenkel) <Frenkel2>`. It also
|
||||
attempts Monte Carlo (MC) moves (translations and molecule
|
||||
rotations) within the simulation cell or
|
||||
region. If used with the :doc:`fix nvt <fix_nh>`
|
||||
This fix performs grand canonical Monte Carlo (GCMC) exchanges of atoms or
|
||||
molecules with an imaginary ideal gas reservoir at the specified T and
|
||||
chemical potential (mu) as discussed in :ref:`(Frenkel) <Frenkel2>`. It
|
||||
also attempts Monte Carlo (MC) moves (translations and molecule rotations)
|
||||
within the simulation cell or region. If used with the :doc:`fix nvt <fix_nh>`
|
||||
command, simulations in the grand canonical ensemble (muVT, constant
|
||||
chemical potential, constant volume, and constant temperature) can be
|
||||
performed. Specific uses include computing isotherms in microporous
|
||||
materials, or computing vapor-liquid coexistence curves.
|
||||
|
||||
Every N timesteps the fix attempts both GCMC exchanges
|
||||
(insertions or deletions) and MC moves of gas atoms or molecules.
|
||||
On those timesteps, the average number of attempted GCMC exchanges is X,
|
||||
while the average number of attempted MC moves is M.
|
||||
For GCMC exchanges of either molecular or atomic gasses,
|
||||
these exchanges can be either deletions or insertions,
|
||||
with equal probability.
|
||||
Every N timesteps the fix attempts both GCMC exchanges (insertions or
|
||||
deletions) and MC moves of gas atoms or molecules. On those timesteps, the
|
||||
average number of attempted GCMC exchanges is X, while the average number
|
||||
of attempted MC moves is M. For GCMC exchanges of either molecular or
|
||||
atomic gasses, these exchanges can be either deletions or insertions, with
|
||||
equal probability.
|
||||
|
||||
The possible choices for MC moves are translation of an atom,
|
||||
translation of a molecule, and rotation of a molecule.
|
||||
The relative amounts of each are determined by the optional
|
||||
*mcmoves* keyword (see below).
|
||||
The default behavior is as follows.
|
||||
If the *mol* keyword is used, only molecule translations
|
||||
and molecule rotations are performed with equal probability.
|
||||
Conversely, if the *mol* keyword is not used, only atom
|
||||
translations are performed.
|
||||
M should typically be
|
||||
chosen to be approximately equal to the expected number of gas atoms
|
||||
or molecules of the given type within the simulation cell or region,
|
||||
which will result in roughly one MC move per atom or molecule
|
||||
per MC cycle.
|
||||
The possible choices for MC moves are translation of an atom, translation
|
||||
of a molecule, and rotation of a molecule. The relative amounts of each are
|
||||
determined by the optional *mcmoves* keyword (see below). The default
|
||||
behavior is as follows. If the *mol* keyword is used, only molecule
|
||||
translations and molecule rotations are performed with equal probability.
|
||||
Conversely, if the *mol* keyword is not used, only atom translations are
|
||||
performed. M should typically be chosen to be approximately equal to the
|
||||
expected number of gas atoms or molecules of the given type within the
|
||||
simulation cell or region, which will result in roughly one MC move per
|
||||
atom or molecule per MC cycle.
|
||||
|
||||
All inserted particles are always added to two groups: the default
|
||||
group "all" and the fix group specified in the fix command.
|
||||
In addition, particles are also added to any groups
|
||||
specified by the *group* and *grouptype* keywords. If inserted
|
||||
particles are individual atoms, they are assigned the atom type given
|
||||
by the type argument. If they are molecules, the type argument has no
|
||||
effect and must be set to zero. Instead, the type of each atom in the
|
||||
inserted molecule is specified in the file read by the
|
||||
All inserted particles are always added to two groups: the default group
|
||||
"all" and the fix group specified in the fix command. In addition,
|
||||
particles are also added to any groups specified by the *group* and
|
||||
*grouptype* keywords. If inserted particles are individual atoms, they are
|
||||
assigned the atom type given by the type argument. If they are molecules,
|
||||
the type argument has no effect and must be set to zero. Instead, the type
|
||||
of each atom in the inserted molecule is specified in the file read by the
|
||||
:doc:`molecule <molecule>` command.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -14,7 +14,7 @@ Syntax
|
||||
* atom/swap = style name of this fix command
|
||||
* N = invoke this fix every N steps
|
||||
* X = number of swaps to attempt every N steps
|
||||
* itype,jtype = two atom types to swap with each other
|
||||
* itype,jtype = two atom types (1-Ntypes or type label) to swap with each other
|
||||
* seed = random # seed (positive integer)
|
||||
* T = scaling temperature of the MC swaps (temperature units)
|
||||
* zero or more keyword/value pairs may be appended to args
|
||||
@ -34,6 +34,9 @@ Examples
|
||||
fix 2 all mol/swap 100 1 2 3 29494 300.0 ke no
|
||||
fix mySwap fluid mol/swap 500 10 1 2 482798 1.0
|
||||
|
||||
labelmap atom 1 A 2 B
|
||||
fix mySwap fluid mol/swap 500 10 A B 482798 1.0
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ Syntax
|
||||
* widom = style name of this fix command
|
||||
* N = invoke this fix every N steps
|
||||
* M = number of Widom insertions to attempt every N steps
|
||||
* type = atom type for inserted atoms (must be 0 if mol keyword used)
|
||||
* type = atom type (1-Ntypes or type label) for inserted atoms (must be 0 if mol keyword used)
|
||||
* seed = random # seed (positive integer)
|
||||
* T = temperature of the system (temperature units)
|
||||
* zero or more keyword/value pairs may be appended to args
|
||||
@ -38,6 +38,9 @@ Examples
|
||||
fix 2 gas widom 1 50000 1 19494 2.0
|
||||
fix 3 water widom 1000 100 0 29494 300.0 mol h2omol full_energy
|
||||
|
||||
labelmap atom 1 Li
|
||||
fix 2 ion widom 1 50000 Li 19494 2.0
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
|
||||
@ -20,13 +20,13 @@ Syntax
|
||||
*empty* = no args
|
||||
*region* args = region-ID
|
||||
*type* or *id* or *molecule*
|
||||
args = list of one or more atom types, atom IDs, or molecule IDs
|
||||
any entry in list can be a sequence formatted as A:B or A:B:C where
|
||||
args = list of one or more atom types (1-Ntypes or type label), atom IDs, or molecule IDs
|
||||
any numeric entry in list can be a sequence formatted as A:B or A:B:C where
|
||||
A = starting index, B = ending index,
|
||||
C = increment between indices, 1 if not specified
|
||||
args = logical value
|
||||
logical = "<" or "<=" or ">" or ">=" or "==" or "!="
|
||||
value = an atom type or atom ID or molecule ID (depending on *style*\ )
|
||||
value = an atom type (1-Ntypes or type label) or atom ID or molecule ID (depending on *style*\ )
|
||||
args = logical value1 value2
|
||||
logical = "<>"
|
||||
value1,value2 = atom types or atom IDs or molecule IDs (depending on *style*\ )
|
||||
@ -52,6 +52,7 @@ Examples
|
||||
|
||||
group edge region regstrip
|
||||
group water type 3 4
|
||||
group water type OW HT
|
||||
group sub id 10 25 50
|
||||
group sub id 10 25 50 500:1000
|
||||
group sub id 100:10000:10
|
||||
@ -119,7 +120,7 @@ three styles can use arguments specified in one of two formats.
|
||||
|
||||
The first format is a list of values (types or IDs). For example, the
|
||||
second command in the examples above puts all atoms of type 3 or 4 into
|
||||
the group named *water*\ . Each entry in the list can be a
|
||||
the group named *water*\ . Each numeric entry in the list can be a
|
||||
colon-separated sequence ``A:B`` or ``A:B:C``, as in two of the examples
|
||||
above. A "sequence" generates a sequence of values (types or IDs),
|
||||
with an optional increment. The first example with ``500:1000`` has the
|
||||
@ -135,7 +136,8 @@ except ``<>`` take a single argument. The third example above adds all
|
||||
atoms with IDs from 1 to 150 to the group named *sub*\ . The logical ``<>``
|
||||
means "between" and takes 2 arguments. The fourth example above adds all
|
||||
atoms belonging to molecules with IDs from 50 to 250 (inclusive) to
|
||||
the group named polyA.
|
||||
the group named polyA. For the *type* style, type labels are converted into
|
||||
numeric types before being evaluated.
|
||||
|
||||
The *variable* style evaluates a variable to determine which atoms to
|
||||
add to the group. It must be an :doc:`atom-style variable <variable>`
|
||||
|
||||
@ -24,6 +24,7 @@ Examples
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
labelmap atom 1 c1 2 hc 3 cp 4 nt
|
||||
labelmap atom 3 carbon 4 'c3"' 5 "c1'" 6 "c#"
|
||||
labelmap atom $(label2type(atom,carbon)) C # change type label from 'carbon' to 'C'
|
||||
labelmap clear
|
||||
|
||||
@ -38,6 +38,7 @@ molecule mol4 rxn1_stp2_reacted.molecule_template
|
||||
thermo 50
|
||||
|
||||
# dump 1 all xyz 100 test_vis.xyz
|
||||
# dump_modify 1 types labels
|
||||
|
||||
fix myrxns all bond/react stabilization yes statted_grp .03 &
|
||||
react rxn1 all 1 0.0 2.9 mol1 mol2 rxn1_stp1_map &
|
||||
|
||||
@ -35,6 +35,7 @@ molecule mol6 rxn2_stp2_post.molecule_template
|
||||
thermo 50
|
||||
|
||||
# dump 1 all xyz 1 test_vis.xyz
|
||||
# dump_modify 1 types labels
|
||||
|
||||
fix rxns all bond/react stabilization yes statted_grp .03 &
|
||||
react rxn1_stp1 all 1 0.0 5 mol1 mol2 rxn1_stp1.map &
|
||||
|
||||
@ -39,6 +39,7 @@ molecule mol4 rxn1_stp2_reacted.molecule_template
|
||||
thermo 50
|
||||
|
||||
# dump 1 all xyz 1 test_vis.xyz
|
||||
# dump_modify 1 types labels
|
||||
|
||||
fix myrxns all bond/react stabilization yes statted_grp .03 &
|
||||
react rxn1 all 1 0.0 2.9 mol1 mol2 rxn1_stp1_map &
|
||||
|
||||
@ -43,6 +43,7 @@ molecule mol4 rxn1_stp2_reacted.molecule_template
|
||||
thermo 50
|
||||
|
||||
# dump 1 all xyz 1 test_vis.xyz
|
||||
# dump_modify 1 types labels
|
||||
|
||||
fix myrxns all bond/react stabilization yes statted_grp .03 &
|
||||
react rxn1 all 1 0.0 5.0 mol1 mol2 rxn1_stp1_map prob v_prob1 1234 &
|
||||
|
||||
@ -40,6 +40,7 @@ molecule mol4 rxn1_stp2_reacted.molecule_template
|
||||
thermo 50
|
||||
|
||||
# dump 1 all xyz 1 test_vis.xyz
|
||||
# dump_modify 1 types labels
|
||||
|
||||
fix myrxns all bond/react stabilization no &
|
||||
react rxn1 all 1 0.0 2.9 mol1 mol2 rxn1_stp1_map &
|
||||
|
||||
@ -41,6 +41,7 @@ molecule mol6 chain_chain_reacted.molecule_template
|
||||
thermo 100
|
||||
|
||||
# dump 1 all xyz 5 test_vis.xyz
|
||||
# dump_modify 1 types labels
|
||||
|
||||
fix rxn1 all bond/react stabilization yes statted_grp .03 &
|
||||
react rxn1 all 1 0 3.0 mol1 mol2 2styrene_map stabilize_steps 100 &
|
||||
|
||||
@ -91,10 +91,22 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) :
|
||||
adapt[nadapt].which = PAIR;
|
||||
adapt[nadapt].pstyle = utils::strdup(arg[iarg+1]);
|
||||
adapt[nadapt].pparam = utils::strdup(arg[iarg+2]);
|
||||
utils::bounds(FLERR,arg[iarg+3],1,atom->ntypes,
|
||||
adapt[nadapt].ilo,adapt[nadapt].ihi,error);
|
||||
utils::bounds(FLERR,arg[iarg+4],1,atom->ntypes,
|
||||
adapt[nadapt].jlo,adapt[nadapt].jhi,error);
|
||||
utils::bounds_typelabel(FLERR, arg[iarg+3], 1, atom->ntypes,
|
||||
adapt[nadapt].ilo, adapt[nadapt].ihi, error, lmp, Atom::ATOM);
|
||||
utils::bounds_typelabel(FLERR, arg[iarg+4], 1, atom->ntypes,
|
||||
adapt[nadapt].jlo, adapt[nadapt].jhi, error, lmp, Atom::ATOM);
|
||||
|
||||
// switch i,j if i > j, if wildcards were not used
|
||||
|
||||
if ( (adapt[nadapt].ilo == adapt[nadapt].ihi) &&
|
||||
(adapt[nadapt].jlo == adapt[nadapt].jhi) &&
|
||||
(adapt[nadapt].ilo > adapt[nadapt].jlo) ) {
|
||||
adapt[nadapt].jlo = adapt[nadapt].ihi;
|
||||
adapt[nadapt].ilo = adapt[nadapt].jhi;
|
||||
adapt[nadapt].ihi = adapt[nadapt].ilo;
|
||||
adapt[nadapt].jhi = adapt[nadapt].jlo;
|
||||
}
|
||||
|
||||
if (utils::strmatch(arg[iarg+5],"^v_")) {
|
||||
adapt[nadapt].var = utils::strdup(arg[iarg+5]+2);
|
||||
} else error->all(FLERR,"Illegal fix adapt/fep command");
|
||||
@ -118,8 +130,8 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) :
|
||||
adapt[nadapt].aparam = CHARGE;
|
||||
chgflag = 1;
|
||||
} else error->all(FLERR,"Illegal fix adapt/fep command");
|
||||
utils::bounds(FLERR,arg[iarg+2],1,atom->ntypes,
|
||||
adapt[nadapt].ilo,adapt[nadapt].ihi,error);
|
||||
utils::bounds_typelabel(FLERR, arg[iarg+2], 1, atom->ntypes,
|
||||
adapt[nadapt].ilo, adapt[nadapt].ihi, error, lmp, Atom::ATOM);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) {
|
||||
adapt[nadapt].var = utils::strdup(arg[iarg+3]+2);
|
||||
} else error->all(FLERR,"Illegal fix adapt/fep command");
|
||||
|
||||
@ -171,7 +171,7 @@ void FixAtomSwap::options(int narg, char **arg)
|
||||
while (iarg < narg) {
|
||||
if (isalpha(arg[iarg][0])) break;
|
||||
if (nswaptypes >= atom->ntypes) error->all(FLERR, "Illegal fix atom/swap command");
|
||||
type_list[nswaptypes] = utils::numeric(FLERR, arg[iarg], false, lmp);
|
||||
type_list[nswaptypes] = utils::expand_type_int(FLERR, arg[iarg], Atom::ATOM, lmp);
|
||||
nswaptypes++;
|
||||
iarg++;
|
||||
}
|
||||
|
||||
@ -46,8 +46,8 @@ FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) :
|
||||
MPI_Comm_rank(world,&me);
|
||||
MPI_Comm_size(world,&nprocs);
|
||||
|
||||
nevery = utils::inumeric(FLERR,arg[3],false,lmp);
|
||||
if (nevery <= 0) error->all(FLERR,"Illegal fix bond/break command");
|
||||
nevery = utils::inumeric(FLERR, arg[3], false, lmp);
|
||||
if (nevery <= 0) error->all(FLERR, "Illegal fix bond/break command");
|
||||
|
||||
force_reneighbor = 1;
|
||||
next_reneighbor = -1;
|
||||
@ -56,8 +56,8 @@ FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) :
|
||||
global_freq = 1;
|
||||
extvector = 0;
|
||||
|
||||
btype = utils::inumeric(FLERR,arg[4],false,lmp);
|
||||
cutoff = utils::numeric(FLERR,arg[5],false,lmp);
|
||||
btype = utils::expand_type_int(FLERR, arg[4], Atom::BOND, lmp);
|
||||
cutoff = utils::numeric(FLERR, arg[5], false, lmp);
|
||||
|
||||
if (btype < 1 || btype > atom->nbondtypes)
|
||||
error->all(FLERR,"Invalid bond type in fix bond/break command");
|
||||
|
||||
@ -59,10 +59,10 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) :
|
||||
global_freq = 1;
|
||||
extvector = 0;
|
||||
|
||||
iatomtype = utils::inumeric(FLERR,arg[4],false,lmp);
|
||||
jatomtype = utils::inumeric(FLERR,arg[5],false,lmp);
|
||||
iatomtype = utils::expand_type_int(FLERR, arg[4], Atom::ATOM, lmp);
|
||||
jatomtype = utils::expand_type_int(FLERR, arg[5], Atom::ATOM, lmp);
|
||||
double cutoff = utils::numeric(FLERR,arg[6],false,lmp);
|
||||
btype = utils::inumeric(FLERR,arg[7],false,lmp);
|
||||
btype = utils::expand_type_int(FLERR, arg[7], Atom::BOND, lmp);
|
||||
|
||||
if (iatomtype < 1 || iatomtype > atom->ntypes ||
|
||||
jatomtype < 1 || jatomtype > atom->ntypes)
|
||||
@ -92,49 +92,49 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) :
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"iparam") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command");
|
||||
imaxbond = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
inewtype = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
|
||||
imaxbond = utils::inumeric(FLERR, arg[iarg+1], false, lmp);
|
||||
inewtype = utils::expand_type_int(FLERR, arg[iarg+2], Atom::ATOM, lmp);
|
||||
if (imaxbond < 0) error->all(FLERR,"Illegal fix bond/create command");
|
||||
if (inewtype < 1 || inewtype > atom->ntypes)
|
||||
error->all(FLERR,"Invalid atom type in fix bond/create command");
|
||||
iarg += 3;
|
||||
} else if (strcmp(arg[iarg],"jparam") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command");
|
||||
jmaxbond = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
jnewtype = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
|
||||
jmaxbond = utils::inumeric(FLERR, arg[iarg+1], false, lmp);
|
||||
jnewtype = utils::expand_type_int(FLERR, arg[iarg+2], Atom::ATOM, lmp);
|
||||
if (jmaxbond < 0) error->all(FLERR,"Illegal fix bond/create command");
|
||||
if (jnewtype < 1 || jnewtype > atom->ntypes)
|
||||
error->all(FLERR,"Invalid atom type in fix bond/create command");
|
||||
iarg += 3;
|
||||
} else if (strcmp(arg[iarg],"prob") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command");
|
||||
fraction = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
seed = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
|
||||
fraction = utils::numeric(FLERR, arg[iarg+1], false, lmp);
|
||||
seed = utils::inumeric(FLERR, arg[iarg+2], false, lmp);
|
||||
if (fraction < 0.0 || fraction > 1.0)
|
||||
error->all(FLERR,"Illegal fix bond/create command");
|
||||
if (seed <= 0) error->all(FLERR,"Illegal fix bond/create command");
|
||||
iarg += 3;
|
||||
} else if (strcmp(arg[iarg],"atype") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/create command");
|
||||
atype = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
atype = utils::expand_type_int(FLERR, arg[iarg+1], Atom::ANGLE, lmp);
|
||||
if (atype < 0) error->all(FLERR,"Illegal fix bond/create command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"dtype") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/create command");
|
||||
dtype = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
dtype = utils::expand_type_int(FLERR, arg[iarg+1], Atom::DIHEDRAL, lmp);
|
||||
if (dtype < 0) error->all(FLERR,"Illegal fix bond/create command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"itype") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/create command");
|
||||
itype = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
itype = utils::expand_type_int(FLERR, arg[iarg+1], Atom::IMPROPER, lmp);
|
||||
if (itype < 0) error->all(FLERR,"Illegal fix bond/create command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"aconstrain") == 0 &&
|
||||
strcmp(style,"bond/create/angle") == 0) {
|
||||
if (iarg+3 > narg)
|
||||
error->all(FLERR,"Illegal fix bond/create/angle command");
|
||||
amin = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
amax = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
|
||||
amin = utils::numeric(FLERR, arg[iarg+1], false, lmp);
|
||||
amax = utils::inumeric(FLERR, arg[iarg+2], false, lmp);
|
||||
if (amin >= amax)
|
||||
error->all(FLERR,"Illegal fix bond/create/angle command");
|
||||
if (amin < 0 || amin > 180)
|
||||
@ -1430,4 +1430,3 @@ double FixBondCreate::memory_usage()
|
||||
bytes += (double)nmax * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
@ -97,8 +97,8 @@ FixChargeRegulation::FixChargeRegulation(LAMMPS *lmp, int narg, char **arg) :
|
||||
energy_stored = 0;
|
||||
|
||||
// necessary to specify the free ion types
|
||||
cation_type = utils::inumeric(FLERR, arg[3], false, lmp);
|
||||
anion_type = utils::inumeric(FLERR, arg[4], false, lmp);
|
||||
cation_type = utils::expand_type_int(FLERR, arg[3], Atom::ATOM, lmp);
|
||||
anion_type = utils::expand_type_int(FLERR, arg[4], Atom::ATOM, lmp);
|
||||
|
||||
// set defaults and read optional arguments
|
||||
options(narg - 5, &arg[5]);
|
||||
@ -1398,11 +1398,11 @@ void FixChargeRegulation::options(int narg, char **arg) {
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "acid_type") == 0) {
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge/regulation command");
|
||||
acid_type = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
acid_type = utils::expand_type_int(FLERR, arg[iarg + 1], Atom::ATOM, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "base_type") == 0) {
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge/regulation command");
|
||||
base_type = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
base_type = utils::expand_type_int(FLERR, arg[iarg + 1], Atom::ATOM, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "pH") == 0) {
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge/regulation command");
|
||||
|
||||
@ -94,22 +94,22 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// required args
|
||||
|
||||
nevery = utils::inumeric(FLERR,arg[3],false,lmp);
|
||||
nexchanges = utils::inumeric(FLERR,arg[4],false,lmp);
|
||||
nmcmoves = utils::inumeric(FLERR,arg[5],false,lmp);
|
||||
ngcmc_type = utils::inumeric(FLERR,arg[6],false,lmp);
|
||||
seed = utils::inumeric(FLERR,arg[7],false,lmp);
|
||||
reservoir_temperature = utils::numeric(FLERR,arg[8],false,lmp);
|
||||
chemical_potential = utils::numeric(FLERR,arg[9],false,lmp);
|
||||
displace = utils::numeric(FLERR,arg[10],false,lmp);
|
||||
nevery = utils::inumeric(FLERR, arg[3], false, lmp);
|
||||
nexchanges = utils::inumeric(FLERR, arg[4], false, lmp);
|
||||
nmcmoves = utils::inumeric(FLERR, arg[5], false, lmp);
|
||||
ngcmc_type = utils::expand_type_int(FLERR, arg[6], Atom::ATOM, lmp);
|
||||
seed = utils::inumeric(FLERR, arg[7], false, lmp);
|
||||
reservoir_temperature = utils::numeric(FLERR, arg[8], false, lmp);
|
||||
chemical_potential = utils::numeric(FLERR, arg[9], false, lmp);
|
||||
displace = utils::numeric(FLERR, arg[10], false, lmp);
|
||||
|
||||
if (nevery <= 0) error->all(FLERR,"Illegal fix gcmc command");
|
||||
if (nexchanges < 0) error->all(FLERR,"Illegal fix gcmc command");
|
||||
if (nmcmoves < 0) error->all(FLERR,"Illegal fix gcmc command");
|
||||
if (seed <= 0) error->all(FLERR,"Illegal fix gcmc command");
|
||||
if (nevery <= 0) error->all(FLERR, "Illegal fix gcmc command");
|
||||
if (nexchanges < 0) error->all(FLERR, "Illegal fix gcmc command");
|
||||
if (nmcmoves < 0) error->all(FLERR, "Illegal fix gcmc command");
|
||||
if (seed <= 0) error->all(FLERR, "Illegal fix gcmc command");
|
||||
if (reservoir_temperature < 0.0)
|
||||
error->all(FLERR,"Illegal fix gcmc command");
|
||||
if (displace < 0.0) error->all(FLERR,"Illegal fix gcmc command");
|
||||
error->all(FLERR, "Illegal fix gcmc command");
|
||||
if (displace < 0.0) error->all(FLERR, "Illegal fix gcmc command");
|
||||
|
||||
// read options from end of input line
|
||||
|
||||
@ -359,7 +359,7 @@ void FixGCMC::options(int narg, char **arg)
|
||||
ngrouptypesmax*sizeof(char *),
|
||||
"fix_gcmc:grouptypestrings");
|
||||
}
|
||||
grouptypes[ngrouptypes] = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
grouptypes[ngrouptypes] = utils::expand_type_int(FLERR, arg[iarg+1], Atom::ATOM, lmp);
|
||||
grouptypestrings[ngrouptypes] = utils::strdup(arg[iarg+2]);
|
||||
ngrouptypes++;
|
||||
iarg += 3;
|
||||
|
||||
@ -56,10 +56,10 @@ FixMolSwap::FixMolSwap(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// parse args
|
||||
|
||||
nevery = utils::inumeric(FLERR,arg[3],false,lmp);
|
||||
ncycles = utils::inumeric(FLERR,arg[4],false,lmp);
|
||||
itype = utils::inumeric(FLERR,arg[5],false,lmp);
|
||||
jtype = utils::inumeric(FLERR,arg[6],false,lmp);
|
||||
nevery = utils::inumeric(FLERR, arg[3], false, lmp);
|
||||
ncycles = utils::inumeric(FLERR, arg[4], false, lmp);
|
||||
itype = utils::expand_type_int(FLERR, arg[5], Atom::ATOM, lmp);
|
||||
jtype = utils::expand_type_int(FLERR, arg[6], Atom::ATOM, lmp);
|
||||
seed = utils::inumeric(FLERR,arg[7],false,lmp);
|
||||
double temperature = utils::numeric(FLERR,arg[8],false,lmp);
|
||||
|
||||
|
||||
@ -77,11 +77,11 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// required args
|
||||
|
||||
nevery = utils::inumeric(FLERR,arg[3],false,lmp);
|
||||
ninsertions = utils::inumeric(FLERR,arg[4],false,lmp);
|
||||
nwidom_type = utils::inumeric(FLERR,arg[5],false,lmp);
|
||||
seed = utils::inumeric(FLERR,arg[6],false,lmp);
|
||||
insertion_temperature = utils::numeric(FLERR,arg[7],false,lmp);
|
||||
nevery = utils::inumeric(FLERR, arg[3], false, lmp);
|
||||
ninsertions = utils::inumeric(FLERR, arg[4], false, lmp);
|
||||
nwidom_type = utils::expand_type_int(FLERR, arg[5], Atom::ATOM, lmp);
|
||||
seed = utils::inumeric(FLERR, arg[6], false, lmp);
|
||||
insertion_temperature = utils::numeric(FLERR, arg[7], false, lmp);
|
||||
|
||||
if (nevery <= 0) error->all(FLERR,"Invalid fix widom every argument: {}", nevery);
|
||||
if (ninsertions < 0) error->all(FLERR,"Invalid fix widom insertions argument: {}", ninsertions);
|
||||
|
||||
10
src/atom.cpp
10
src/atom.cpp
@ -1994,18 +1994,14 @@ void Atom::set_mass(const char *file, int line, int /*narg*/, char **arg)
|
||||
if (mass == nullptr)
|
||||
error->all(file,line, "Cannot set per-type atom mass for atom style {}", atom_style);
|
||||
|
||||
char *typestr = utils::expand_type(file, line, arg[0], Atom::ATOM, lmp);
|
||||
const std::string str = typestr ? typestr : arg[0];
|
||||
delete[] typestr;
|
||||
|
||||
int lo, hi;
|
||||
utils::bounds(file, line, str, 1, ntypes, lo, hi, error);
|
||||
utils::bounds_typelabel(file, line, arg[0], 1, ntypes, lo, hi, error, lmp, Atom::ATOM);
|
||||
if ((lo < 1) || (hi > ntypes))
|
||||
error->all(file, line, "Invalid atom type {} for atom mass", str);
|
||||
error->all(file, line, "Invalid atom type {} for atom mass", arg[0]);
|
||||
|
||||
const double value = utils::numeric(FLERR, arg[1], false, lmp);
|
||||
if (value <= 0.0)
|
||||
error->all(file, line, "Invalid atom mass value {} for type {}", value, str);
|
||||
error->all(file, line, "Invalid atom mass value {} for type {}", value, arg[0]);
|
||||
|
||||
for (int itype = lo; itype <= hi; itype++) {
|
||||
mass[itype] = value;
|
||||
|
||||
@ -102,10 +102,20 @@ ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) :
|
||||
} else {
|
||||
iarg = 4;
|
||||
for (int ipair = 0; ipair < npairs; ipair++) {
|
||||
utils::bounds(FLERR,arg[iarg],1,atom->ntypes,ilo[ipair],ihi[ipair],error);
|
||||
utils::bounds(FLERR,arg[iarg+1],1,atom->ntypes,jlo[ipair],jhi[ipair],error);
|
||||
if (ilo[ipair] > ihi[ipair] || jlo[ipair] > jhi[ipair])
|
||||
error->all(FLERR,"Illegal compute rdf command");
|
||||
utils::bounds_typelabel(FLERR, arg[iarg], 1, atom->ntypes, ilo[ipair], ihi[ipair], error, lmp, Atom::ATOM);
|
||||
utils::bounds_typelabel(FLERR, arg[iarg+1], 1, atom->ntypes, jlo[ipair], jhi[ipair], error, lmp, Atom::ATOM);
|
||||
|
||||
// switch i,j if i > j, if wildcards were not used
|
||||
|
||||
if ( (ilo[ipair] == ihi[ipair]) &&
|
||||
(jlo[ipair] == jhi[ipair]) &&
|
||||
(ilo[ipair] > jlo[ipair]) ) {
|
||||
jlo[ipair] = ihi[ipair];
|
||||
ilo[ipair] = jhi[ipair];
|
||||
ihi[ipair] = ilo[ipair];
|
||||
jhi[ipair] = jlo[ipair];
|
||||
}
|
||||
|
||||
iarg += 2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ 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);
|
||||
ntype = utils::expand_type_int(FLERR, arg[0], Atom::ATOM, lmp);
|
||||
|
||||
const char *meshfile;
|
||||
int iarg;
|
||||
@ -168,7 +168,7 @@ 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);
|
||||
int itype = utils::expand_type_int(FLERR, arg[iarg + 2], Atom::ATOM, lmp);
|
||||
if (ibasis <= 0 || ibasis > nbasis || itype <= 0 || itype > atom->ntypes)
|
||||
error->all(FLERR, "Out of range basis setting '{} {}' in create_atoms command", ibasis,
|
||||
itype);
|
||||
|
||||
@ -85,19 +85,37 @@ void DeleteBonds::command(int narg, char **arg)
|
||||
if (narg < 3) error->all(FLERR,"Illegal delete_bonds command");
|
||||
|
||||
int n = -1;
|
||||
if (style == ATOM) n = atom->ntypes;
|
||||
if (style == BOND) n = atom->nbondtypes;
|
||||
if (style == ANGLE) n = atom->nangletypes;
|
||||
if (style == DIHEDRAL) n = atom->ndihedraltypes;
|
||||
if (style == IMPROPER) n = atom->nimpropertypes;
|
||||
char *typestr = nullptr;
|
||||
if (style == ATOM) {
|
||||
n = atom->ntypes;
|
||||
typestr = utils::expand_type(FLERR, arg[2], Atom::ATOM, lmp);
|
||||
}
|
||||
if (style == BOND) {
|
||||
n = atom->nbondtypes;
|
||||
typestr = utils::expand_type(FLERR, arg[2], Atom::BOND, lmp);
|
||||
}
|
||||
if (style == ANGLE) {
|
||||
n = atom->nangletypes;
|
||||
typestr = utils::expand_type(FLERR, arg[2], Atom::ANGLE, lmp);
|
||||
}
|
||||
if (style == DIHEDRAL) {
|
||||
n = atom->ndihedraltypes;
|
||||
typestr = utils::expand_type(FLERR, arg[2], Atom::DIHEDRAL, lmp);
|
||||
}
|
||||
if (style == IMPROPER) {
|
||||
n = atom->nimpropertypes;
|
||||
typestr = utils::expand_type(FLERR, arg[2], Atom::IMPROPER, lmp);
|
||||
}
|
||||
|
||||
tlist = new int[n+1];
|
||||
for (int i = 0; i <= n; i++) tlist[i] = 0;
|
||||
int nlo,nhi;
|
||||
utils::bounds(FLERR,arg[2],0,n,nlo,nhi,error);
|
||||
if (typestr) nlo = nhi = utils::inumeric(FLERR, typestr, false, lmp);
|
||||
else utils::bounds(FLERR, arg[2], 0, n, nlo, nhi, error);
|
||||
for (int i = nlo; i <= nhi; i++) tlist[i] = 1;
|
||||
|
||||
iarg++;
|
||||
delete[] typestr;
|
||||
}
|
||||
|
||||
// grab optional keywords
|
||||
|
||||
@ -107,7 +107,7 @@ class Dump : protected Pointers {
|
||||
char *format_int_user;
|
||||
char *format_bigint_user;
|
||||
char **format_column_user;
|
||||
enum { INT, DOUBLE, STRING, BIGINT };
|
||||
enum { INT, DOUBLE, STRING, STRING2, BIGINT };
|
||||
std::map<std::string, int> key2col;
|
||||
std::vector<std::string> keyword_user;
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include "fix_store_atom.h"
|
||||
#include "group.h"
|
||||
#include "input.h"
|
||||
#include "label_map.h"
|
||||
#include "memory.h"
|
||||
#include "modify.h"
|
||||
#include "region.h"
|
||||
@ -36,7 +37,7 @@ using namespace LAMMPS_NS;
|
||||
// customize by adding keyword
|
||||
// also customize compute_property_atom.cpp
|
||||
|
||||
enum{ID,MOL,PROC,PROCP1,TYPE,ELEMENT,MASS,
|
||||
enum{ID,MOL,PROC,PROCP1,TYPE,TYPELABEL,ELEMENT,MASS,
|
||||
X,Y,Z,XS,YS,ZS,XSTRI,YSTRI,ZSTRI,XU,YU,ZU,XUTRI,YUTRI,ZUTRI,
|
||||
XSU,YSU,ZSU,XSUTRI,YSUTRI,ZSUTRI,
|
||||
IX,IY,IZ,
|
||||
@ -140,6 +141,7 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (vtype[i] == Dump::INT) cols += "%d ";
|
||||
else if (vtype[i] == Dump::DOUBLE) cols += "%g ";
|
||||
else if (vtype[i] == Dump::STRING) cols += "%s ";
|
||||
else if (vtype[i] == Dump::STRING2) cols += "%s ";
|
||||
else if (vtype[i] == Dump::BIGINT) cols += BIGINT_FORMAT " ";
|
||||
vformat[i] = nullptr;
|
||||
}
|
||||
@ -695,7 +697,12 @@ int DumpCustom::count()
|
||||
for (i = 0; i < nlocal; i++) dchoose[i] = type[i];
|
||||
ptr = dchoose;
|
||||
nstride = 1;
|
||||
} else if (thresh_array[ithresh] == ELEMENT) {
|
||||
} else if (thresh_array[ithresh] == TYPELABEL) { // dead code?
|
||||
int *type = atom->type;
|
||||
for (i = 0; i < nlocal; i++) dchoose[i] = type[i];
|
||||
ptr = dchoose;
|
||||
nstride = 1;
|
||||
} else if (thresh_array[ithresh] == ELEMENT) { // dead code?
|
||||
int *type = atom->type;
|
||||
for (i = 0; i < nlocal; i++) dchoose[i] = type[i];
|
||||
ptr = dchoose;
|
||||
@ -1235,6 +1242,8 @@ int DumpCustom::convert_string(int n, double *mybuf)
|
||||
offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]);
|
||||
else if (vtype[j] == Dump::STRING)
|
||||
offset += sprintf(&sbuf[offset],vformat[j],typenames[(int) mybuf[m]]);
|
||||
else if (vtype[j] == Dump::STRING2)
|
||||
offset += sprintf(&sbuf[offset],vformat[j],atom->lmap->typelabel[(int) mybuf[m]-1].c_str());
|
||||
else if (vtype[j] == Dump::BIGINT)
|
||||
offset += sprintf(&sbuf[offset],vformat[j],
|
||||
static_cast<bigint> (mybuf[m]));
|
||||
@ -1283,6 +1292,8 @@ void DumpCustom::write_lines(int n, double *mybuf)
|
||||
else if (vtype[j] == Dump::DOUBLE) fprintf(fp,vformat[j],mybuf[m]);
|
||||
else if (vtype[j] == Dump::STRING)
|
||||
fprintf(fp,vformat[j],typenames[(int) mybuf[m]]);
|
||||
else if (vtype[j] == Dump::STRING2)
|
||||
fprintf(fp,vformat[j],atom->lmap->typelabel[(int) mybuf[m]-1].c_str());
|
||||
else if (vtype[j] == Dump::BIGINT)
|
||||
fprintf(fp,vformat[j],static_cast<bigint> (mybuf[m]));
|
||||
m++;
|
||||
@ -1323,6 +1334,9 @@ int DumpCustom::parse_fields(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"element") == 0) {
|
||||
pack_choice[iarg] = &DumpCustom::pack_type;
|
||||
vtype[iarg] = Dump::STRING;
|
||||
} else if (strcmp(arg[iarg],"typelabel") == 0) {
|
||||
pack_choice[iarg] = &DumpCustom::pack_type;
|
||||
vtype[iarg] = Dump::STRING2;
|
||||
} else if (strcmp(arg[iarg],"mass") == 0) {
|
||||
pack_choice[iarg] = &DumpCustom::pack_mass;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
#include "label_map.h"
|
||||
#include "memory.h"
|
||||
#include "update.h"
|
||||
|
||||
@ -122,6 +123,32 @@ int DumpXYZ::modify_param(int narg, char **arg)
|
||||
return ntypes+1;
|
||||
}
|
||||
|
||||
if (strcmp(arg[0],"types") == 0) {
|
||||
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
|
||||
|
||||
if (typenames) {
|
||||
for (int i = 1; i <= ntypes; i++)
|
||||
delete [] typenames[i];
|
||||
|
||||
delete [] typenames;
|
||||
typenames = nullptr;
|
||||
}
|
||||
|
||||
if (strcmp(arg[1],"numeric") == 0) {
|
||||
return 2;
|
||||
} else if (strcmp(arg[1],"labels") == 0) {
|
||||
if (!atom->labelmapflag)
|
||||
error->all(FLERR, "Label map must be defined when using 'types labels'");
|
||||
} else error->all(FLERR, "Illegal option for dump_modify 'types' keyword");
|
||||
|
||||
typenames = new char*[ntypes+1];
|
||||
for (int itype = 1; itype <= ntypes; itype++) {
|
||||
typenames[itype] = utils::strdup(atom->lmap->typelabel[itype-1]);
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -99,10 +99,22 @@ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) :
|
||||
adapt[nadapt].pair = nullptr;
|
||||
adapt[nadapt].pstyle = utils::strdup(arg[iarg+1]);
|
||||
adapt[nadapt].pparam = utils::strdup(arg[iarg+2]);
|
||||
utils::bounds(FLERR,arg[iarg+3],1,atom->ntypes,
|
||||
adapt[nadapt].ilo,adapt[nadapt].ihi,error);
|
||||
utils::bounds(FLERR,arg[iarg+4],1,atom->ntypes,
|
||||
adapt[nadapt].jlo,adapt[nadapt].jhi,error);
|
||||
utils::bounds_typelabel(FLERR, arg[iarg+3], 1, atom->ntypes,
|
||||
adapt[nadapt].ilo, adapt[nadapt].ihi, error, lmp, Atom::ATOM);
|
||||
utils::bounds_typelabel(FLERR, arg[iarg+4], 1, atom->ntypes,
|
||||
adapt[nadapt].jlo, adapt[nadapt].jhi, error, lmp, Atom::ATOM);
|
||||
|
||||
// switch i,j if i > j, if wildcards were not used
|
||||
|
||||
if ( (adapt[nadapt].ilo == adapt[nadapt].ihi) &&
|
||||
(adapt[nadapt].jlo == adapt[nadapt].jhi) &&
|
||||
(adapt[nadapt].ilo > adapt[nadapt].jlo) ) {
|
||||
adapt[nadapt].jlo = adapt[nadapt].ihi;
|
||||
adapt[nadapt].ilo = adapt[nadapt].jhi;
|
||||
adapt[nadapt].ihi = adapt[nadapt].ilo;
|
||||
adapt[nadapt].jhi = adapt[nadapt].jlo;
|
||||
}
|
||||
|
||||
if (utils::strmatch(arg[iarg+5],"^v_")) {
|
||||
adapt[nadapt].var = utils::strdup(arg[iarg+5]+2);
|
||||
} else error->all(FLERR,"Argument #{} must be variable not {}", iarg+6, arg[iarg+5]);
|
||||
@ -114,8 +126,8 @@ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) :
|
||||
adapt[nadapt].bond = nullptr;
|
||||
adapt[nadapt].bstyle = utils::strdup(arg[iarg+1]);
|
||||
adapt[nadapt].bparam = utils::strdup(arg[iarg+2]);
|
||||
utils::bounds(FLERR,arg[iarg+3],1,atom->nbondtypes,
|
||||
adapt[nadapt].ilo,adapt[nadapt].ihi,error);
|
||||
utils::bounds_typelabel(FLERR, arg[iarg+3], 1, atom->nbondtypes,
|
||||
adapt[nadapt].ilo, adapt[nadapt].ihi, error, lmp, Atom::BOND);
|
||||
if (utils::strmatch(arg[iarg+4],"^v_")) {
|
||||
adapt[nadapt].var = utils::strdup(arg[iarg+4]+2);
|
||||
} else error->all(FLERR,"Argument #{} must be variable not {}", iarg+5, arg[iarg+4]);
|
||||
@ -127,8 +139,8 @@ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) :
|
||||
adapt[nadapt].angle = nullptr;
|
||||
adapt[nadapt].astyle = utils::strdup(arg[iarg+1]);
|
||||
adapt[nadapt].aparam = utils::strdup(arg[iarg+2]);
|
||||
utils::bounds(FLERR,arg[iarg+3],1,atom->nangletypes,
|
||||
adapt[nadapt].ilo,adapt[nadapt].ihi,error);
|
||||
utils::bounds_typelabel(FLERR, arg[iarg+3], 1, atom->nangletypes,
|
||||
adapt[nadapt].ilo, adapt[nadapt].ihi, error, lmp, Atom::ANGLE);
|
||||
if (utils::strmatch(arg[iarg+4],"^v_")) {
|
||||
adapt[nadapt].var = utils::strdup(arg[iarg+4]+2);
|
||||
} else error->all(FLERR,"Argument #{} must be variable not {}", iarg+5, arg[iarg+4]);
|
||||
|
||||
@ -60,10 +60,10 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// required args
|
||||
|
||||
ninsert = utils::inumeric(FLERR,arg[3],false,lmp);
|
||||
ntype = utils::inumeric(FLERR,arg[4],false,lmp);
|
||||
nfreq = utils::inumeric(FLERR,arg[5],false,lmp);
|
||||
seed = utils::inumeric(FLERR,arg[6],false,lmp);
|
||||
ninsert = utils::inumeric(FLERR, arg[3], false, lmp);
|
||||
ntype = utils::expand_type_int(FLERR, arg[4], Atom::ATOM, lmp);
|
||||
nfreq = utils::inumeric(FLERR, arg[5], false, lmp);
|
||||
seed = utils::inumeric(FLERR, arg[6], false, lmp);
|
||||
|
||||
if (seed <= 0) error->all(FLERR,"Illegal fix deposit command");
|
||||
|
||||
|
||||
@ -229,12 +229,16 @@ void Group::assign(int narg, char **arg)
|
||||
else error->all(FLERR,"Illegal group command");
|
||||
|
||||
tagint bound1,bound2;
|
||||
bound1 = utils::tnumeric(FLERR,arg[3],false,lmp);
|
||||
if (category == TYPE)
|
||||
bound1 = (tagint) utils::expand_type_int(FLERR, arg[3], Atom::ATOM, lmp);
|
||||
else bound1 = utils::tnumeric(FLERR, arg[3], false, lmp);
|
||||
bound2 = -1;
|
||||
|
||||
if (condition == BETWEEN) {
|
||||
if (narg != 5) error->all(FLERR,"Illegal group command");
|
||||
bound2 = utils::tnumeric(FLERR,arg[4],false,lmp);
|
||||
if (category == TYPE)
|
||||
bound2 = (tagint) utils::expand_type_int(FLERR, arg[4], Atom::ATOM, lmp);
|
||||
else bound2 = utils::tnumeric(FLERR, arg[4], false, lmp);
|
||||
} else if (narg != 4) error->all(FLERR,"Illegal group command");
|
||||
|
||||
int *attribute = nullptr;
|
||||
@ -304,10 +308,17 @@ void Group::assign(int narg, char **arg)
|
||||
else if (category == MOLECULE) tattribute = atom->molecule;
|
||||
else if (category == ID) tattribute = atom->tag;
|
||||
|
||||
char *typestr = nullptr;
|
||||
tagint start,stop,delta;
|
||||
|
||||
for (int iarg = 2; iarg < narg; iarg++) {
|
||||
delta = 1;
|
||||
if (category == TYPE) {
|
||||
delete[] typestr;
|
||||
typestr = utils::expand_type(FLERR, arg[iarg], Atom::ATOM, lmp);
|
||||
if (typestr) stop = start = utils::tnumeric(FLERR, typestr, false, lmp);
|
||||
}
|
||||
if (typestr == nullptr) {
|
||||
try {
|
||||
ValueTokenizer values(arg[iarg],":");
|
||||
start = values.next_tagint();
|
||||
@ -324,6 +335,7 @@ void Group::assign(int narg, char **arg)
|
||||
}
|
||||
if (delta < 1)
|
||||
error->all(FLERR,"Illegal range increment value");
|
||||
}
|
||||
|
||||
// add to group if attribute matches value or sequence
|
||||
|
||||
@ -337,6 +349,8 @@ void Group::assign(int narg, char **arg)
|
||||
(tattribute[i]-start) % delta == 0) mask[i] |= bit;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] typestr;
|
||||
}
|
||||
|
||||
// style = variable
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include "label_map.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "citeme.h"
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
@ -22,6 +23,19 @@
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
static const char cite_type_label_framework[] =
|
||||
"Type Label Framework: https://doi.org/10.1021/acs.jpcb.3c08419\n\n"
|
||||
"@Article{Gissinger24,\n"
|
||||
" author = {Jacob R. Gissinger, Ilia Nikiforov, Yaser Afshar, Brendon Waters, Moon-ki Choi,"
|
||||
" Daniel S. Karls, Alexander Stukowski, Wonpil Im, Hendrik Heinz, Axel Kohlmeyer, and Ellad B. Tadmor},\n"
|
||||
" title = {Type Label Framework for Bonded Force Fields in LAMMPS},\n"
|
||||
" journal = {J. Phys. Chem. B},\n"
|
||||
" year = 2024,\n"
|
||||
" volume = 128,\n"
|
||||
" number = 13,\n"
|
||||
" pages = {3282–-3297}\n"
|
||||
"}\n\n";
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
LabelMap::LabelMap(LAMMPS *_lmp, int _natomtypes, int _nbondtypes, int _nangletypes,
|
||||
@ -30,6 +44,8 @@ LabelMap::LabelMap(LAMMPS *_lmp, int _natomtypes, int _nbondtypes, int _nanglety
|
||||
natomtypes(_natomtypes), nbondtypes(_nbondtypes), nangletypes(_nangletypes),
|
||||
ndihedraltypes(_ndihedraltypes), nimpropertypes(_nimpropertypes)
|
||||
{
|
||||
if (lmp->citeme) lmp->citeme->add(cite_type_label_framework);
|
||||
|
||||
lmap2lmap.atom = lmap2lmap.bond = lmap2lmap.angle = lmap2lmap.dihedral = lmap2lmap.improper =
|
||||
nullptr;
|
||||
reset_type_labels();
|
||||
|
||||
@ -22,6 +22,8 @@ namespace LAMMPS_NS {
|
||||
|
||||
class LabelMap : protected Pointers {
|
||||
friend class AtomVec;
|
||||
friend class DumpCustom;
|
||||
friend class DumpXYZ;
|
||||
friend class ReadData;
|
||||
|
||||
public:
|
||||
|
||||
54
src/set.cpp
54
src/set.cpp
@ -90,22 +90,16 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
if (strcmp(arg[iarg],"type") == 0) {
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set type", error);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::ATOM,lmp);
|
||||
ivalue = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp);
|
||||
delete[] typestr;
|
||||
}
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1], 1);
|
||||
else ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::ATOM, lmp);
|
||||
set(TYPE);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"type/fraction") == 0) {
|
||||
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set type/fraction", error);
|
||||
char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::ATOM,lmp);
|
||||
newtype = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp);
|
||||
delete[] typestr;
|
||||
fraction = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+3],false,lmp);
|
||||
newtype = utils::expand_type_int(FLERR, arg[iarg+1], Atom::ATOM, lmp);
|
||||
fraction = utils::numeric(FLERR, arg[iarg+2], false, lmp);
|
||||
ivalue = utils::inumeric(FLERR, arg[iarg+3], false, lmp);
|
||||
if (newtype <= 0 || newtype > atom->ntypes)
|
||||
error->all(FLERR,"Invalid type value {} in set type/fraction command", newtype);
|
||||
if (fraction < 0.0 || fraction > 1.0)
|
||||
@ -117,11 +111,9 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"type/ratio") == 0) {
|
||||
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set type/ratio", error);
|
||||
char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::ATOM,lmp);
|
||||
newtype = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp);
|
||||
delete[] typestr;
|
||||
fraction = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+3],false,lmp);
|
||||
newtype = utils::expand_type_int(FLERR, arg[iarg+1], Atom::ATOM, lmp);
|
||||
fraction = utils::numeric(FLERR, arg[iarg+2], false, lmp);
|
||||
ivalue = utils::inumeric(FLERR, arg[iarg+3], false, lmp);
|
||||
if (newtype <= 0 || newtype > atom->ntypes)
|
||||
error->all(FLERR,"Invalid type value {} in set type/ratio command", newtype);
|
||||
if (fraction < 0.0 || fraction > 1.0)
|
||||
@ -133,11 +125,9 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"type/subset") == 0) {
|
||||
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set type/subset", error);
|
||||
char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::ATOM,lmp);
|
||||
newtype = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp);
|
||||
delete[] typestr;
|
||||
nsubset = utils::bnumeric(FLERR,arg[iarg+2],false,lmp);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+3],false,lmp);
|
||||
newtype = utils::expand_type_int(FLERR, arg[iarg+1], Atom::ATOM, lmp);
|
||||
nsubset = utils::bnumeric(FLERR, arg[iarg+2], false, lmp);
|
||||
ivalue = utils::inumeric(FLERR, arg[iarg+3], false, lmp);
|
||||
if (newtype <= 0 || newtype > atom->ntypes)
|
||||
error->all(FLERR,"Invalid type value {} in set type/subset command", newtype);
|
||||
if (nsubset < 0)
|
||||
@ -485,9 +475,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"bond") == 0) {
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set bond", error);
|
||||
char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::BOND,lmp);
|
||||
ivalue = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp);
|
||||
delete[] typestr;
|
||||
ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::BOND, lmp);
|
||||
if (atom->avec->bonds_allow == 0)
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (ivalue <= 0 || ivalue > atom->nbondtypes)
|
||||
@ -497,9 +485,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"angle") == 0) {
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set angle", error);
|
||||
char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::ANGLE,lmp);
|
||||
ivalue = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp);
|
||||
delete[] typestr;
|
||||
ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::ANGLE, lmp);
|
||||
if (atom->avec->angles_allow == 0)
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (ivalue <= 0 || ivalue > atom->nangletypes)
|
||||
@ -509,9 +495,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"dihedral") == 0) {
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set dihedral", error);
|
||||
char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::DIHEDRAL,lmp);
|
||||
ivalue = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp);
|
||||
delete[] typestr;
|
||||
ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::DIHEDRAL, lmp);
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (ivalue <= 0 || ivalue > atom->ndihedraltypes)
|
||||
@ -521,9 +505,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"improper") == 0) {
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set improper", error);
|
||||
char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::IMPROPER,lmp);
|
||||
ivalue = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp);
|
||||
delete[] typestr;
|
||||
ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::IMPROPER, lmp);
|
||||
if (atom->avec->impropers_allow == 0)
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (ivalue <= 0 || ivalue > atom->nimpropertypes)
|
||||
@ -758,11 +740,7 @@ void Set::selection(int n)
|
||||
else select[i] = 0;
|
||||
|
||||
} else if (style == TYPE_SELECT) {
|
||||
if (char *typestr = utils::expand_type(FLERR,id,Atom::ATOM,lmp)) {
|
||||
delete[] id;
|
||||
id = typestr;
|
||||
}
|
||||
utils::bounds(FLERR,id,1,atom->ntypes,nlo,nhi,error);
|
||||
utils::bounds_typelabel(FLERR,id,1,atom->ntypes,nlo,nhi,error,lmp,Atom::ATOM);
|
||||
|
||||
int *type = atom->type;
|
||||
for (int i = 0; i < n; i++)
|
||||
|
||||
@ -604,7 +604,7 @@ void utils::bounds(const char *file, int line, const std::string &str,
|
||||
{
|
||||
nlo = nhi = -1;
|
||||
|
||||
// check for illegal charcters
|
||||
// check for illegal characters
|
||||
size_t found = str.find_first_not_of("*-0123456789");
|
||||
if (found != std::string::npos) {
|
||||
if (error) error->all(file, line, "Invalid range string: {}", str);
|
||||
@ -647,6 +647,30 @@ template void utils::bounds<>(const char *, int, const std::string &,
|
||||
bigint, bigint, long &, long &, Error *);
|
||||
template void utils::bounds<>(const char *, int, const std::string &,
|
||||
bigint, bigint, long long &, long long &, Error *);
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
wrapper for bounds() that accepts type label input
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template <typename TYPE>
|
||||
void utils::bounds_typelabel(const char *file, int line, const std::string &str, bigint nmin,
|
||||
bigint nmax, TYPE &nlo, TYPE &nhi, Error *error, LAMMPS *lmp, int mode)
|
||||
{
|
||||
nlo = nhi = -1;
|
||||
char *typestr;
|
||||
if ( typestr = utils::expand_type(FLERR, str, mode, lmp) )
|
||||
nlo = nhi = utils::inumeric(FLERR, typestr, false, lmp);
|
||||
delete[] typestr;
|
||||
if (nlo > -1) return;
|
||||
else utils::bounds(file, line, str, nmin, nmax, nlo, nhi, error);
|
||||
}
|
||||
|
||||
template void utils::bounds_typelabel<>(const char *, int, const std::string &,
|
||||
bigint, bigint, int &, int &, Error *, LAMMPS *, int);
|
||||
template void utils::bounds_typelabel<>(const char *, int, const std::string &,
|
||||
bigint, bigint, long &, long &, Error *, LAMMPS *, int);
|
||||
template void utils::bounds_typelabel<>(const char *, int, const std::string &,
|
||||
bigint, bigint, long long &, long long &, Error *, LAMMPS *, int);
|
||||
// clang-format on
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
@ -915,6 +939,20 @@ char *utils::expand_type(const char *file, int line, const std::string &str, int
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
Expand type string to integer-valued numeric type from labelmap.
|
||||
Not guaranteed to return a valid type.
|
||||
For example, type <= 0 or type > Ntypes is checked in calling routine.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int utils::expand_type_int(const char *file, int line, const std::string &str, int mode, LAMMPS *lmp)
|
||||
{
|
||||
char *typestr = expand_type(file, line, str, mode, lmp);
|
||||
int out = inumeric(file, line, typestr?typestr:str, false, lmp);
|
||||
delete[] typestr;
|
||||
return out;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Check grid reference for valid Compute or Fix which produces per-grid data
|
||||
errstr = name of calling command used if error is generated
|
||||
|
||||
19
src/utils.h
19
src/utils.h
@ -331,6 +331,19 @@ namespace utils {
|
||||
void bounds(const char *file, int line, const std::string &str, bigint nmin, bigint nmax,
|
||||
TYPE &nlo, TYPE &nhi, Error *error);
|
||||
|
||||
/*! Same as bounds(), but supports type labels
|
||||
*
|
||||
* This functions adds the following case:
|
||||
*
|
||||
* - a single type label, typestr: nlo = nhi = label2type(typestr)
|
||||
*
|
||||
* \param lmp pointer to top-level LAMMPS class instance
|
||||
* \param mode select labelmap using constants from Atom class */
|
||||
|
||||
template <typename TYPE>
|
||||
void bounds_typelabel(const char *file, int line, const std::string &str, bigint nmin, bigint nmax,
|
||||
TYPE &nlo, TYPE &nhi, Error *error, LAMMPS *lmp, int mode);
|
||||
|
||||
/*! Expand list of arguments when containing fix/compute wildcards
|
||||
*
|
||||
* This function searches the list of arguments in *arg* for strings
|
||||
@ -379,6 +392,12 @@ namespace utils {
|
||||
|
||||
char *expand_type(const char *file, int line, const std::string &str, int mode, LAMMPS *lmp);
|
||||
|
||||
/*! Expand type label string into its equivalent integer-valued numeric type
|
||||
*
|
||||
* This function has the same arguments as expand_type() but returns an integer value */
|
||||
|
||||
int expand_type_int(const char *file, int line, const std::string &str, int mode, LAMMPS *lmp);
|
||||
|
||||
/*! Check grid reference for valid Compute or Fix which produces per-grid data
|
||||
*
|
||||
* This function checks if a command argument in the input script
|
||||
|
||||
Reference in New Issue
Block a user