Merge branch 'reset-molecules' into write-bonus-data

This commit is contained in:
Axel Kohlmeyer
2020-07-10 10:25:08 -04:00
34 changed files with 1203 additions and 168 deletions

View File

@ -101,7 +101,8 @@ An alphabetic list of all general LAMMPS commands.
* :doc:`region <region>`
* :doc:`replicate <replicate>`
* :doc:`rerun <rerun>`
* :doc:`reset_ids <reset_ids>`
* :doc:`reset_atom_ids <reset_atom_ids>`
* :doc:`reset_mol_ids <reset_mol_ids>`
* :doc:`reset_timestep <reset_timestep>`
* :doc:`restart <restart>`
* :doc:`run <run>`

View File

@ -88,7 +88,8 @@ Commands
region
replicate
rerun
reset_ids
reset_atom_ids
reset_mol_ids
reset_timestep
restart
run

View File

@ -15,12 +15,18 @@ Syntax
.. parsed-literal::
compute ID group-ID cluster/atom cutoff
compute ID group-ID fragment/atom
compute ID group-ID fragment/atom keyword value ...
compute ID group-ID aggregate/atom cutoff
* ID, group-ID are documented in :doc:`compute <compute>` command
* *cluster/atom* or *fragment/atom* or *aggregate/atom* = style name of this compute command
* cutoff = distance within which to label atoms as part of same cluster (distance units)
* zero or more keyword/value pairs may be appended to *fragment/atom*
* keyword = *single*
.. parsed-literal::
*single* value = *yes* or *no* to treat single atoms (no bonds) as fragments
Examples
""""""""
@ -29,27 +35,36 @@ Examples
compute 1 all cluster/atom 3.5
compute 1 all fragment/atom
compute 1 all fragment/atom single no
compute 1 all aggregate/atom 3.5
Description
"""""""""""
Define a computation that assigns each atom a cluster, fragment,
or aggregate ID.
Define a computation that assigns each atom a cluster, fragment, or
aggregate ID. Only atoms in the compute group are clustered and
assigned cluster IDs. Atoms not in the compute group are assigned an
ID = 0.
A cluster is defined as a set of atoms, each of which is within the
cutoff distance from one or more other atoms in the cluster. If an
atom has no neighbors within the cutoff distance, then it is a 1-atom
cluster.
A fragment is similarly defined as a set of atoms, each of
which has an explicit bond (i.e. defined via a :doc:`data file <read_data>`,
the :doc:`create_bonds <create_bonds>` command, or through fixes like
:doc:`fix bond/create <fix_bond_create>`, :doc:`fix bond/swap <fix_bond_swap>`,
or :doc:`fix bond/break <fix_bond_break>`). The cluster ID or fragment ID
of every atom in the cluster will be set to the smallest atom ID of any atom
in the cluster or fragment, respectively.
A fragment is similarly defined as a set of atoms, each of which has a
bond to another atom in the fragment. Bonds can be defined initially
via the :doc:`data file <read_data>` or :doc:`create_bonds
<create_bonds>` commands, or dynamically by fixes which create or
break bonds like :doc:`fix bond/react <fix_bond_react>`, :doc:`fix
bond/create <fix_bond_create>`, :doc:`fix bond/swap <fix_bond_swap>`,
or :doc:`fix bond/break <fix_bond_break>`. The cluster ID or fragment
ID of every atom in the cluster will be set to the smallest atom ID of
any atom in the cluster or fragment, respectively.
For the *fragment/atom* style, the *single* keyword determines whether
single atoms (not bonded to another atom) are treated as one-atom
fragments or not, based on the *yes* or *no* setting. If the setting
is *no* (the default), their fragment IDs are set to 0.
An aggregate is defined by combining the rules for clusters and
fragments, i.e. a set of atoms, where each of it is within the cutoff
@ -57,19 +72,11 @@ distance from one or more atoms within a fragment that is part of
the same cluster. This measure can be used to track molecular assemblies
like micelles.
Only atoms in the compute group are clustered and assigned cluster
IDs. Atoms not in the compute group are assigned a cluster ID = 0.
For fragments, only bonds where **both** atoms of the bond are included
in the compute group are assigned to fragments, so that only fragments
are detected where **all** atoms are in the compute group. Thus atoms
may be included in the compute group, yes still have a fragment ID of 0.
For computes *cluster/atom* and *aggregate/atom* the neighbor list needed
to compute this quantity is constructed each time the calculation is
performed (i.e. each time a snapshot of atoms is dumped). Thus it can be
inefficient to compute/dump this quantity too frequently or to have
multiple compute/dump commands, each of a *cluster/atom* or
*aggregate/atom* style.
For computes *cluster/atom* and *aggregate/atom* a neighbor list
needed to compute cluster IDs is constructed each time the compute is
invoked. Thus it can be inefficient to compute/dump this quantity too
frequently or to have multiple *cluster/atom* or *aggregate/atom*
style computes.
.. note::
@ -89,6 +96,14 @@ multiple compute/dump commands, each of a *cluster/atom* or
:doc:`special_bonds <special_bonds>` command that includes all pairs in
the neighbor list.
.. note::
For the compute fragment/atom style, each fragment is identified
using the current bond topology. This will not account for bonds
broken by the :doc:`bond_style quartic <bond_quartic>` command
because it does not perform a full update of the bond topology data
structures within LAMMPS.
**Output info:**
This compute calculates a per-atom vector, which can be accessed by
@ -107,4 +122,7 @@ Related commands
:doc:`compute coord/atom <compute_coord_atom>`
**Default:** none
**Default:**
The default for fragment/atom is single no.

View File

@ -89,7 +89,7 @@ number of atoms in the system. Note that this is not done for
molecular systems (see the :doc:`atom_style <atom_style>` command),
regardless of the *compress* setting, since it would foul up the bond
connectivity that has already been assigned. However, the
:doc:`reset_ids <reset_ids>` command can be used after this command to
:doc:`reset_atom_ids <reset_atom_ids>` command can be used after this command to
accomplish the same thing.
Note that the re-assignment of IDs is not really a compression, where
@ -157,7 +157,7 @@ using molecule template files via the :doc:`molecule <molecule>` and
Related commands
""""""""""""""""
:doc:`create_atoms <create_atoms>`, :doc:`reset_ids <reset_ids>`
:doc:`create_atoms <create_atoms>`, :doc:`reset_atom_ids <reset_atom_ids>`
Default
"""""""

