doc page for new command
This commit is contained in:
@ -46,6 +46,7 @@ KOKKOS, o = OPENMP, t = OPT.
|
||||
* :doc:`com/chunk <compute_com_chunk>`
|
||||
* :doc:`contact/atom <compute_contact_atom>`
|
||||
* :doc:`coord/atom (k) <compute_coord_atom>`
|
||||
* :doc:`count/type <compute_count_type>`
|
||||
* :doc:`damage/atom <compute_damage_atom>`
|
||||
* :doc:`dihedral <compute_dihedral>`
|
||||
* :doc:`dihedral/local <compute_dihedral_local>`
|
||||
|
||||
@ -32,13 +32,13 @@ Set the formula(s) LAMMPS uses to compute bond interactions between
|
||||
pairs of atoms. In LAMMPS, a bond differs from a pairwise
|
||||
interaction, which are set via the :doc:`pair_style <pair_style>`
|
||||
command. Bonds are defined between specified pairs of atoms and
|
||||
remain in force for the duration of the simulation (unless the bond
|
||||
breaks which is possible in some bond potentials). The list of bonded
|
||||
atoms is read in by a :doc:`read_data <read_data>` or
|
||||
:doc:`read_restart <read_restart>` command from a data or restart file.
|
||||
By contrast, pair potentials are typically defined between all pairs
|
||||
of atoms within a cutoff distance and the set of active interactions
|
||||
changes over time.
|
||||
remain in force for the duration of the simulation (unless new bonds
|
||||
are created or existing bonds break, which is possible in some fixes
|
||||
and bond potentials). The list of bonded atoms is read in by a
|
||||
:doc:`read_data <read_data>` or :doc:`read_restart <read_restart>`
|
||||
command from a data or restart file. By contrast, pair potentials are
|
||||
typically defined between all pairs of atoms within a cutoff distance
|
||||
and the set of active interactions changes over time.
|
||||
|
||||
Hybrid models where bonds are computed using different bond potentials
|
||||
can be setup using the *hybrid* bond style.
|
||||
|
||||
@ -200,6 +200,7 @@ The individual style names on the :doc:`Commands compute <Commands_compute>` pag
|
||||
* :doc:`com/chunk <compute_com_chunk>` - center of mass for each chunk
|
||||
* :doc:`contact/atom <compute_contact_atom>` - contact count for each spherical particle
|
||||
* :doc:`coord/atom <compute_coord_atom>` - coordination number for each atom
|
||||
* :doc:`count/type <compute_count_type>` - count of atoms or bonds by type
|
||||
* :doc:`damage/atom <compute_damage_atom>` - Peridynamic damage for each atom
|
||||
* :doc:`dihedral <compute_dihedral>` - energy of each dihedral sub-style
|
||||
* :doc:`dihedral/local <compute_dihedral_local>` - angle of each dihedral
|
||||
|
||||
89
doc/src/compute_count_type.rst
Normal file
89
doc/src/compute_count_type.rst
Normal file
@ -0,0 +1,89 @@
|
||||
.. index:: compute count/type
|
||||
|
||||
compute count/type command
|
||||
====================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID count/type mode
|
||||
|
||||
* ID, group-ID are documented in :doc:`compute <compute>` command
|
||||
* count/type = style name of this compute command
|
||||
* mode = {atom} or {bond}
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute 1 all count/type atom
|
||||
compute 1 flowmols count/type bond
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
Define a computation that counts the current number of atoms by atom
|
||||
type or the number of bonds by bond type. The latter can be useful in
|
||||
reactive simulations where bonds are broken or created.
|
||||
|
||||
Note that for this command, bonds are the topological kind enumerated
|
||||
in a data file, initially read by the :doc:`read_data <read_data>`
|
||||
command. They do not refer to bonds defined on-the-fly by bond-order
|
||||
or reactive pair styles.
|
||||
|
||||
These commands can create and break toplogical bonds:
|
||||
|
||||
* :doc:`fix bond/react <fix_bond_react>`
|
||||
* :doc:`fix bond/create <fix_bond_create>`
|
||||
* :doc:`fix bond/break <fix_bond_break>`
|
||||
* :doc:`bond_style quartic <bond_quartic>`
|
||||
* :doc:`BPM package <Howto_bpm>` bond styles
|
||||
|
||||
If the {mode} setting is {atom} then the count of atoms for each atom
|
||||
type is tallied. Only atoms in the specified group are counted.
|
||||
|
||||
If the {mode} setting is {bond} then the count of bonds for each bond
|
||||
type is tallied. Only bonds with both atoms in the specified group
|
||||
are counted.
|
||||
|
||||
For {mode} = {bond}, broken bonds with a bond type or zero are also
|
||||
counted. Some commands flag broken bonds by setting their bond type
|
||||
to zero. See the :doc:`Howto broken bonds <Howto_broken_bonds>` doc
|
||||
page for details. Note that the group setting is ignored for broken
|
||||
bonds; all broken bonds in the system are counted.
|
||||
|
||||
----------
|
||||
|
||||
Output info
|
||||
"""""""""""
|
||||
|
||||
This compute calculates a global vector of counts. If the mode is
|
||||
{atom}, the vector length is the number of atom types. If the mode is
|
||||
{bond}, the vector length is the number of bond types.
|
||||
|
||||
If the mode is {bond} this compute also calculates a global scalar which
|
||||
counts the number of broken bonds.
|
||||
|
||||
These values can be used by any command that uses global scalar or
|
||||
vector values from a compute as input. See the :doc:`Howto output
|
||||
<Howto_output>` page for an overview of LAMMPS output options.
|
||||
|
||||
The scalar and vector values calculated by this compute are "extensive".
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
none
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
none
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
none
|
||||
@ -83,6 +83,8 @@ double ComputeCountType::compute_scalar()
|
||||
int nbond;
|
||||
int count = 0;
|
||||
|
||||
// NOTE: respect group setting
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
nbond = num_bond[i];
|
||||
for (int m = 0; m < nbond; m++)
|
||||
@ -113,6 +115,8 @@ void ComputeCountType::compute_vector()
|
||||
|
||||
// count atoms by type
|
||||
|
||||
// NOTE: respect group setting
|
||||
|
||||
if (mode == ATOM) {
|
||||
int *type = atom->type;
|
||||
int nlocal = atom->nlocal;
|
||||
@ -128,6 +132,8 @@ void ComputeCountType::compute_vector()
|
||||
// skip type = 0 bonds, they are counted by compute_scalar
|
||||
// bond types can be negative for SHAKE
|
||||
|
||||
// NOTE: respect group setting
|
||||
|
||||
else if (mode == BOND) {
|
||||
int *num_bond = atom->num_bond;
|
||||
int **bond_type = atom->bond_type;
|
||||
|
||||
Reference in New Issue
Block a user