Unverified Commit 006f7956 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

Merge remote-tracking branch 'github/reset-ids-sort' into move-ubuf-to-lmptype

parents fc9bbd4d e4d1068c
Loading
Loading
Loading
Loading
+40 −8
Original line number Diff line number Diff line
@@ -8,7 +8,14 @@ Syntax

.. code-block:: LAMMPS

   reset_ids
   reset_ids keyword values ...

* zero or more keyword/value pairs may be appended
* keyword = *sort*

  .. parsed-literal::

        *sort* value = *yes* or *no*

   Examples
""""""""
@@ -16,6 +23,7 @@ Examples
.. code-block:: LAMMPS

   reset_ids
   reset_ids sort yes

Description
"""""""""""
@@ -33,11 +41,32 @@ e.g. due to atoms moving outside a simulation box with fixed
boundaries (see the "boundary command"), or due to evaporation (see
the "fix evaporate" command).

Note that the resetting of IDs is not really a compression, where gaps
in atom IDs are removed by decrementing atom IDs that are larger.
Instead the IDs for all atoms are erased, and new IDs are assigned so
that the atoms owned by an individual processor have consecutive IDs,
as the :doc:`create_atoms <create_atoms>` command explains.
If the *sort* keyword is used with a setting of *yes*, then the
assignment of new atom IDs will be the same no matter how many
processors LAMMPS is running on.  This is done by first doing a
spatial sort of all the atoms into bins and sorting them within each
bin.  Because the set of bins is independent of the number of
processors, this enables a consistent assignment of new IDs to each
atom.

This can be useful to do after using the "create_atoms" command and/or
"replicate" command.  In general those commands do not guarantee
assignment of the same atom ID to the same physical atom when LAMMPS
is run on different numbers of processors.  Enforcing consistent IDs
can be useful for debugging or comparing output from two different
runs.

Note that the spatial sort requires communication of atom IDs and
coordinates bewteen processors in an all-to-all manner.  This is done
efficiently in LAMMPS, but it is more expensive than how atom IDs are
reset without sorting.

Note that whether sorting or not, the resetting of IDs is not a
compression, where gaps in atom IDs are removed by decrementing atom
IDs that are larger.  Instead the IDs for all atoms are erased, and
new IDs are assigned so that the atoms owned by an individual
processor have consecutive IDs, as the :doc:`create_atoms
<create_atoms>` command explains.

.. note::

@@ -59,4 +88,7 @@ Related commands

:doc:`delete_atoms <delete_atoms>`

**Default:** none
Default
"""""""

By default, *sort* is no.
+2 −1
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
  create_attribute = 1;
  dof_flag = 1;
  enforce2d_flag = 1;
  stores_ids = 1;
  
  MPI_Comm_rank(world,&me);
  MPI_Comm_size(world,&nprocs);
+2 −1
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) :
  thermo_virial = 1;
  create_attribute = 1;
  dof_flag = 1;
  stores_ids = 1;
  
  // error check

+2 −1
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ Fix::Fix(LAMMPS *lmp, int /*narg*/, char **arg) :
  maxexchange = 0;
  maxexchange_dynamic = 0;
  pre_exchange_migrate = 0;
  stores_ids = 0;
  
  scalar_flag = vector_flag = array_flag = 0;
  peratom_flag = local_flag = 0;
+1 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ class Fix : protected Pointers {
  int maxexchange;               // max # of per-atom values for Comm::exchange()
  int maxexchange_dynamic;       // 1 if fix sets maxexchange dynamically
  int pre_exchange_migrate;      // 1 if fix migrates atoms in pre_exchange()
  int stores_ids;                 // 1 if fix stores atom IDs

  int scalar_flag;               // 0/1 if compute_scalar() function exists
  int vector_flag;               // 0/1 if compute_vector() function exists
Loading