View File

@ -1,14 +1,14 @@
.. index:: reset_ids
.. index:: reset_atom_ids
reset_ids command
=================
reset_atom_ids command
======================
Syntax
""""""
.. code-block:: LAMMPS
reset_ids keyword values ...
reset_atom_ids keyword values ...
* zero or more keyword/value pairs may be appended
* keyword = *sort*
@ -22,8 +22,8 @@ Examples
.. code-block:: LAMMPS
reset_ids
reset_ids sort yes
reset_atom_ids
reset_atom_ids sort yes
Description
"""""""""""
@ -77,7 +77,7 @@ processor have consecutive IDs, as the :doc:`create_atoms
that are owned by other processors. The :doc:`comm_modify cutoff <comm_modify>` command can be used to correct this issue.
Or you can define a pair style before using this command. If you do
the former, you should unset the comm_modify cutoff after using
reset_ids so that subsequent communication is not inefficient.
reset_atom_ids so that subsequent communication is not inefficient.
Restrictions
""""""""""""

116
doc/src/reset_mol_ids.rst Normal file
View File

@ -0,0 +1,116 @@
.. index:: reset_mol_ids
reset_mol_ids command
=====================
Syntax
""""""
.. parsed-literal::
reset_mol_ids group-ID keyword value ...
* group-ID = ID of group of atoms whose molecule IDs will be reset
* zero or more keyword/value pairs may be appended
* keyword = *compress* or *offset* or *single*
.. parsed-literal::
*compress* value = *yes* or *no*
*offset* value = *Noffset* >= -1
*single* value = *yes* or *no* to treat single atoms (no bonds) as molecules
Examples
""""""""
.. code-block:: LAMMPS
reset_mol_ids all
reset_mol_ids all offset 10 single yes
reset_mol_ids solvent compress yes offset 100
reset_mol_ids solvent compress no
Description
"""""""""""
Reset molecule IDs for a group of atoms based on current bond
connectivity. This will typically create a new set of molecule IDs
for atoms in the group. Only molecule IDs for atoms in the specified
group are reset; molecule IDs for atoms not in the group are not
changed.
For purposes of this operation, molecules are identified by the current
bond connectivity in the system, which may or may not be consistent with
the current molecule IDs. A molecule in this context is a set of atoms
connected to each other with explicit bonds. The specific algorithm
used is the one of :doc:`compute fragment/atom <compute_cluster_atom>`
Once the molecules are identified and a new molecule ID computed for
each, this command will update the current molecule ID for all atoms in
the group with the new molecule ID. Note that if the group excludes
atoms within molecules, one (physical) molecule may become two or more
(logical) molecules. For example if the group excludes atoms in the
middle of a linear chain, then each end of the chain is considered an
independent molecule and will be assigned a different molecule ID.
This can be a useful operation to perform after running reactive
molecular dynamics run with :doc:`fix bond/react <fix_bond_react>`,
:doc:`fix bond/create <fix_bond_create>`, or :doc:`fix bond/break
<fix_bond_break>`, all of which can change molecule topologies. It can
also be useful after molecules have been deleted with the
:doc:`delete_atoms <delete_atoms>` command or after a simulation which
has lost molecules, e.g. via the :doc:`fix evaporate <fix_evaporate>`
command.
The *compress* keyword determines how new molecule IDs are computed. If
the setting is *yes* (the default) and there are N molecules in the
group, the new molecule IDs will be a set of N contiguous values. See
the *offset* keyword for details on selecting the range of these values.
If the setting is *no*, the molecule ID of every atom in the molecule
will be set to the smallest atom ID of any atom in the molecule.
The *single* keyword determines whether single atoms (not bonded to
another atom) are treated as one-atom molecules or not, based on the
*yes* or *no* setting. If the setting is *no* (the default), their
molecule IDs are set to 0. This setting can be important if the new
molecule IDs will be used as input to other commands such as
:doc:`compute chunk/atom molecule <compute_chunk_atom>` or :doc:`fix
rigid molecule <fix_rigid>`.
The *offset* keyword is only used if the *compress* setting is *yes*.
Its default value is *Noffset* = -1. In that case, if the specified
group is *all*, then the new compressed molecule IDs will range from 1
to N. If the specified group is not *all* and the largest molecule ID
of atoms outside that group is M, then the new compressed molecule IDs will
range from M+1 to M+N, to avoid collision with existing molecule
IDs. If an *Noffset* >= 0 is specified, then the new compressed
molecule IDs will range from *Noffset*\ +1 to *Noffset*\ +N. If the group
is not *all* there may be collisions with the molecule IDs of other atoms.
.. note::
The same as explained for the :doc:`compute fragment/atom
<compute_cluster_atom>` command, molecules are identified using the
current bond topology. This will not account for bonds broken by
the :doc:`bond_style quartic <bond_quartic>` command because it
does not perform a full update of the bond topology data structures
within LAMMPS.
Restrictions
""""""""""""
none
Related commands
""""""""""""""""
:doc:`reset_atom_ids <reset_atom_ids>`, :doc:`fix bond/react <fix_bond_react>`,
:doc:`fix bond/create <fix_bond_create>`,
:doc:`fix bond/break <fix_bond_break>`,
:doc:`fix evaporate <fix_evaporate>`,
:doc:`delete_atoms <delete_atoms>`,
:doc:`compute fragment/atom <compute_cluster_atom>`
Default
"""""""
The default keyword settings are compress = yes, single = no, and
offset = -1.