diff --git a/doc/src/Commands_all.rst b/doc/src/Commands_all.rst index 01cb6812fc..54108f5948 100644 --- a/doc/src/Commands_all.rst +++ b/doc/src/Commands_all.rst @@ -89,8 +89,7 @@ table above. * :doc:`region ` * :doc:`replicate ` * :doc:`rerun ` - * :doc:`reset_atom_ids ` - * :doc:`reset_mol_ids ` + * :doc:`reset_atoms ` * :doc:`reset_timestep ` * :doc:`restart ` * :doc:`run ` diff --git a/doc/src/Commands_removed.rst b/doc/src/Commands_removed.rst index 20698e2708..8f5219fe8f 100644 --- a/doc/src/Commands_removed.rst +++ b/doc/src/Commands_removed.rst @@ -26,10 +26,15 @@ Box command The *box* command has been removed and the LAMMPS code changed so it won't be needed. If present, LAMMPS will ignore the command and print a warning. -Reset_ids command ------------------ +Reset_ids, reset_atom_ids, reset_mol_ids commands +------------------------------------------------- -The reset_ids command has been renamed to :doc:`reset_atom_ids `. +.. deprecated:: TBD + +The *reset_ids*, *reset_atom_ids*, and *reset_mol_ids* commands have +been folded into the :doc:`reset_atoms ` command. If +present, LAMMPS will replace the commands accordingly and print a +warning. MEAM package ------------ @@ -39,18 +44,21 @@ The code in the :ref:`MEAM package ` is a translation of the Fortran code of MEAM into C++, which removes several restrictions (e.g. there can be multiple instances in hybrid pair styles) and allows for some optimizations leading to better performance. The pair style -:doc:`meam ` has the exact same syntax. +:doc:`meam ` has the exact same syntax. For a transition +period the C++ version of MEAM was called USER-MEAMC so it could +coexist with the Fortran version. REAX package ------------ The REAX package has been removed since it was superseded by the -:ref:`REAXFF package `. The REAXFF -package has been tested to yield equivalent results to the REAX package, -offers better performance, supports OpenMP multi-threading via OPENMP, -and GPU and threading parallelization through KOKKOS. The new pair styles -are not syntax compatible with the removed reax pair style, so input -files will have to be adapted. +:ref:`REAXFF package `. The REAXFF package has been tested +to yield equivalent results to the REAX package, offers better +performance, supports OpenMP multi-threading via OPENMP, and GPU and +threading parallelization through KOKKOS. The new pair styles are not +syntax compatible with the removed reax pair style, so input files will +have to be adapted. The REAXFF package was originally called +USER-REAXC. USER-CUDA package ----------------- @@ -69,5 +77,6 @@ restart2data tool The functionality of the restart2data tool has been folded into the LAMMPS executable directly instead of having a separate tool. A combination of the commands :doc:`read_restart ` and -:doc:`write_data ` can be used to the same effect. For added -convenience this conversion can also be triggered by :doc:`command line flags ` +:doc:`write_data ` can be used to the same effect. For +added convenience this conversion can also be triggered by +:doc:`command line flags ` diff --git a/doc/src/Developer_unittest.rst b/doc/src/Developer_unittest.rst index 820e911a8f..aff6128e9c 100644 --- a/doc/src/Developer_unittest.rst +++ b/doc/src/Developer_unittest.rst @@ -226,9 +226,9 @@ The following test programs are currently available: * - ``test_kim_commands.cpp`` - KimCommands - Tests for several commands from the :ref:`KIM package ` - * - ``test_reset_ids.cpp`` - - ResetIDs - - Tests to validate the :doc:`reset_atom_ids ` and :doc:`reset_mol_ids ` commands + * - ``test_reset_atoms.cpp`` + - ResetAtoms + - Tests to validate the :doc:`reset_atoms ` sub-commands Tests for the C-style library interface diff --git a/doc/src/commands_list.rst b/doc/src/commands_list.rst index 571b569213..9adc397138 100644 --- a/doc/src/commands_list.rst +++ b/doc/src/commands_list.rst @@ -89,8 +89,7 @@ Commands region replicate rerun - reset_atom_ids - reset_mol_ids + reset_atoms reset_timestep restart run diff --git a/doc/src/delete_atoms.rst b/doc/src/delete_atoms.rst index 2fdd152196..c863d0c7d2 100644 --- a/doc/src/delete_atoms.rst +++ b/doc/src/delete_atoms.rst @@ -135,7 +135,7 @@ number of atoms in the system. Note that this is not done for molecular systems (see the :doc:`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_atom_ids ` command can be used after this +:doc:`reset_atoms id ` 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 @@ -203,7 +203,7 @@ using molecule template files via the :doc:`molecule ` and Related commands """""""""""""""" -:doc:`create_atoms `, :doc:`reset_atom_ids ` +:doc:`create_atoms `, :doc:`reset_atoms id ` Default """"""" diff --git a/doc/src/fix_bond_react.rst b/doc/src/fix_bond_react.rst index 665dce5105..4377d9d946 100644 --- a/doc/src/fix_bond_react.rst +++ b/doc/src/fix_bond_react.rst @@ -177,12 +177,12 @@ due to the internal dynamic grouping performed by fix bond/react. If the group-ID is an existing static group, react-group-IDs should also be specified as this static group or a subset. -The *reset_mol_ids* keyword invokes the :doc:`reset_mol_ids ` -command after a reaction occurs, to ensure that molecule IDs are -consistent with the new bond topology. The group-ID used for -:doc:`reset_mol_ids ` is the group-ID for this fix. -Resetting molecule IDs is necessarily a global operation, so it can -be slow for very large systems. +The *reset_mol_ids* keyword invokes the :doc:`reset_atoms mol +` command after a reaction occurs, to ensure that +molecule IDs are consistent with the new bond topology. The group-ID +used for :doc:`reset_atoms mol ` is the group-ID for this +fix. Resetting molecule IDs is necessarily a global operation, so it +can be slow for very large systems. The following comments pertain to each *react* argument (in other words, they can be customized for each reaction, or reaction step): diff --git a/doc/src/reset_atom_ids.rst b/doc/src/reset_atom_ids.rst deleted file mode 100644 index e83d65d546..0000000000 --- a/doc/src/reset_atom_ids.rst +++ /dev/null @@ -1,94 +0,0 @@ -.. index:: reset_atom_ids - -reset_atom_ids command -====================== - -Syntax -"""""" - -.. code-block:: LAMMPS - - reset_atom_ids keyword values ... - - * zero or more keyword/value pairs may be appended - * keyword = *sort* - -.. parsed-literal:: - - *sort* value = *yes* or *no* - -Examples -"""""""" - -.. code-block:: LAMMPS - - reset_atom_ids - reset_atom_ids sort yes - -Description -""""""""""" - -Reset atom IDs for the system, including all the global IDs stored -for bond, angle, dihedral, improper topology data. This will -create a set of IDs that are numbered contiguously from 1 to N -for a N atoms system. - -This can be useful to do after performing a "delete_atoms" command for -a molecular system. The delete_atoms compress yes option will not -perform this operation due to the existence of bond topology. It can -also be useful to do after any simulation which has lost atoms, -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). - -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 between 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 -` command explains. - -.. note:: - - If this command is used before a :doc:`pair style ` is - defined, an error about bond topology atom IDs not being found may - result. This is because the cutoff distance for ghost atom - communication was not sufficient to find atoms in bonds, angles, etc - that are owned by other processors. The :doc:`comm_modify cutoff ` 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_atom_ids so that subsequent communication is not inefficient. - -Restrictions -"""""""""""" -none - -Related commands -"""""""""""""""" - -:doc:`delete_atoms ` - -Default -""""""" - -By default, *sort* is no. diff --git a/doc/src/reset_atoms.rst b/doc/src/reset_atoms.rst new file mode 100644 index 0000000000..8643eaf725 --- /dev/null +++ b/doc/src/reset_atoms.rst @@ -0,0 +1,283 @@ +.. index:: reset_atoms + +reset_atoms command +=================== + +Syntax +"""""" + +.. code-block:: LAMMPS + + reset_atoms property arguments ... + +* property = *id* or *image* or *mol* +* additional arguments depend on the property + + .. code-block:: LAMMPS + + reset_atoms id keyword value ... + + * zero or more keyword/value pairs can be appended + * keyword = *sort* + + .. parsed-literal:: + + *sort* value = *yes* or *no* + + .. code-block:: LAMMPS + + reset_atoms image group-ID + + * group-ID = ID of group of atoms whose image flags will be reset + + .. code-block:: LAMMPS + + reset atoms mol group-ID keyword value ... + + * group-ID = ID of group of atoms whose molecule IDs will be reset + * zero or more keyword/value pairs can 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_atoms id + reset_atoms id sort yes + reset_atoms image all + reset_atoms image mobile + reset_atoms mol all + reset_atoms mol all offset 10 single yes + reset_atoms mol solvent compress yes offset 100 + reset_atoms mol solvent compress no + + +Description +""""""""""" + +.. versionadded:: TBD + +The *reset_atoms* command resets the values of a specified atom +property. In contrast to the set command, it does this in a +collective manner which resets the values for many atoms in a +self-consistent way. This is often useful when the simulated system +has undergone significant modifications like adding or removing atoms +or molecules, joining data files, changing bonds, or large-scale +diffusion. + +The new values can be thought of as a *reset*, similar to values atoms +would have if a new data file were being read or a new simulation +performed. Note that the set command also resets atom properties to +new values, but it treats each atom independently. + +The *property* setting can be *id* or *image* or *mol*. For *id*, the +IDs of all the atoms are reset to contiguous values. For *image*, the +image flags of atoms in the specified *group-ID* are reset so that at +least one atom in each molecule is in the simulation box (image flag = +0). For *mol*, the molecule IDs of all atoms are reset to contiguous +values. + +More details on these operations and their arguments or optional +keyword/value settings are given below. + +---------- + +*Property id* + +Reset atom IDs for the entire system, including all the global IDs +stored for bond, angle, dihedral, improper topology data. This will +create a set of IDs that are numbered contiguously from 1 to N for a N +atoms system. + +This can be useful to do after performing a "delete_atoms" command for +a molecular system. The delete_atoms compress yes option will not +perform this operation due to the existence of bond topology. It can +also be useful to do after any simulation which has lost atoms, +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). + +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 between 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 +` command explains. + +.. note:: + + If this command is used before a :doc:`pair style ` is + defined, an error about bond topology atom IDs not being found may + result. This is because the cutoff distance for ghost atom + communication was not sufficient to find atoms in bonds, angles, etc + that are owned by other processors. The :doc:`comm_modify cutoff + ` 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 + atoms id* so that subsequent communication is not inefficient. + +---------- + +*Property image* + +Reset the image flags of atoms so that at least one atom in each +molecule has an image flag of 0. Molecular topology is respected so +that if the molecule straddles a periodic simulation box boundary, the +images flags of all atoms in the molecule will be consistent. This +avoids inconsistent image flags that could result from resetting all +image flags to zero with the :doc:`set ` command. + +.. note:: + + If the system has no bonds, there is no reason to use this command, + since image flags for different atoms do not need to be + consistent. Use the :doc:`set ` command with its *image* + keyword instead. + +Only image flags for atoms in the specified *group-ID* are reset; all +others remain unchanged. No check is made for whether the group +covers complete molecule fragments and thus whether the command will +result in inconsistent image flags. + +Molecular fragments are identified by the algorithm used by the +:doc:`compute fragment/atom ` command. For each +fragment the average of the largest and the smallest image flag in +each direction across all atoms in the fragment is computed and +subtracted from the current image flag in the same direction. + +This can be a useful operation to perform after running longer +equilibration runs of mobile systems where molecules would pass +through the system multiple times and thus produce non-zero image +flags. + +.. note:: + + Same as explained for the :doc:`compute fragment/atom + ` command, molecules are identified using the + current bond topology. This will **not** account for bonds broken by + the :doc:`bond_style quartic ` command, because this + bond style does not perform a full update of the bond topology data + structures within LAMMPS. In that case, using the :doc:`delete_bonds + all bond 0 remove ` will permanently delete such + broken bonds and should thus be used first. + +---------- + +*Property mol* + +Reset molecule IDs for a specified 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-ID* 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 ` +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 `, +:doc:`fix bond/create `, or :doc:`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 ` command or after a simulation which +has lost molecules, e.g. via the :doc:`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 ` or :doc:`fix +rigid molecule `. + +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:: + + Same as explained for the :doc:`compute fragment/atom + ` command, molecules are identified using the + current bond topology. This will **not** account for bonds broken by + the :doc:`bond_style quartic ` command, because this + bond style does not perform a full update of the bond topology data + structures within LAMMPS. In that case, using the :doc:`delete_bonds + all bond 0 remove ` will permanently delete such broken + bonds and should thus be used first. + + +Restrictions +"""""""""""" + +The *image* property can only be used when the atom style supports bonds. + +Related commands +"""""""""""""""" + +:doc:`compute fragment/atom ` +:doc:`fix bond/react `, +:doc:`fix bond/create `, +:doc:`fix bond/break `, +:doc:`fix evaporate `, +:doc:`delete_atoms `, +:doc:`delete_bonds ` + +Defaults +"""""""" + +For property *id*, the default keyword setting is sort = no. + +For property *mol*, the default keyword settings are compress = yes, +single = no, and offset = -1. diff --git a/doc/src/reset_mol_ids.rst b/doc/src/reset_mol_ids.rst deleted file mode 100644 index 0d6063b3ef..0000000000 --- a/doc/src/reset_mol_ids.rst +++ /dev/null @@ -1,116 +0,0 @@ -.. 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 ` -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 `, -:doc:`fix bond/create `, or :doc:`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 ` command or after a simulation which -has lost molecules, e.g. via the :doc:`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 ` or :doc:`fix -rigid molecule `. - -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 - ` command, molecules are identified using the - current bond topology. This will not account for bonds broken by - the :doc:`bond_style 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 `, :doc:`fix bond/react `, -:doc:`fix bond/create `, -:doc:`fix bond/break `, -:doc:`fix evaporate `, -:doc:`delete_atoms `, -:doc:`compute fragment/atom ` - -Default -""""""" - -The default keyword settings are compress = yes, single = no, and -offset = -1. diff --git a/src/KOKKOS/fix_neigh_history_kokkos.cpp b/src/KOKKOS/fix_neigh_history_kokkos.cpp index 4a652783af..390976dd79 100644 --- a/src/KOKKOS/fix_neigh_history_kokkos.cpp +++ b/src/KOKKOS/fix_neigh_history_kokkos.cpp @@ -20,6 +20,7 @@ #include "modify.h" #include "neigh_list_kokkos.h" #include "pair_kokkos.h" +#include "atom_masks.h" using namespace LAMMPS_NS; @@ -170,6 +171,7 @@ template void FixNeighHistoryKokkos::post_neighbor() { tag = atomKK->k_tag.view(); + atomKK->sync(execution_space,TAG_MASK); k_firstflag.sync(); k_firstvalue.sync(); diff --git a/src/KOKKOS/pair_adp_kokkos.cpp b/src/KOKKOS/pair_adp_kokkos.cpp index 8817e1fc9f..3873f1e31b 100644 --- a/src/KOKKOS/pair_adp_kokkos.cpp +++ b/src/KOKKOS/pair_adp_kokkos.cpp @@ -111,7 +111,6 @@ void PairADPKokkos::compute(int eflag_in, int vflag_in) x = atomKK->k_x.view(); f = atomKK->k_f.view(); type = atomKK->k_type.view(); - tag = atomKK->k_tag.view(); nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; newton_pair = force->newton_pair; diff --git a/src/KOKKOS/pair_adp_kokkos.h b/src/KOKKOS/pair_adp_kokkos.h index 15e08cdb89..5714bdb699 100644 --- a/src/KOKKOS/pair_adp_kokkos.h +++ b/src/KOKKOS/pair_adp_kokkos.h @@ -120,7 +120,6 @@ class PairADPKokkos : public PairADP, public KokkosBase typename AT::t_x_array x; typename AT::t_f_array f; typename AT::t_int_1d type; - typename AT::t_tagint_1d tag; DAT::tdual_efloat_1d k_eatom; DAT::tdual_virial_array k_vatom; diff --git a/src/KOKKOS/pair_buck_kokkos.cpp b/src/KOKKOS/pair_buck_kokkos.cpp index 3a6200a7e2..8e69536b38 100644 --- a/src/KOKKOS/pair_buck_kokkos.cpp +++ b/src/KOKKOS/pair_buck_kokkos.cpp @@ -98,7 +98,6 @@ void PairBuckKokkos::compute(int eflag_in, int vflag_in) c_x = atomKK->k_x.view(); f = atomKK->k_f.view(); type = atomKK->k_type.view(); - tag = atomKK->k_tag.view(); nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; newton_pair = force->newton_pair; diff --git a/src/KOKKOS/pair_buck_kokkos.h b/src/KOKKOS/pair_buck_kokkos.h index c6518b1fae..364716453b 100644 --- a/src/KOKKOS/pair_buck_kokkos.h +++ b/src/KOKKOS/pair_buck_kokkos.h @@ -74,7 +74,6 @@ class PairBuckKokkos : public PairBuck { typename AT::t_x_array c_x; typename AT::t_f_array f; typename AT::t_int_1d_randomread type; - typename AT::t_tagint_1d tag; DAT::tdual_efloat_1d k_eatom; DAT::tdual_virial_array k_vatom; diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index 3aeba1c9bf..0be0dffd93 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -110,7 +110,6 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) x = atomKK->k_x.view(); f = atomKK->k_f.view(); type = atomKK->k_type.view(); - tag = atomKK->k_tag.view(); nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; newton_pair = force->newton_pair; diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.h b/src/KOKKOS/pair_eam_alloy_kokkos.h index 1e936a7574..c6cb73ca5d 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.h +++ b/src/KOKKOS/pair_eam_alloy_kokkos.h @@ -119,7 +119,6 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { typename AT::t_x_array x; typename AT::t_f_array f; typename AT::t_int_1d type; - typename AT::t_tagint_1d tag; DAT::tdual_efloat_1d k_eatom; DAT::tdual_virial_array k_vatom; diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index bd4bb2a373..bf0f398e60 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -110,7 +110,6 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) x = atomKK->k_x.view(); f = atomKK->k_f.view(); type = atomKK->k_type.view(); - tag = atomKK->k_tag.view(); nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; newton_pair = force->newton_pair; diff --git a/src/KOKKOS/pair_eam_fs_kokkos.h b/src/KOKKOS/pair_eam_fs_kokkos.h index f96380ed30..06a395cba7 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.h +++ b/src/KOKKOS/pair_eam_fs_kokkos.h @@ -119,7 +119,6 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { typename AT::t_x_array x; typename AT::t_f_array f; typename AT::t_int_1d type; - typename AT::t_tagint_1d tag; DAT::tdual_efloat_1d k_eatom; DAT::tdual_virial_array k_vatom; diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index 9928d6a655..6e1cd1feea 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -105,7 +105,6 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) x = atomKK->k_x.view(); f = atomKK->k_f.view(); type = atomKK->k_type.view(); - tag = atomKK->k_tag.view(); nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; newton_pair = force->newton_pair; diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 867908bb6b..006dceb1f2 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -115,7 +115,6 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { typename AT::t_x_array x; typename AT::t_f_array f; typename AT::t_int_1d type; - typename AT::t_tagint_1d tag; DAT::tdual_efloat_1d k_eatom; DAT::tdual_virial_array k_vatom; diff --git a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp index 11c2b651f9..2cfbbf0ee7 100644 --- a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp +++ b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp @@ -134,7 +134,6 @@ void PairGranHookeHistoryKokkos::compute(int eflag_in, int vflag_in) torque = atomKK->k_torque.view(); type = atomKK->k_type.view(); mask = atomKK->k_mask.view(); - tag = atomKK->k_tag.view(); rmass = atomKK->k_rmass.view(); radius = atomKK->k_radius.view(); nlocal = atom->nlocal; diff --git a/src/KOKKOS/pair_gran_hooke_history_kokkos.h b/src/KOKKOS/pair_gran_hooke_history_kokkos.h index d7477b066d..ef068e970a 100644 --- a/src/KOKKOS/pair_gran_hooke_history_kokkos.h +++ b/src/KOKKOS/pair_gran_hooke_history_kokkos.h @@ -86,7 +86,6 @@ class PairGranHookeHistoryKokkos : public PairGranHookeHistory { DAT::tdual_virial_array k_vatom; typename AT::t_efloat_1d d_eatom; typename AT::t_virial_array d_vatom; - typename AT::t_tagint_1d tag; typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d_randomread d_ilist; diff --git a/src/KOKKOS/pair_lj_class2_kokkos.cpp b/src/KOKKOS/pair_lj_class2_kokkos.cpp index dbb95b99ab..d37a190b6c 100644 --- a/src/KOKKOS/pair_lj_class2_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_kokkos.cpp @@ -99,7 +99,6 @@ void PairLJClass2Kokkos::compute(int eflag_in, int vflag_in) c_x = atomKK->k_x.view(); f = atomKK->k_f.view(); type = atomKK->k_type.view(); - tag = atomKK->k_tag.view(); nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; newton_pair = force->newton_pair; diff --git a/src/KOKKOS/pair_lj_class2_kokkos.h b/src/KOKKOS/pair_lj_class2_kokkos.h index 073c6f38d6..0936399ca8 100644 --- a/src/KOKKOS/pair_lj_class2_kokkos.h +++ b/src/KOKKOS/pair_lj_class2_kokkos.h @@ -80,7 +80,6 @@ class PairLJClass2Kokkos : public PairLJClass2 { typename AT::t_x_array c_x; typename AT::t_f_array f; typename AT::t_int_1d_randomread type; - typename AT::t_tagint_1d tag; DAT::tdual_efloat_1d k_eatom; DAT::tdual_virial_array k_vatom; diff --git a/src/KOKKOS/pair_lj_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_kokkos.cpp index e818375762..c6353cc083 100644 --- a/src/KOKKOS/pair_lj_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_kokkos.cpp @@ -94,7 +94,6 @@ void PairLJCutKokkos::compute(int eflag_in, int vflag_in) c_x = atomKK->k_x.view(); f = atomKK->k_f.view(); type = atomKK->k_type.view(); - tag = atomKK->k_tag.view(); nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; newton_pair = force->newton_pair; diff --git a/src/KOKKOS/pair_lj_cut_kokkos.h b/src/KOKKOS/pair_lj_cut_kokkos.h index 2659e8a129..106f1a9048 100644 --- a/src/KOKKOS/pair_lj_cut_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_kokkos.h @@ -80,7 +80,6 @@ class PairLJCutKokkos : public PairLJCut { DAT::tdual_virial_array k_vatom; typename AT::t_efloat_1d d_eatom; typename AT::t_virial_array d_vatom; - typename AT::t_tagint_1d tag; int newton_pair; double special_lj[4]; diff --git a/src/KOKKOS/pair_lj_expand_kokkos.cpp b/src/KOKKOS/pair_lj_expand_kokkos.cpp index 90eb02801b..ecdb3a7b22 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.cpp +++ b/src/KOKKOS/pair_lj_expand_kokkos.cpp @@ -98,7 +98,6 @@ void PairLJExpandKokkos::compute(int eflag_in, int vflag_in) c_x = atomKK->k_x.view(); f = atomKK->k_f.view(); type = atomKK->k_type.view(); - tag = atomKK->k_tag.view(); nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; newton_pair = force->newton_pair; diff --git a/src/KOKKOS/pair_lj_expand_kokkos.h b/src/KOKKOS/pair_lj_expand_kokkos.h index d5d5fdc731..0df0a6f8f8 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.h +++ b/src/KOKKOS/pair_lj_expand_kokkos.h @@ -80,7 +80,6 @@ class PairLJExpandKokkos : public PairLJExpand { typename AT::t_x_array c_x; typename AT::t_f_array f; typename AT::t_int_1d_randomread type; - typename AT::t_tagint_1d tag; DAT::tdual_efloat_1d k_eatom; DAT::tdual_virial_array k_vatom; diff --git a/src/KOKKOS/pair_lj_spica_kokkos.cpp b/src/KOKKOS/pair_lj_spica_kokkos.cpp index 4612537ab3..345c18bd30 100644 --- a/src/KOKKOS/pair_lj_spica_kokkos.cpp +++ b/src/KOKKOS/pair_lj_spica_kokkos.cpp @@ -98,7 +98,6 @@ void PairLJSPICAKokkos::compute(int eflag_in, int vflag_in) c_x = atomKK->k_x.view(); f = atomKK->k_f.view(); type = atomKK->k_type.view(); - tag = atomKK->k_tag.view(); nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; newton_pair = force->newton_pair; diff --git a/src/KOKKOS/pair_lj_spica_kokkos.h b/src/KOKKOS/pair_lj_spica_kokkos.h index 820d6e4cc5..b330af4bfd 100644 --- a/src/KOKKOS/pair_lj_spica_kokkos.h +++ b/src/KOKKOS/pair_lj_spica_kokkos.h @@ -80,7 +80,6 @@ class PairLJSPICAKokkos : public PairLJSPICA { typename AT::t_x_array c_x; typename AT::t_f_array f; typename AT::t_int_1d_randomread type; - typename AT::t_tagint_1d tag; DAT::tdual_efloat_1d k_eatom; DAT::tdual_virial_array k_vatom; diff --git a/src/KOKKOS/pair_morse_kokkos.cpp b/src/KOKKOS/pair_morse_kokkos.cpp index fcb89b26e4..50df64e3ca 100644 --- a/src/KOKKOS/pair_morse_kokkos.cpp +++ b/src/KOKKOS/pair_morse_kokkos.cpp @@ -101,7 +101,6 @@ void PairMorseKokkos::compute(int eflag_in, int vflag_in) c_x = atomKK->k_x.view(); f = atomKK->k_f.view(); type = atomKK->k_type.view(); - tag = atomKK->k_tag.view(); nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; newton_pair = force->newton_pair; diff --git a/src/KOKKOS/pair_morse_kokkos.h b/src/KOKKOS/pair_morse_kokkos.h index fa8ba8ca21..d06cf2deb1 100644 --- a/src/KOKKOS/pair_morse_kokkos.h +++ b/src/KOKKOS/pair_morse_kokkos.h @@ -80,7 +80,6 @@ class PairMorseKokkos : public PairMorse { DAT::tdual_virial_array k_vatom; typename ArrayTypes::t_efloat_1d d_eatom; typename ArrayTypes::t_virial_array d_vatom; - typename ArrayTypes::t_tagint_1d tag; int newton_pair; double special_lj[4]; diff --git a/src/KOKKOS/pair_reaxff_kokkos.cpp b/src/KOKKOS/pair_reaxff_kokkos.cpp index af3ac26663..0bfcef90cf 100644 --- a/src/KOKKOS/pair_reaxff_kokkos.cpp +++ b/src/KOKKOS/pair_reaxff_kokkos.cpp @@ -63,7 +63,7 @@ PairReaxFFKokkos::PairReaxFFKokkos(LAMMPS *lmp) : PairReaxFF(lmp) kokkosable = 1; atomKK = (AtomKokkos *) atom; execution_space = ExecutionSpaceFromDevice::space; - datamask_read = X_MASK | Q_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; + datamask_read = X_MASK | Q_MASK | F_MASK | TAG_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; k_resize_bo = DAT::tdual_int_scalar("pair:resize_bo"); diff --git a/src/KOKKOS/pair_tersoff_kokkos.cpp b/src/KOKKOS/pair_tersoff_kokkos.cpp index 8ae5bf1269..cae17102a8 100644 --- a/src/KOKKOS/pair_tersoff_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_kokkos.cpp @@ -70,7 +70,7 @@ PairTersoffKokkos::PairTersoffKokkos(LAMMPS *lmp) : PairTersoff(lmp) kokkosable = 1; atomKK = (AtomKokkos *) atom; execution_space = ExecutionSpaceFromDevice::space; - datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; + datamask_read = X_MASK | F_MASK | TAG_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; } diff --git a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp index 0036c7f007..06ef0dcceb 100644 --- a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp @@ -60,7 +60,7 @@ PairTersoffMODKokkos::PairTersoffMODKokkos(LAMMPS *lmp) : PairTersof kokkosable = 1; atomKK = (AtomKokkos *) atom; execution_space = ExecutionSpaceFromDevice::space; - datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; + datamask_read = X_MASK | F_MASK | TAG_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; } diff --git a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp index 44d8757a37..accbe9a863 100644 --- a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp @@ -62,7 +62,7 @@ PairTersoffZBLKokkos::PairTersoffZBLKokkos(LAMMPS *lmp) : PairTersof kokkosable = 1; atomKK = (AtomKokkos *) atom; execution_space = ExecutionSpaceFromDevice::space; - datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; + datamask_read = X_MASK | F_MASK | TAG_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; if (strcmp(update->unit_style,"metal") == 0) { diff --git a/src/KOKKOS/pair_yukawa_kokkos.cpp b/src/KOKKOS/pair_yukawa_kokkos.cpp index c288198b1b..7bdb9a9617 100644 --- a/src/KOKKOS/pair_yukawa_kokkos.cpp +++ b/src/KOKKOS/pair_yukawa_kokkos.cpp @@ -173,7 +173,6 @@ void PairYukawaKokkos::compute(int eflag_in, int vflag_in) c_x = atomKK->k_x.view(); f = atomKK->k_f.view(); type = atomKK->k_type.view(); - tag = atomKK->k_tag.view(); nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; newton_pair = force->newton_pair; diff --git a/src/KOKKOS/pair_yukawa_kokkos.h b/src/KOKKOS/pair_yukawa_kokkos.h index b24ff66968..e04f65264b 100644 --- a/src/KOKKOS/pair_yukawa_kokkos.h +++ b/src/KOKKOS/pair_yukawa_kokkos.h @@ -83,7 +83,6 @@ class PairYukawaKokkos : public PairYukawa { DAT::tdual_virial_array k_vatom; typename AT::t_efloat_1d d_eatom; typename AT::t_virial_array d_vatom; - typename AT::t_tagint_1d tag; int newton_pair; double special_lj[4]; diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index d6dcb2d8b6..b983172860 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -39,7 +39,7 @@ Contributing Author: Jacob Gissinger (jacob.r.gissinger@gmail.com) #include "neighbor.h" #include "pair.h" #include "random_mars.h" -#include "reset_mol_ids.h" +#include "reset_atoms_mol.h" #include "respa.h" #include "update.h" #include "variable.h" @@ -207,7 +207,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : if (reset_mol_ids_flag) { delete reset_mol_ids; - reset_mol_ids = new ResetMolIDs(lmp); + reset_mol_ids = new ResetAtomsMol(lmp); reset_mol_ids->create_computes(id,group->names[igroup]); } diff --git a/src/REACTION/fix_bond_react.h b/src/REACTION/fix_bond_react.h index 5bc20883ca..4751bc4eef 100644 --- a/src/REACTION/fix_bond_react.h +++ b/src/REACTION/fix_bond_react.h @@ -110,7 +110,7 @@ class FixBondReact : public Fix { class RanMars **random; // random number for 'prob' keyword class RanMars **rrhandom; // random number for Arrhenius constraint class NeighList *list; - class ResetMolIDs *reset_mol_ids; // class for resetting mol IDs + class ResetAtomsMol *reset_mol_ids; // class for resetting mol IDs int *reacted_mol, *unreacted_mol; int *limit_duration; // indicates how long to relax diff --git a/src/deprecated.cpp b/src/deprecated.cpp index 81a05307cb..c39cab1104 100644 --- a/src/deprecated.cpp +++ b/src/deprecated.cpp @@ -36,16 +36,25 @@ void Deprecated::command(int narg, char **arg) if (lmp->comm->me == 0) utils::logmesg(lmp, "\nThe 'box' command has been removed and will be ignored\n\n"); return; - } else if (cmd == "reset_ids") { - if (lmp->comm->me == 0) - utils::logmesg(lmp, "\n'reset_ids' has been renamed to 'reset_atom_ids'\n\n"); } else if (utils::strmatch(cmd, "^kim_")) { - if (lmp->comm->me == 0) - utils::logmesg(lmp, - "\nWARNING: 'kim_' has been renamed to 'kim '. " - "Please update your input.\n\n"); std::string newcmd("kim"); newcmd += " " + cmd.substr(4); + if (lmp->comm->me == 0) + utils::logmesg(lmp, "\nWARNING: '{}' has been renamed to '{}'. Please update your input.\n\n", + cmd, newcmd); + for (int i = 0; i < narg; ++i) { + newcmd.append(1, ' '); + newcmd.append(arg[i]); + } + input->one(newcmd); + return; + } else if (utils::strmatch(cmd, "^reset_")) { + std::string newcmd("reset_atoms"); + if ((cmd == "reset_ids") || (cmd == "reset_atom_ids")) newcmd += " id"; + if (cmd == "reset_mol_ids") newcmd += " mol"; + if (lmp->comm->me == 0) + utils::logmesg(lmp, "\nWARNING: '{}' has been renamed to '{}'. Please update your input.\n\n", + cmd, newcmd); for (int i = 0; i < narg; ++i) { newcmd.append(1, ' '); newcmd.append(arg[i]); diff --git a/src/deprecated.h b/src/deprecated.h index 2eb334b3ef..085bf5d47d 100644 --- a/src/deprecated.h +++ b/src/deprecated.h @@ -15,12 +15,14 @@ // clang-format off CommandStyle(DEPRECATED,Deprecated); CommandStyle(box,Deprecated); -CommandStyle(reset_ids,Deprecated); CommandStyle(kim_init,Deprecated); CommandStyle(kim_interactions,Deprecated); CommandStyle(kim_param,Deprecated); CommandStyle(kim_property,Deprecated); CommandStyle(kim_query,Deprecated); +CommandStyle(reset_ids,Deprecated); +CommandStyle(reset_atom_ids,Deprecated); +CommandStyle(reset_mol_ids,Deprecated); CommandStyle(message,Deprecated); CommandStyle(server,Deprecated); // clang-format on diff --git a/src/input.cpp b/src/input.cpp index adb61614da..f18ef1efb8 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -749,76 +749,77 @@ int Input::execute_command() { int flag = 1; - if (!strcmp(command,"clear")) clear(); - else if (!strcmp(command,"echo")) echo(); - else if (!strcmp(command,"if")) ifthenelse(); - else if (!strcmp(command,"include")) include(); - else if (!strcmp(command,"jump")) jump(); - else if (!strcmp(command,"label")) label(); - else if (!strcmp(command,"log")) log(); - else if (!strcmp(command,"next")) next_command(); - else if (!strcmp(command,"partition")) partition(); - else if (!strcmp(command,"print")) print(); - else if (!strcmp(command,"python")) python(); - else if (!strcmp(command,"quit")) quit(); - else if (!strcmp(command,"shell")) shell(); - else if (!strcmp(command,"variable")) variable_command(); + std::string mycmd = command; + if (mycmd == "clear") clear(); + else if (mycmd == "echo") echo(); + else if (mycmd == "if") ifthenelse(); + else if (mycmd == "include") include(); + else if (mycmd == "jump") jump(); + else if (mycmd == "label") label(); + else if (mycmd == "log") log(); + else if (mycmd == "next") next_command(); + else if (mycmd == "partition") partition(); + else if (mycmd == "print") print(); + else if (mycmd == "python") python(); + else if (mycmd == "quit") quit(); + else if (mycmd == "shell") shell(); + else if (mycmd == "variable") variable_command(); - else if (!strcmp(command,"angle_coeff")) angle_coeff(); - else if (!strcmp(command,"angle_style")) angle_style(); - else if (!strcmp(command,"atom_modify")) atom_modify(); - else if (!strcmp(command,"atom_style")) atom_style(); - else if (!strcmp(command,"bond_coeff")) bond_coeff(); - else if (!strcmp(command,"bond_style")) bond_style(); - else if (!strcmp(command,"bond_write")) bond_write(); - else if (!strcmp(command,"boundary")) boundary(); - else if (!strcmp(command,"comm_modify")) comm_modify(); - else if (!strcmp(command,"comm_style")) comm_style(); - else if (!strcmp(command,"compute")) compute(); - else if (!strcmp(command,"compute_modify")) compute_modify(); - else if (!strcmp(command,"dielectric")) dielectric(); - else if (!strcmp(command,"dihedral_coeff")) dihedral_coeff(); - else if (!strcmp(command,"dihedral_style")) dihedral_style(); - else if (!strcmp(command,"dimension")) dimension(); - else if (!strcmp(command,"dump")) dump(); - else if (!strcmp(command,"dump_modify")) dump_modify(); - else if (!strcmp(command,"fix")) fix(); - else if (!strcmp(command,"fix_modify")) fix_modify(); - else if (!strcmp(command,"group")) group_command(); - else if (!strcmp(command,"improper_coeff")) improper_coeff(); - else if (!strcmp(command,"improper_style")) improper_style(); - else if (!strcmp(command,"kspace_modify")) kspace_modify(); - else if (!strcmp(command,"kspace_style")) kspace_style(); - else if (!strcmp(command,"labelmap")) labelmap(); - else if (!strcmp(command,"lattice")) lattice(); - else if (!strcmp(command,"mass")) mass(); - else if (!strcmp(command,"min_modify")) min_modify(); - else if (!strcmp(command,"min_style")) min_style(); - else if (!strcmp(command,"molecule")) molecule(); - else if (!strcmp(command,"neigh_modify")) neigh_modify(); - else if (!strcmp(command,"neighbor")) neighbor_command(); - else if (!strcmp(command,"newton")) newton(); - else if (!strcmp(command,"package")) package(); - else if (!strcmp(command,"pair_coeff")) pair_coeff(); - else if (!strcmp(command,"pair_modify")) pair_modify(); - else if (!strcmp(command,"pair_style")) pair_style(); - else if (!strcmp(command,"pair_write")) pair_write(); - else if (!strcmp(command,"processors")) processors(); - else if (!strcmp(command,"region")) region(); - else if (!strcmp(command,"reset_timestep")) reset_timestep(); - else if (!strcmp(command,"restart")) restart(); - else if (!strcmp(command,"run_style")) run_style(); - else if (!strcmp(command,"special_bonds")) special_bonds(); - else if (!strcmp(command,"suffix")) suffix(); - else if (!strcmp(command,"thermo")) thermo(); - else if (!strcmp(command,"thermo_modify")) thermo_modify(); - else if (!strcmp(command,"thermo_style")) thermo_style(); - else if (!strcmp(command,"timestep")) timestep(); - else if (!strcmp(command,"timer")) timer_command(); - else if (!strcmp(command,"uncompute")) uncompute(); - else if (!strcmp(command,"undump")) undump(); - else if (!strcmp(command,"unfix")) unfix(); - else if (!strcmp(command,"units")) units(); + else if (mycmd == "angle_coeff") angle_coeff(); + else if (mycmd == "angle_style") angle_style(); + else if (mycmd == "atom_modify") atom_modify(); + else if (mycmd == "atom_style") atom_style(); + else if (mycmd == "bond_coeff") bond_coeff(); + else if (mycmd == "bond_style") bond_style(); + else if (mycmd == "bond_write") bond_write(); + else if (mycmd == "boundary") boundary(); + else if (mycmd == "comm_modify") comm_modify(); + else if (mycmd == "comm_style") comm_style(); + else if (mycmd == "compute") compute(); + else if (mycmd == "compute_modify") compute_modify(); + else if (mycmd == "dielectric") dielectric(); + else if (mycmd == "dihedral_coeff") dihedral_coeff(); + else if (mycmd == "dihedral_style") dihedral_style(); + else if (mycmd == "dimension") dimension(); + else if (mycmd == "dump") dump(); + else if (mycmd == "dump_modify") dump_modify(); + else if (mycmd == "fix") fix(); + else if (mycmd == "fix_modify") fix_modify(); + else if (mycmd == "group") group_command(); + else if (mycmd == "improper_coeff") improper_coeff(); + else if (mycmd == "improper_style") improper_style(); + else if (mycmd == "kspace_modify") kspace_modify(); + else if (mycmd == "kspace_style") kspace_style(); + else if (mycmd == "labelmap") labelmap(); + else if (mycmd == "lattice") lattice(); + else if (mycmd == "mass") mass(); + else if (mycmd == "min_modify") min_modify(); + else if (mycmd == "min_style") min_style(); + else if (mycmd == "molecule") molecule(); + else if (mycmd == "neigh_modify") neigh_modify(); + else if (mycmd == "neighbor") neighbor_command(); + else if (mycmd == "newton") newton(); + else if (mycmd == "package") package(); + else if (mycmd == "pair_coeff") pair_coeff(); + else if (mycmd == "pair_modify") pair_modify(); + else if (mycmd == "pair_style") pair_style(); + else if (mycmd == "pair_write") pair_write(); + else if (mycmd == "processors") processors(); + else if (mycmd == "region") region(); + else if (mycmd == "reset_timestep") reset_timestep(); + else if (mycmd == "restart") restart(); + else if (mycmd == "run_style") run_style(); + else if (mycmd == "special_bonds") special_bonds(); + else if (mycmd == "suffix") suffix(); + else if (mycmd == "thermo") thermo(); + else if (mycmd == "thermo_modify") thermo_modify(); + else if (mycmd == "thermo_style") thermo_style(); + else if (mycmd == "timestep") timestep(); + else if (mycmd == "timer") timer_command(); + else if (mycmd == "uncompute") uncompute(); + else if (mycmd == "undump") undump(); + else if (mycmd == "unfix") unfix(); + else if (mycmd == "units") units(); else flag = 0; @@ -826,10 +827,15 @@ int Input::execute_command() if (flag) return 0; + // process "meta-commands", i.e. commands that may have sub-commands + // they return 1 if there was a match and 0 if not + + if (mycmd == "reset_atoms") flag = meta(mycmd); + if (flag) return 0; + // invoke commands added via style_command.h // try suffixed version first - std::string mycmd = command; if (lmp->suffix_enable && lmp->non_pair_suffix()) { mycmd = command + std::string("/") + lmp->non_pair_suffix(); if (command_map->find(mycmd) == command_map->end()) { @@ -1978,3 +1984,21 @@ void Input::units() error->all(FLERR,"Units command after simulation box is defined"); update->set_units(arg[0]); } + +/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + function for meta commands +------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ + +int Input::meta(const std::string &prefix) +{ + auto mycmd = fmt::format("{}_{}", utils::uppercase(prefix), utils::uppercase(arg[0])); + if (command_map->find(mycmd) != command_map->end()) { + CommandCreator &command_creator = (*command_map)[mycmd]; + Command *cmd = command_creator(lmp); + cmd->command(narg-1,arg+1); + delete cmd; + return 1; + } else return 0; +} diff --git a/src/input.h b/src/input.h index ebd7c13331..5a29484cbc 100644 --- a/src/input.h +++ b/src/input.h @@ -70,6 +70,8 @@ class Input : protected Pointers { void reallocate(char *&, int &, int); // reallocate a char string int execute_command(); // execute a single command + int meta(const std::string &); // process meta-commands + void clear(); // input script commands void echo(); void ifthenelse(); @@ -142,7 +144,5 @@ class Input : protected Pointers { void unfix(); void units(); }; - } // namespace LAMMPS_NS - #endif diff --git a/src/reset_atom_ids.cpp b/src/reset_atoms_id.cpp similarity index 66% rename from src/reset_atom_ids.cpp rename to src/reset_atoms_id.cpp index 1faa9a8e7d..26685f1972 100644 --- a/src/reset_atom_ids.cpp +++ b/src/reset_atoms_id.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -12,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "reset_atom_ids.h" +#include "reset_atoms_id.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +31,7 @@ using namespace LAMMPS_NS; #if defined(LMP_QSORT) // allocate space for static class variable // prototype for non-class function -ResetIDs::AtomRvous *ResetIDs::sortrvous; +ResetAtomsID::AtomRvous *ResetAtomsID::sortrvous; static int compare_coords(const void *, const void *); #else // prototype for non-class function @@ -44,22 +43,21 @@ static int compare_coords(const int, const int, void *); /* ---------------------------------------------------------------------- */ -ResetIDs::ResetIDs(LAMMPS *lmp) : Command(lmp) {} +ResetAtomsID::ResetAtomsID(LAMMPS *lmp) : Command(lmp) {} /* ---------------------------------------------------------------------- */ -void ResetIDs::command(int narg, char **arg) +void ResetAtomsID::command(int narg, char **arg) { if (domain->box_exist == 0) - error->all(FLERR,"Reset_ids command before simulation box is defined"); - if (atom->tag_enable == 0) - error->all(FLERR,"Cannot use reset_atom_ids unless atoms have IDs"); + error->all(FLERR, "Reset_atoms id command before simulation box is defined"); + if (atom->tag_enable == 0) error->all(FLERR, "Cannot use reset_atoms id unless atoms have IDs"); for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->stores_ids) - error->all(FLERR,"Cannot use reset_atom_ids when a fix exists that stores atom IDs"); + error->all(FLERR, "Cannot use reset_atoms id when a fix exists that stores atom IDs"); - if (comm->me == 0) utils::logmesg(lmp,"Resetting atom IDs ...\n"); + if (comm->me == 0) utils::logmesg(lmp, "Resetting atom IDs ...\n"); // process args @@ -67,11 +65,12 @@ void ResetIDs::command(int narg, char **arg) int iarg = 0; while (iarg < narg) { - if (strcmp(arg[iarg],"sort") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal reset_atom_ids command"); - sortflag = utils::logical(FLERR,arg[iarg+1],false,lmp); + if (strcmp(arg[iarg], "sort") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "reset_atoms id", error); + sortflag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else error->all(FLERR,"Illegal reset_atom_ids command"); + } else + error->all(FLERR, "Unknown reset_atoms id keyword: {}", arg[iarg]); } // create an atom map if one doesn't exist already @@ -99,7 +98,7 @@ void ResetIDs::command(int narg, char **arg) comm->setup(); comm->exchange(); comm->borders(); - if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); + if (domain->triclinic) domain->lamda2x(atom->nlocal + atom->nghost); // oldIDs = copy of current owned IDs @@ -108,7 +107,7 @@ void ResetIDs::command(int narg, char **arg) int nall = nlocal + atom->nghost; tagint *oldIDs; - memory->create(oldIDs,nlocal,"reset_atom_ids:oldIDs"); + memory->create(oldIDs, nlocal, "reset_atom_ids:oldIDs"); for (int i = 0; i < nlocal; i++) { oldIDs[i] = tag[i]; @@ -119,22 +118,24 @@ void ResetIDs::command(int narg, char **arg) // if sortflag = no: use fast tag_extend() // if sortflag = yes: use slower full spatial sort plus rendezvous comm - if (sortflag == 0) atom->tag_extend(); - else sort(); + if (sortflag == 0) + atom->tag_extend(); + else + sort(); // newIDs = copy of new IDs // restore old IDs, consistent with existing atom map // forward_comm_array acquires new IDs for ghost atoms double **newIDs; - memory->create(newIDs,nall,1,"reset_atom_ids:newIDs"); + memory->create(newIDs, nall, 1, "reset_atom_ids:newIDs"); for (int i = 0; i < nlocal; i++) { newIDs[i][0] = ubuf(tag[i]).d; tag[i] = oldIDs[i]; } - comm->forward_comm_array(1,newIDs); + comm->forward_comm_array(1, newIDs); // loop over bonds, angles, etc and reset IDs in stored topology arrays // only necessary for molecular = Atom::MOLECULAR, not molecular = Atom::TEMPLATE @@ -143,7 +144,7 @@ void ResetIDs::command(int narg, char **arg) int badcount = 0; if (atom->molecular == Atom::MOLECULAR) { - int j,m; + int j, m; tagint oldID; if (atom->avec->bonds_allow) { @@ -153,8 +154,10 @@ void ResetIDs::command(int narg, char **arg) for (j = 0; j < num_bond[i]; j++) { oldID = bond_atom[i][j]; m = atom->map(oldID); - if (m >= 0) bond_atom[i][j] = (tagint) ubuf(newIDs[m][0]).i; - else badcount++; + if (m >= 0) + bond_atom[i][j] = (tagint) ubuf(newIDs[m][0]).i; + else + badcount++; } } } @@ -168,18 +171,24 @@ void ResetIDs::command(int narg, char **arg) for (j = 0; j < num_angle[i]; j++) { oldID = angle_atom1[i][j]; m = atom->map(oldID); - if (m >= 0) angle_atom1[i][j] = (tagint) ubuf(newIDs[m][0]).i; - else badcount++; + if (m >= 0) + angle_atom1[i][j] = (tagint) ubuf(newIDs[m][0]).i; + else + badcount++; oldID = angle_atom2[i][j]; m = atom->map(oldID); - if (m >= 0) angle_atom2[i][j] = (tagint) ubuf(newIDs[m][0]).i; - else badcount++; + if (m >= 0) + angle_atom2[i][j] = (tagint) ubuf(newIDs[m][0]).i; + else + badcount++; oldID = angle_atom3[i][j]; m = atom->map(oldID); - if (m >= 0) angle_atom3[i][j] = (tagint) ubuf(newIDs[m][0]).i; - else badcount++; + if (m >= 0) + angle_atom3[i][j] = (tagint) ubuf(newIDs[m][0]).i; + else + badcount++; } } } @@ -194,23 +203,31 @@ void ResetIDs::command(int narg, char **arg) for (j = 0; j < num_dihedral[i]; j++) { oldID = dihedral_atom1[i][j]; m = atom->map(oldID); - if (m >= 0) dihedral_atom1[i][j] = (tagint) ubuf(newIDs[m][0]).i; - else badcount++; + if (m >= 0) + dihedral_atom1[i][j] = (tagint) ubuf(newIDs[m][0]).i; + else + badcount++; oldID = dihedral_atom2[i][j]; m = atom->map(oldID); - if (m >= 0) dihedral_atom2[i][j] = (tagint) ubuf(newIDs[m][0]).i; - else badcount++; + if (m >= 0) + dihedral_atom2[i][j] = (tagint) ubuf(newIDs[m][0]).i; + else + badcount++; oldID = dihedral_atom3[i][j]; m = atom->map(oldID); - if (m >= 0) dihedral_atom3[i][j] = (tagint) ubuf(newIDs[m][0]).i; - else badcount++; + if (m >= 0) + dihedral_atom3[i][j] = (tagint) ubuf(newIDs[m][0]).i; + else + badcount++; oldID = dihedral_atom4[i][j]; m = atom->map(oldID); - if (m >= 0) dihedral_atom4[i][j] = (tagint) ubuf(newIDs[m][0]).i; - else badcount++; + if (m >= 0) + dihedral_atom4[i][j] = (tagint) ubuf(newIDs[m][0]).i; + else + badcount++; } } } @@ -225,23 +242,31 @@ void ResetIDs::command(int narg, char **arg) for (j = 0; j < num_improper[i]; j++) { oldID = improper_atom1[i][j]; m = atom->map(oldID); - if (m >= 0) improper_atom1[i][j] = (tagint) ubuf(newIDs[m][0]).i; - else badcount++; + if (m >= 0) + improper_atom1[i][j] = (tagint) ubuf(newIDs[m][0]).i; + else + badcount++; oldID = improper_atom2[i][j]; m = atom->map(oldID); - if (m >= 0) improper_atom2[i][j] = (tagint) ubuf(newIDs[m][0]).i; - else badcount++; + if (m >= 0) + improper_atom2[i][j] = (tagint) ubuf(newIDs[m][0]).i; + else + badcount++; oldID = improper_atom3[i][j]; m = atom->map(oldID); - if (m >= 0) improper_atom3[i][j] = (tagint) ubuf(newIDs[m][0]).i; - else badcount++; + if (m >= 0) + improper_atom3[i][j] = (tagint) ubuf(newIDs[m][0]).i; + else + badcount++; oldID = improper_atom4[i][j]; m = atom->map(oldID); - if (m >= 0) improper_atom4[i][j] = (tagint) ubuf(newIDs[m][0]).i; - else badcount++; + if (m >= 0) + improper_atom4[i][j] = (tagint) ubuf(newIDs[m][0]).i; + else + badcount++; } } } @@ -250,10 +275,10 @@ void ResetIDs::command(int narg, char **arg) // error check int all; - MPI_Allreduce(&badcount,&all,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&badcount, &all, 1, MPI_INT, MPI_SUM, world); if (all) - error->all(FLERR,"Reset_ids missing {} bond topology atom IDs - " - "use comm_modify cutoff",all); + error->all(FLERR, + "reset_atoms id is missing {} bond topology atom IDs - use comm_modify cutoff", all); // reset IDs and atom map for owned atoms @@ -287,9 +312,9 @@ void ResetIDs::command(int narg, char **arg) spatial sort of atoms followed by rendezvous comm to reset atom IDs ------------------------------------------------------------------------- */ -void ResetIDs::sort() +void ResetAtomsID::sort() { - double mylo[3],myhi[3],bboxlo[3],bboxhi[3]; + double mylo[3], myhi[3], bboxlo[3], bboxhi[3]; int me = comm->me; int nprocs = comm->nprocs; @@ -306,12 +331,12 @@ void ResetIDs::sort() myhi[0] = myhi[1] = myhi[2] = -BIG; for (int i = 0; i < nlocal; i++) { - mylo[0] = MIN(mylo[0],x[i][0]); - mylo[1] = MIN(mylo[1],x[i][1]); - mylo[2] = MIN(mylo[2],x[i][2]); - myhi[0] = MAX(myhi[0],x[i][0]); - myhi[1] = MAX(myhi[1],x[i][1]); - myhi[2] = MAX(myhi[2],x[i][2]); + mylo[0] = MIN(mylo[0], x[i][0]); + mylo[1] = MIN(mylo[1], x[i][1]); + mylo[2] = MIN(mylo[2], x[i][2]); + myhi[0] = MAX(myhi[0], x[i][0]); + myhi[1] = MAX(myhi[1], x[i][1]); + myhi[2] = MAX(myhi[2], x[i][2]); } if (dim == 2) mylo[2] = myhi[2] = 0.0; @@ -325,15 +350,15 @@ void ResetIDs::sort() } } - MPI_Allreduce(mylo,bboxlo,3,MPI_DOUBLE,MPI_MIN,world); - MPI_Allreduce(myhi,bboxhi,3,MPI_DOUBLE,MPI_MAX,world); + MPI_Allreduce(mylo, bboxlo, 3, MPI_DOUBLE, MPI_MIN, world); + MPI_Allreduce(myhi, bboxhi, 3, MPI_DOUBLE, MPI_MAX, world); - bboxlo[0] -= 0.0001 * (bboxhi[0]-bboxlo[0]); - bboxlo[1] -= 0.0001 * (bboxhi[1]-bboxlo[1]); - bboxlo[2] -= 0.0001 * (bboxhi[2]-bboxlo[2]); - bboxhi[0] += 0.0001 * (bboxhi[0]-bboxlo[0]); - bboxhi[1] += 0.0001 * (bboxhi[1]-bboxlo[1]); - bboxhi[2] += 0.0001 * (bboxhi[2]-bboxlo[2]); + bboxlo[0] -= 0.0001 * (bboxhi[0] - bboxlo[0]); + bboxlo[1] -= 0.0001 * (bboxhi[1] - bboxlo[1]); + bboxlo[2] -= 0.0001 * (bboxhi[2] - bboxlo[2]); + bboxhi[0] += 0.0001 * (bboxhi[0] - bboxlo[0]); + bboxhi[1] += 0.0001 * (bboxhi[1] - bboxlo[1]); + bboxhi[2] += 0.0001 * (bboxhi[2] - bboxlo[2]); // nbin_estimate = estimate of total number of bins, each with PERBIN atoms // binsize = edge length of a cubic bin @@ -342,19 +367,23 @@ void ResetIDs::sort() bigint nbin_estimate = atom->natoms / PERBIN + 1; double vol; - if (dim == 2) vol = (bboxhi[0]-bboxlo[0]) * (bboxhi[1]-bboxlo[1]); - else vol = (bboxhi[0]-bboxlo[0]) * (bboxhi[1]-bboxlo[1]) * (bboxhi[2]-bboxlo[2]); - double binsize = pow(vol/nbin_estimate,1.0/dim); + if (dim == 2) + vol = (bboxhi[0] - bboxlo[0]) * (bboxhi[1] - bboxlo[1]); + else + vol = (bboxhi[0] - bboxlo[0]) * (bboxhi[1] - bboxlo[1]) * (bboxhi[2] - bboxlo[2]); + double binsize = pow(vol / nbin_estimate, 1.0 / dim); - int nbinx = static_cast ((bboxhi[0]-bboxlo[0]) / binsize) + 1; - int nbiny = static_cast ((bboxhi[1]-bboxlo[1]) / binsize) + 1; - int nbinz = static_cast ((bboxhi[2]-bboxlo[2]) / binsize) + 1; + int nbinx = static_cast((bboxhi[0] - bboxlo[0]) / binsize) + 1; + int nbiny = static_cast((bboxhi[1] - bboxlo[1]) / binsize) + 1; + int nbinz = static_cast((bboxhi[2] - bboxlo[2]) / binsize) + 1; - double invx = 1.0 / (bboxhi[0]-bboxlo[0]); - double invy = 1.0 / (bboxhi[1]-bboxlo[1]); + double invx = 1.0 / (bboxhi[0] - bboxlo[0]); + double invy = 1.0 / (bboxhi[1] - bboxlo[1]); double invz; - if (dim == 2) invz = 0.0; - else invz = 1.0 / (bboxhi[2]-bboxlo[2]); + if (dim == 2) + invz = 0.0; + else + invz = 1.0 / (bboxhi[2] - bboxlo[2]); // nbins = actual total number of bins // bins are split evenly across procs @@ -366,18 +395,18 @@ void ResetIDs::sort() // binlo to binhi-1 = bin indices this proc will own in Rvous decomp // bins are numbered from 0 to Nbins-1 - bigint nbins = (bigint) nbinx*nbiny*nbinz; + bigint nbins = (bigint) nbinx * nbiny * nbinz; bigint nlo = nbins / nprocs; bigint nhi = nlo + 1; bigint nplo = nprocs - (nbins % nprocs); - bigint nbinlo = nplo*nlo; + bigint nbinlo = nplo * nlo; if (me < nplo) { binlo = me * nlo; - binhi = (me+1) * nlo; + binhi = (me + 1) * nlo; } else { - binlo = nbinlo + (me-nplo) * nhi; - binhi = nbinlo + (me+1-nplo) * nhi; + binlo = nbinlo + (me - nplo) * nhi; + binhi = nbinlo + (me + 1 - nplo) * nhi; } // fill atombuf with info on my atoms @@ -385,20 +414,23 @@ void ResetIDs::sort() // proclist = proc that owns ibin int *proclist; - memory->create(proclist,nlocal,"special:proclist"); - auto atombuf = (AtomRvous *) memory->smalloc((bigint) nlocal*sizeof(AtomRvous),"resetIDs:idbuf"); + memory->create(proclist, nlocal, "special:proclist"); + auto atombuf = + (AtomRvous *) memory->smalloc((bigint) nlocal * sizeof(AtomRvous), "resetIDs:idbuf"); - int ibinx,ibiny,ibinz,iproc; + int ibinx, ibiny, ibinz, iproc; bigint ibin; for (int i = 0; i < nlocal; i++) { - ibinx = static_cast ((x[i][0]-bboxlo[0])*invx * nbinx); - ibiny = static_cast ((x[i][1]-bboxlo[1])*invy * nbiny); - ibinz = static_cast ((x[i][2]-bboxlo[2])*invz * nbinz); - ibin = (bigint) ibinz*nbiny*nbinx + (bigint) ibiny*nbinx + ibinx; + ibinx = static_cast((x[i][0] - bboxlo[0]) * invx * nbinx); + ibiny = static_cast((x[i][1] - bboxlo[1]) * invy * nbiny); + ibinz = static_cast((x[i][2] - bboxlo[2]) * invz * nbinz); + ibin = (bigint) ibinz * nbiny * nbinx + (bigint) ibiny * nbinx + ibinx; - if (ibin < nbinlo) iproc = ibin / nlo; - else iproc = nplo + (ibin-nbinlo) / nhi; + if (ibin < nbinlo) + iproc = ibin / nlo; + else + iproc = nplo + (ibin - nbinlo) / nhi; proclist[i] = iproc; atombuf[i].ibin = ibin; @@ -412,8 +444,8 @@ void ResetIDs::sort() // perform rendezvous operation, send atombuf to other procs char *buf; - int nreturn = comm->rendezvous(1,nlocal,(char *) atombuf,sizeof(AtomRvous),0,proclist, - sort_bins,0,buf,sizeof(IDRvous),(void *) this); + int nreturn = comm->rendezvous(1, nlocal, (char *) atombuf, sizeof(AtomRvous), 0, proclist, + sort_bins, 0, buf, sizeof(IDRvous), (void *) this); auto outbuf = (IDRvous *) buf; memory->destroy(proclist); @@ -437,11 +469,11 @@ void ResetIDs::sort() outbuf = list of N IDRvous datums, sent back to sending proc ------------------------------------------------------------------------- */ -int ResetIDs::sort_bins(int n, char *inbuf, int &flag, int *&proclist, char *&outbuf, void *ptr) +int ResetAtomsID::sort_bins(int n, char *inbuf, int &flag, int *&proclist, char *&outbuf, void *ptr) { - int i,ibin,index; + int i, ibin, index; - auto rptr = (ResetIDs *) ptr; + auto rptr = (ResetAtomsID *) ptr; Memory *memory = rptr->memory; Error *error = rptr->error; MPI_Comm world = rptr->world; @@ -451,13 +483,13 @@ int ResetIDs::sort_bins(int n, char *inbuf, int &flag, int *&proclist, char *&ou // nbins = my subset of bins from binlo to binhi-1 // initialize linked lists of my Rvous atoms in each bin - int *next,*head,*last,*count; + int *next, *head, *last, *count; int nbins = binhi - binlo; - memory->create(next,n,"resetIDs:next"); - memory->create(head,nbins,"resetIDs:head"); - memory->create(last,nbins,"resetIDs:last"); - memory->create(count,nbins,"resetIDs:count"); + memory->create(next, n, "resetIDs:next"); + memory->create(head, nbins, "resetIDs:head"); + memory->create(last, nbins, "resetIDs:last"); + memory->create(count, nbins, "resetIDs:count"); for (i = 0; i < n; i++) next[i] = -1; @@ -472,7 +504,7 @@ int ResetIDs::sort_bins(int n, char *inbuf, int &flag, int *&proclist, char *&ou if (in[i].ibin < binlo || in[i].ibin >= binhi) { //printf("BAD me %d i %d %d ibin %d binlohi %d %d\n", // rptr->comm->me,i,n,in[i].ibin,binlo,binhi); - error->one(FLERR,"Bad spatial bin assignment in reset_atom_ids sort"); + error->one(FLERR, "Bad spatial bin assignment in reset_atoms id sort"); } ibin = in[i].ibin - binlo; if (head[ibin] < 0) head[ibin] = i; @@ -482,11 +514,10 @@ int ResetIDs::sort_bins(int n, char *inbuf, int &flag, int *&proclist, char *&ou } int maxcount = 0; - for (ibin = 0; ibin < nbins; ibin++) - maxcount = MAX(maxcount,count[ibin]); + for (ibin = 0; ibin < nbins; ibin++) maxcount = MAX(maxcount, count[ibin]); int *order; - memory->create(order,maxcount,"resetIDs:order"); + memory->create(order, maxcount, "resetIDs:order"); // sort atoms in each bin by their spatial position // recreate linked list for each bin based on sorted order @@ -498,12 +529,11 @@ int ResetIDs::sort_bins(int n, char *inbuf, int &flag, int *&proclist, char *&ou index = next[index]; } - #if defined(LMP_QSORT) sortrvous = in; - qsort(order,count[ibin],sizeof(int),compare_coords); + qsort(order, count[ibin], sizeof(int), compare_coords); #else - utils::merge_sort(order,count[ibin],(void *) in,compare_coords); + utils::merge_sort(order, count[ibin], (void *) in, compare_coords); #endif head[ibin] = last[ibin] = -1; @@ -518,15 +548,15 @@ int ResetIDs::sort_bins(int n, char *inbuf, int &flag, int *&proclist, char *&ou tagint ntag = n; tagint nprev; - MPI_Scan(&ntag,&nprev,1,MPI_LMP_TAGINT,MPI_SUM,world); + MPI_Scan(&ntag, &nprev, 1, MPI_LMP_TAGINT, MPI_SUM, world); nprev -= n; // loop over bins and sorted atoms in each bin, reset ids to be consecutive // pass outbuf of IDRvous datums back to comm->rendezvous int nout = n; - memory->create(proclist,nout,"resetIDs:proclist"); - auto out = (IDRvous *) memory->smalloc(nout*sizeof(IDRvous),"resetIDs:out"); + memory->create(proclist, nout, "resetIDs:proclist"); + auto out = (IDRvous *) memory->smalloc(nout * sizeof(IDRvous), "resetIDs:out"); tagint one = nprev + 1; for (ibin = 0; ibin < nbins; ibin++) { @@ -567,7 +597,7 @@ int compare_coords(const void *iptr, const void *jptr) { int i = *((int *) iptr); int j = *((int *) jptr); - ResetIDs::AtomRvous *rvous = ResetIDs::sortrvous; + ResetAtomsID::AtomRvous *rvous = ResetAtomsID::sortrvous; double *xi = rvous[i].x; double *xj = rvous[j].x; if (xi[0] < xj[0]) return -1; @@ -588,7 +618,7 @@ int compare_coords(const void *iptr, const void *jptr) int compare_coords(const int i, const int j, void *ptr) { - auto rvous = (ResetIDs::AtomRvous *) ptr; + auto rvous = (ResetAtomsID::AtomRvous *) ptr; double *xi = rvous[i].x; double *xj = rvous[j].x; if (xi[0] < xj[0]) return -1; diff --git a/src/reset_atom_ids.h b/src/reset_atoms_id.h similarity index 88% rename from src/reset_atom_ids.h rename to src/reset_atoms_id.h index 0da02a0ffc..9d80505586 100644 --- a/src/reset_atom_ids.h +++ b/src/reset_atoms_id.h @@ -13,18 +13,18 @@ #ifdef COMMAND_CLASS // clang-format off -CommandStyle(reset_atom_ids,ResetIDs); +CommandStyle(RESET_ATOMS_ID,ResetAtomsID); // clang-format on #else -#ifndef LMP_RESET_IDS_H -#define LMP_RESET_IDS_H +#ifndef LMP_RESET_ATOMS_ID_H +#define LMP_RESET_ATOMS_ID_H #include "command.h" namespace LAMMPS_NS { -class ResetIDs : public Command { +class ResetAtomsID : public Command { public: struct AtomRvous { bigint ibin; @@ -42,7 +42,7 @@ class ResetIDs : public Command { static AtomRvous *sortrvous; #endif - ResetIDs(class LAMMPS *); + ResetAtomsID(class LAMMPS *); void command(int, char **) override; private: @@ -54,8 +54,6 @@ class ResetIDs : public Command { void sort(); }; - } // namespace LAMMPS_NS - #endif #endif diff --git a/src/reset_atoms_image.cpp b/src/reset_atoms_image.cpp new file mode 100644 index 0000000000..5f02ced963 --- /dev/null +++ b/src/reset_atoms_image.cpp @@ -0,0 +1,141 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "reset_atoms_image.h" + +#include "atom.h" +#include "atom_vec.h" +#include "comm.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "group.h" +#include "input.h" +#include "modify.h" +#include "variable.h" + +#include +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +ResetAtomsImage::ResetAtomsImage(LAMMPS *lmp) : Command(lmp) {} + +/* ---------------------------------------------------------------------- + called as reset_atoms image command in input script +------------------------------------------------------------------------- */ + +void ResetAtomsImage::command(int narg, char **arg) +{ + if (domain->box_exist == 0) + error->all(FLERR, "Reset_atoms image command before simulation box is defined"); + if (atom->tag_enable == 0) + error->all(FLERR, "Cannot use reset_atoms image unless atoms have IDs"); + if (atom->avec->bonds_allow == 0) + error->all(FLERR, "Cannot use reset_atoms image used when bonds are not allowed"); + + // process args + + if (narg < 1) utils::missing_cmd_args(FLERR, "reset_atoms image", error); + if (narg > 1) error->all(FLERR, "Unknown reset_atoms image keyword: {}", arg[1]); + int igroup = group->find(arg[0]); + if (igroup < 0) error->all(FLERR, "Could not find reset_atoms image group {}", arg[0]); + int groupbit = group->bitmask[igroup]; + + if (comm->me == 0) utils::logmesg(lmp, "Resetting image flags ...\n"); + + // record wall time for resetting molecule IDs + + MPI_Barrier(world); + double time1 = platform::walltime(); + + // initialize system since comm->borders() will be invoked + + lmp->init(); + + // setup domain, communication + // exchange will clear map, borders will reset + // this is the map needed to lookup current global IDs for bond topology + + if (domain->triclinic) domain->x2lamda(atom->nlocal); + domain->pbc(); + domain->reset_box(); + comm->setup(); + comm->exchange(); + comm->borders(); + if (domain->triclinic) domain->lamda2x(atom->nlocal + atom->nghost); + + // create computes and variables + + auto frags = modify->add_compute("frags_r_i_f all fragment/atom single yes"); + auto chunk = modify->add_compute("chunk_r_i_f all chunk/atom c_frags_r_i_f compress yes"); + auto flags = modify->add_compute("flags_r_i_f all property/atom ix iy iz"); + input->variable->set("ix_r_i_f atom c_flags_r_i_f[1]"); + input->variable->set("iy_r_i_f atom c_flags_r_i_f[2]"); + input->variable->set("iz_r_i_f atom c_flags_r_i_f[3]"); + auto ifmin = modify->add_compute("ifmin_r_i_f all reduce/chunk chunk_r_i_f min " + "v_ix_r_i_f v_iy_r_i_f v_iz_r_i_f"); + auto ifmax = modify->add_compute("ifmax_r_i_f all reduce/chunk chunk_r_i_f max " + "v_ix_r_i_f v_iy_r_i_f v_iz_r_i_f"); + auto cdist = modify->add_compute("cdist_r_i_f all chunk/spread/atom chunk_r_i_f " + "c_ifmax_r_i_f[*] c_ifmin_r_i_f[*]"); + + // trigger computes + + frags->compute_peratom(); + chunk->compute_peratom(); + flags->compute_peratom(); + ifmin->compute_array(); + ifmax->compute_array(); + cdist->compute_peratom(); + + // reset image flags for atoms in group + + const int *const mask = atom->mask; + const int nlocal = atom->nlocal; + imageint *image = atom->image; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + int ix = (image[i] & IMGMASK) - IMGMAX; + int iy = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; + int iz = (image[i] >> IMG2BITS) - IMGMAX; + ix -= (int) floor(0.5 * (cdist->array_atom[i][0] + cdist->array_atom[i][3])); + iy -= (int) floor(0.5 * (cdist->array_atom[i][1] + cdist->array_atom[i][4])); + iz -= (int) floor(0.5 * (cdist->array_atom[i][2] + cdist->array_atom[i][5])); + image[i] = ((imageint) (ix + IMGMAX) & IMGMASK) | + (((imageint) (iy + IMGMAX) & IMGMASK) << IMGBITS) | + (((imageint) (iz + IMGMAX) & IMGMASK) << IMG2BITS); + } + } + + // cleanup + + modify->delete_compute("cdist_r_i_f"); + modify->delete_compute("ifmax_r_i_f"); + modify->delete_compute("ifmin_r_i_f"); + modify->delete_compute("flags_r_i_f"); + modify->delete_compute("chunk_r_i_f"); + modify->delete_compute("frags_r_i_f"); + input->variable->set("ix_r_i_f delete"); + input->variable->set("iy_r_i_f delete"); + input->variable->set("iz_r_i_f delete"); + + // total time + + MPI_Barrier(world); + if (comm->me == 0) + utils::logmesg(lmp, " reset_atoms image CPU = {:.3f} seconds\n", platform::walltime() - time1); +} diff --git a/src/reset_atoms_image.h b/src/reset_atoms_image.h new file mode 100644 index 0000000000..314f2dd086 --- /dev/null +++ b/src/reset_atoms_image.h @@ -0,0 +1,34 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef COMMAND_CLASS +// clang-format off +CommandStyle(RESET_ATOMS_IMAGE,ResetAtomsImage); +// clang-format on +#else + +#ifndef LMP_RESET_ATOMS_IMAGE_H +#define LMP_RESET_ATOMS_IMAGE_H + +#include "command.h" + +namespace LAMMPS_NS { + +class ResetAtomsImage : public Command { + public: + ResetAtomsImage(class LAMMPS *); + void command(int, char **) override; +}; +} // namespace LAMMPS_NS +#endif +#endif diff --git a/src/reset_mol_ids.cpp b/src/reset_atoms_mol.cpp similarity index 62% rename from src/reset_mol_ids.cpp rename to src/reset_atoms_mol.cpp index 0a0f9dfa1a..ee4c28136f 100644 --- a/src/reset_mol_ids.cpp +++ b/src/reset_atoms_mol.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -16,7 +15,7 @@ Contributing author: Jacob Gissinger (jacob.gissinger@colorado.edu) ------------------------------------------------------------------------- */ -#include "reset_mol_ids.h" +#include "reset_atoms_mol.h" #include "atom.h" #include "comm.h" @@ -33,10 +32,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -ResetMolIDs::ResetMolIDs(LAMMPS *lmp) : Command(lmp) { - cfa = nullptr; - cca = nullptr; - +ResetAtomsMol::ResetAtomsMol(LAMMPS *lmp) : Command(lmp), cfa(nullptr), cca(nullptr) +{ // default settings compressflag = 1; @@ -49,49 +46,49 @@ ResetMolIDs::ResetMolIDs(LAMMPS *lmp) : Command(lmp) { /* ---------------------------------------------------------------------- */ -ResetMolIDs::~ResetMolIDs() +ResetAtomsMol::~ResetAtomsMol() { if (!idfrag.empty()) modify->delete_compute(idfrag); if (compressflag && !idchunk.empty()) modify->delete_compute(idchunk); } /* ---------------------------------------------------------------------- - called as reset_mol_ids command in input script + called as reset_atoms mol command in input script ------------------------------------------------------------------------- */ -void ResetMolIDs::command(int narg, char **arg) +void ResetAtomsMol::command(int narg, char **arg) { if (domain->box_exist == 0) - error->all(FLERR,"Reset_mol_ids command before simulation box is defined"); - if (atom->tag_enable == 0) - error->all(FLERR,"Cannot use reset_mol_ids unless atoms have IDs"); + error->all(FLERR, "Reset_atoms mol command before simulation box is defined"); + if (atom->tag_enable == 0) error->all(FLERR, "Cannot use reset_atoms mol unless atoms have IDs"); if (atom->molecular != Atom::MOLECULAR) - error->all(FLERR,"Can only use reset_mol_ids on molecular systems"); + error->all(FLERR, "Can only use reset_atoms mol on molecular systems"); // process args - if (narg < 1) error->all(FLERR,"Illegal reset_mol_ids command"); + if (narg < 1) utils::missing_cmd_args(FLERR, "reset_atoms mol", error); char *groupid = arg[0]; int iarg = 1; while (iarg < narg) { - if (strcmp(arg[iarg],"compress") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal reset_mol_ids command"); - compressflag = utils::logical(FLERR,arg[iarg+1],false,lmp); + if (strcmp(arg[iarg], "compress") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "reset_atoms mol compress", error); + compressflag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"single") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal reset_mol_ids command"); - singleflag = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "single") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "reset_atoms mol single", error); + singleflag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"offset") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal reset_mol_ids command"); - offset = utils::tnumeric(FLERR,arg[iarg+1],true,lmp); - if (offset < -1) error->all(FLERR,"Illegal reset_mol_ids command"); + } else if (strcmp(arg[iarg], "offset") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "reset_atoms mol offset", error); + offset = utils::tnumeric(FLERR, arg[iarg + 1], true, lmp); + if (offset < -1) error->all(FLERR, "Illegal reset_atoms mol offset: {}", offset); iarg += 2; - } else error->all(FLERR,"Illegal reset_mol_ids command"); + } else + error->all(FLERR, "Unknown reset_atoms mol keyword: {}", arg[iarg]); } - if (comm->me == 0) utils::logmesg(lmp,"Resetting molecule IDs ...\n"); + if (comm->me == 0) utils::logmesg(lmp, "Resetting molecule IDs ...\n"); // record wall time for resetting molecule IDs @@ -112,11 +109,11 @@ void ResetMolIDs::command(int narg, char **arg) comm->setup(); comm->exchange(); comm->borders(); - if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); + if (domain->triclinic) domain->lamda2x(atom->nlocal + atom->nghost); // create computes - create_computes((char *) "COMMAND",groupid); + create_computes((char *) "COMMAND", groupid); // reset molecule IDs @@ -128,44 +125,43 @@ void ResetMolIDs::command(int narg, char **arg) if (comm->me == 0) { if (nchunk < 0) - utils::logmesg(lmp," number of new molecule IDs = unknown\n"); + utils::logmesg(lmp, " number of new molecule IDs = unknown\n"); else - utils::logmesg(lmp," number of new molecule IDs = {}\n",nchunk); - utils::logmesg(lmp," reset_mol_ids CPU = {:.3f} seconds\n", - platform::walltime()-time1); + utils::logmesg(lmp, " number of new molecule IDs = {}\n", nchunk); + utils::logmesg(lmp, " reset_atoms mol CPU = {:.3f} seconds\n", platform::walltime() - time1); } } /* ---------------------------------------------------------------------- - create computes used by reset_mol_ids + create computes used by reset_atoms_mol ------------------------------------------------------------------------- */ -void ResetMolIDs::create_computes(char *fixid, char *groupid) +void ResetAtomsMol::create_computes(char *fixid, char *groupid) { int igroup = group->find(groupid); - if (igroup == -1) error->all(FLERR,"Could not find reset_mol_ids group ID"); + if (igroup < 0) error->all(FLERR, "Could not find reset_atoms mol group {}", groupid); groupbit = group->bitmask[igroup]; // create instances of compute fragment/atom, compute reduce (if needed), // and compute chunk/atom. all use the group-ID for this command. // 'fixid' allows for creating independent instances of the computes - idfrag = fmt::format("{}_reset_mol_ids_FRAGMENT_ATOM",fixid); + idfrag = fmt::format("{}_reset_atoms_mol_FRAGMENT_ATOM", fixid); auto use_single = singleflag ? "yes" : "no"; - cfa = dynamic_cast( - modify->add_compute(fmt::format("{} {} fragment/atom single {}",idfrag,groupid,use_single))); + cfa = dynamic_cast(modify->add_compute( + fmt::format("{} {} fragment/atom single {}", idfrag, groupid, use_single))); - idchunk = fmt::format("{}_reset_mol_ids_CHUNK_ATOM",fixid); + idchunk = fmt::format("{}_reset_atoms_mol_CHUNK_ATOM", fixid); if (compressflag) - cca = dynamic_cast( - modify->add_compute(fmt::format("{} {} chunk/atom molecule compress yes",idchunk,groupid))); + cca = dynamic_cast(modify->add_compute( + fmt::format("{} {} chunk/atom molecule compress yes", idchunk, groupid))); } /* ---------------------------------------------------------------------- called from command() and directly from fixes that update molecules ------------------------------------------------------------------------- */ -void ResetMolIDs::reset() +void ResetAtomsMol::reset() { // invoke peratom method of compute fragment/atom // walks bond connectivity and assigns each atom a fragment ID @@ -181,8 +177,7 @@ void ResetMolIDs::reset() int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) - molecule[i] = static_cast (fragIDs[i]); + if (mask[i] & groupbit) molecule[i] = static_cast(fragIDs[i]); // if compressflag = 0, done // set nchunk = -1 since cannot easily determine # of new molecule IDs @@ -208,7 +203,7 @@ void ResetMolIDs::reset() for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) if (fragIDs[i] == 0.0) mysingle = 1; - MPI_Allreduce(&mysingle,&singleexist,1,MPI_INT,MPI_MAX,world); + MPI_Allreduce(&mysingle, &singleexist, 1, MPI_INT, MPI_MAX, world); if (singleexist) nchunk--; } @@ -220,10 +215,10 @@ void ResetMolIDs::reset() if (groupbit != 1) { tagint mymol = 0; for (int i = 0; i < nlocal; i++) - if (!(mask[i] & groupbit)) - mymol = MAX(mymol,molecule[i]); - MPI_Allreduce(&mymol,&offset,1,MPI_LMP_TAGINT,MPI_MAX,world); - } else offset = 0; + if (!(mask[i] & groupbit)) mymol = MAX(mymol, molecule[i]); + MPI_Allreduce(&mymol, &offset, 1, MPI_LMP_TAGINT, MPI_MAX, world); + } else + offset = 0; } // reset molecule ID for all atoms in group @@ -231,11 +226,14 @@ void ResetMolIDs::reset() for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - auto newid = static_cast(chunkIDs[i]); + auto newid = static_cast(chunkIDs[i]); if (singleexist) { - if (newid == 1) newid = 0; - else newid += offset - 1; - } else newid += offset; + if (newid == 1) + newid = 0; + else + newid += offset - 1; + } else + newid += offset; molecule[i] = newid; } } diff --git a/src/reset_mol_ids.h b/src/reset_atoms_mol.h similarity index 85% rename from src/reset_mol_ids.h rename to src/reset_atoms_mol.h index c25cb96726..3fad2560df 100644 --- a/src/reset_mol_ids.h +++ b/src/reset_atoms_mol.h @@ -13,21 +13,21 @@ #ifdef COMMAND_CLASS // clang-format off -CommandStyle(reset_mol_ids,ResetMolIDs); +CommandStyle(RESET_ATOMS_MOL,ResetAtomsMol); // clang-format on #else -#ifndef LMP_RESET_MOL_IDS_H -#define LMP_RESET_MOL_IDS_H +#ifndef LMP_RESET_ATOMS_MOL_H +#define LMP_RESET_ATOMS_MOL_H #include "command.h" namespace LAMMPS_NS { -class ResetMolIDs : public Command { +class ResetAtomsMol : public Command { public: - ResetMolIDs(class LAMMPS *); - ~ResetMolIDs() override; + ResetAtomsMol(class LAMMPS *); + ~ResetAtomsMol() override; void command(int, char **) override; void create_computes(char *, char *); void reset(); @@ -43,7 +43,6 @@ class ResetMolIDs : public Command { class ComputeFragmentAtom *cfa; class ComputeChunkAtom *cca; }; - } // namespace LAMMPS_NS #endif diff --git a/unittest/commands/CMakeLists.txt b/unittest/commands/CMakeLists.txt index c9a7c7df59..aa1bd22fa4 100644 --- a/unittest/commands/CMakeLists.txt +++ b/unittest/commands/CMakeLists.txt @@ -53,10 +53,10 @@ endif() target_link_libraries(test_kim_commands PRIVATE lammps GTest::GMock) add_test(NAME KimCommands COMMAND test_kim_commands) -add_executable(test_reset_ids test_reset_ids.cpp) -target_compile_definitions(test_reset_ids PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(test_reset_ids PRIVATE lammps GTest::GMock) -add_test(NAME ResetIDs COMMAND test_reset_ids) +add_executable(test_reset_atoms test_reset_atoms.cpp) +target_compile_definitions(test_reset_atoms PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(test_reset_atoms PRIVATE lammps GTest::GMock) +add_test(NAME ResetAtoms COMMAND test_reset_atoms) if(PKG_MOLECULE) add_executable(test_compute_global test_compute_global.cpp) diff --git a/unittest/commands/test_reset_ids.cpp b/unittest/commands/test_reset_atoms.cpp similarity index 68% rename from unittest/commands/test_reset_ids.cpp rename to unittest/commands/test_reset_atoms.cpp index a31f665159..a0afe36324 100644 --- a/unittest/commands/test_reset_ids.cpp +++ b/unittest/commands/test_reset_atoms.cpp @@ -17,6 +17,7 @@ #include "info.h" #include "input.h" #include "lammps.h" +#include "library.h" #include "output.h" #include "update.h" #include "utils.h" @@ -36,11 +37,11 @@ namespace LAMMPS_NS { #define STRINGIFY(val) XSTR(val) #define XSTR(val) #val -class ResetIDsTest : public LAMMPSTest { +class ResetAtomsIDTest : public LAMMPSTest { protected: void SetUp() override { - testbinary = "ResetIDsTest"; + testbinary = "ResetAtomsIDTest"; LAMMPSTest::SetUp(); if (info->has_style("atom", "full")) { BEGIN_HIDE_OUTPUT(); @@ -51,7 +52,7 @@ protected: } }; -TEST_F(ResetIDsTest, MolIDAll) +TEST_F(ResetAtomsIDTest, MolIDAll) { if (lmp->atom->natoms == 0) GTEST_SKIP(); @@ -89,7 +90,7 @@ TEST_F(ResetIDsTest, MolIDAll) // the original data file has two different molecule IDs // for two residues of the same molecule/fragment. BEGIN_HIDE_OUTPUT(); - command("reset_mol_ids all"); + command("reset_atoms mol all"); END_HIDE_OUTPUT(); ASSERT_EQ(molid[GETIDX(1)], 1); @@ -123,7 +124,7 @@ TEST_F(ResetIDsTest, MolIDAll) ASSERT_EQ(molid[GETIDX(29)], 5); } -TEST_F(ResetIDsTest, DeletePlusAtomID) +TEST_F(ResetAtomsIDTest, DeletePlusAtomID) { if (lmp->atom->natoms == 0) GTEST_SKIP(); @@ -134,7 +135,7 @@ TEST_F(ResetIDsTest, DeletePlusAtomID) command("group allwater molecule 3:6"); command("group twowater molecule 4:6:2"); command("delete_atoms group twowater compress no bond yes"); - command("reset_mol_ids all"); + command("reset_atoms mol all"); END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->natoms, 23); ASSERT_EQ(lmp->atom->map_tag_max, 26); @@ -193,7 +194,7 @@ TEST_F(ResetIDsTest, DeletePlusAtomID) ASSERT_GE(GETIDX(26), 0); BEGIN_HIDE_OUTPUT(); - command("reset_atom_ids"); + command("reset_atoms id"); END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->map_tag_max, 23); @@ -201,7 +202,7 @@ TEST_F(ResetIDsTest, DeletePlusAtomID) ASSERT_GE(GETIDX(i), 0); } -TEST_F(ResetIDsTest, PartialOffset) +TEST_F(ResetAtomsIDTest, PartialOffset) { if (lmp->atom->natoms == 0) GTEST_SKIP(); @@ -211,7 +212,7 @@ TEST_F(ResetIDsTest, PartialOffset) BEGIN_HIDE_OUTPUT(); command("group allwater molecule 3:6"); command("group nowater subtract all allwater"); - command("reset_mol_ids allwater offset 4"); + command("reset_atoms mol allwater offset 4"); END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->natoms, 29); ASSERT_EQ(lmp->atom->map_tag_max, 29); @@ -247,7 +248,7 @@ TEST_F(ResetIDsTest, PartialOffset) ASSERT_EQ(molid[GETIDX(29)], 8); BEGIN_HIDE_OUTPUT(); - command("reset_mol_ids nowater offset 0"); + command("reset_atoms mol nowater offset 0"); END_HIDE_OUTPUT(); ASSERT_EQ(molid[GETIDX(1)], 1); @@ -281,7 +282,7 @@ TEST_F(ResetIDsTest, PartialOffset) ASSERT_EQ(molid[GETIDX(29)], 8); } -TEST_F(ResetIDsTest, DeleteAdd) +TEST_F(ResetAtomsIDTest, DeleteAdd) { if (lmp->atom->natoms == 0) GTEST_SKIP(); @@ -293,7 +294,7 @@ TEST_F(ResetIDsTest, DeleteAdd) command("group twowater molecule 4:6:2"); command("group nowater subtract all allwater"); command("delete_atoms group twowater compress no bond yes mol yes"); - command("reset_mol_ids allwater"); + command("reset_atoms mol allwater"); END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->natoms, 23); ASSERT_EQ(lmp->atom->map_tag_max, 26); @@ -352,7 +353,7 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_GE(GETIDX(26), 0); BEGIN_HIDE_OUTPUT(); - command("reset_atom_ids sort yes"); + command("reset_atoms id sort yes"); END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->map_tag_max, 23); @@ -360,7 +361,7 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_GE(GETIDX(i), 0); BEGIN_HIDE_OUTPUT(); - command("reset_mol_ids nowater offset 1"); + command("reset_atoms mol nowater offset 1"); END_HIDE_OUTPUT(); ASSERT_EQ(molid[GETIDX(1)], 2); @@ -392,7 +393,7 @@ TEST_F(ResetIDsTest, DeleteAdd) command("create_atoms 2 single 1.0 0.0 0.0"); command("create_atoms 3 single 2.0 0.0 0.0"); command("create_atoms 4 single 3.0 0.0 0.0"); - command("reset_mol_ids all single yes"); + command("reset_atoms mol all single yes"); END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->natoms, 27); ASSERT_EQ(lmp->atom->map_tag_max, 27); @@ -406,7 +407,7 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_EQ(molid[GETIDX(27)], 7); BEGIN_HIDE_OUTPUT(); - command("reset_mol_ids all single no"); + command("reset_atoms mol all single no"); END_HIDE_OUTPUT(); ASSERT_EQ(molid[GETIDX(21)], 3); @@ -418,7 +419,7 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_EQ(molid[GETIDX(27)], 0); BEGIN_HIDE_OUTPUT(); - command("reset_mol_ids all compress no single yes"); + command("reset_atoms mol all compress no single yes"); END_HIDE_OUTPUT(); ASSERT_EQ(molid[GETIDX(21)], 21); @@ -430,7 +431,7 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_EQ(molid[GETIDX(27)], 27); } -TEST_F(ResetIDsTest, TopologyData) +TEST_F(ResetAtomsIDTest, TopologyData) { if (lmp->atom->natoms == 0) GTEST_SKIP(); @@ -525,7 +526,7 @@ TEST_F(ResetIDsTest, TopologyData) ASSERT_EQ(angle_atom3[GETIDX(24)][0], 26); BEGIN_HIDE_OUTPUT(); - command("reset_atom_ids sort yes"); + command("reset_atoms id sort yes"); END_HIDE_OUTPUT(); num_bond = lmp->atom->num_bond; @@ -618,63 +619,186 @@ TEST_F(ResetIDsTest, TopologyData) ASSERT_EQ(angle_atom3[GETIDX(22)][0], 23); } -TEST_F(ResetIDsTest, DeathTests) +TEST_F(ResetAtomsIDTest, DeathTests) { if (lmp->atom->natoms == 0) GTEST_SKIP(); - TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", command("reset_mol_ids");); - TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", - command("reset_mol_ids all offset 1 1");); - TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", - command("reset_mol_ids all offset -2");); - TEST_FAILURE(".*ERROR on proc 0: Expected integer.*", command("reset_mol_ids all offset xxx");); + TEST_FAILURE(".*ERROR: Illegal reset_atoms mol command.*", command("reset_atoms mol");); + TEST_FAILURE(".*ERROR: Unknown reset_atoms mol keyword: 1.*", + command("reset_atoms mol all offset 1 1");); + TEST_FAILURE(".*ERROR: Illegal reset_atoms mol offset: -2.*", + command("reset_atoms mol all offset -2");); TEST_FAILURE(".*ERROR on proc 0: Expected integer.*", - command("reset_mol_ids all compress yes single no offset xxx");); - TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", command("reset_mol_ids all offset");); - TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", - command("reset_mol_ids all compress");); + command("reset_atoms mol all offset xxx");); + TEST_FAILURE(".*ERROR on proc 0: Expected integer.*", + command("reset_atoms mol all compress yes single no offset xxx");); + TEST_FAILURE(".*ERROR: Illegal reset_atoms mol offset command: missing argument.*", + command("reset_atoms mol all offset");); + TEST_FAILURE(".*ERROR: Illegal reset_atoms mol compress command: missing argument.*", + command("reset_atoms mol all compress");); TEST_FAILURE(".*ERROR: Expected boolean parameter instead of 'xxx'.*", - command("reset_mol_ids all compress xxx");); - TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", command("reset_mol_ids all single");); + command("reset_atoms mol all compress xxx");); + TEST_FAILURE(".*ERROR: Illegal reset_atoms mol single command: missing argument.*", + command("reset_atoms mol all single");); TEST_FAILURE(".*ERROR: Expected boolean parameter instead of 'xxx'.*", - command("reset_mol_ids all single xxx");); + command("reset_atoms mol all single xxx");); + + TEST_FAILURE(".*ERROR: Illegal reset_atoms image command: missing argument.*", + command("reset_atoms image");); + TEST_FAILURE(".*ERROR: Unknown reset_atoms image keyword: xxx.*", + command("reset_atoms image all xxx");); + TEST_FAILURE(".*ERROR: Could not find reset_atoms image group xxx.*", + command("reset_atoms image xxx");); } -class ResetMolIDsTest : public LAMMPSTest { +class ResetAtomsMolTest : public LAMMPSTest { protected: void SetUp() override { - testbinary = "ResetIDsTest"; + testbinary = "ResetAtomsMolTest"; LAMMPSTest::SetUp(); } }; -TEST_F(ResetMolIDsTest, FailBeforeBox) +TEST_F(ResetAtomsMolTest, FailBeforeBox) { - TEST_FAILURE(".*ERROR: Reset_mol_ids command before simulation box is.*", - command("reset_mol_ids all");); + TEST_FAILURE(".*ERROR: Reset_atoms id command before simulation box is.*", + command("reset_atoms id");); + TEST_FAILURE(".*ERROR: Reset_atoms mol command before simulation box is.*", + command("reset_atoms mol all");); + TEST_FAILURE(".*ERROR: Reset_atoms image command before simulation box is.*", + command("reset_atoms image all");); } -TEST_F(ResetMolIDsTest, FailMissingId) +TEST_F(ResetAtomsMolTest, FailMissingId) { BEGIN_HIDE_OUTPUT(); command("atom_modify id no"); command("region box block 0 1 0 1 0 1"); command("create_box 1 box"); END_HIDE_OUTPUT(); - TEST_FAILURE(".*ERROR: Cannot use reset_mol_ids unless.*", command("reset_mol_ids all");); + TEST_FAILURE(".*ERROR: Cannot use reset_atoms mol unless.*", command("reset_atoms mol all");); + TEST_FAILURE(".*ERROR: Cannot use reset_atoms image unless.*", + command("reset_atoms image all");); } -TEST_F(ResetMolIDsTest, FailOnlyMolecular) +TEST_F(ResetAtomsMolTest, FailOnlyMolecular) { BEGIN_HIDE_OUTPUT(); command("clear"); command("region box block 0 1 0 1 0 1"); command("create_box 1 box"); END_HIDE_OUTPUT(); - TEST_FAILURE(".*ERROR: Can only use reset_mol_ids.*", command("reset_mol_ids all");); + TEST_FAILURE(".*ERROR: Can only use reset_atoms mol.*", command("reset_atoms mol all");); } + +class ResetAtomsImageTest : public LAMMPSTest { +protected: + void SetUp() override + { + testbinary = "ResetAtomsImageTest"; + LAMMPSTest::SetUp(); + if (info->has_style("atom", "full")) { + BEGIN_HIDE_OUTPUT(); + command("variable input_dir index \"" STRINGIFY(TEST_INPUT_FOLDER) "\""); + command("include \"${input_dir}/in.fourmol\""); + command("create_atoms 1 single 1.0 1.0 1.0"); + command("create_atoms 1 single 2.0 1.0 1.0"); + command("create_atoms 1 single 1.0 2.0 1.0"); + command("set atom 1*7 image 1 1 -1"); + command("set atom 8*9 image 2 -1 0"); + command("set atom 8*9 image 2 -1 0"); + command("set atom 10 image 2 0 0"); + command("set atom 11*12 image 2 0 -1"); + command("set atom 13*15 image 1 0 0"); + command("set atom 16*17 image 0 1 1"); + command("set atom 18*19 image 0 1 0"); + command("set atom 20 image 0 2 0"); + command("set atom 21*23 image 20 -1 0"); + command("set atom 27*28 image 1 0 0"); + command("set atom 29 image 1 2 0"); + command("set atom 31 image -2 0 1"); + command("set atom 32 image 0 20 0"); + END_HIDE_OUTPUT(); + } + } +}; + +TEST_F(ResetAtomsImageTest, ResetAtomsImage) +{ + if (lmp->atom->natoms == 0) GTEST_SKIP(); + EXPECT_EQ(lmp->atom->image[GETIDX(1)], lammps_encode_image_flags(1, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(2)], lammps_encode_image_flags(1, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(3)], lammps_encode_image_flags(1, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(4)], lammps_encode_image_flags(1, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(5)], lammps_encode_image_flags(1, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(6)], lammps_encode_image_flags(1, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(7)], lammps_encode_image_flags(1, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(8)], lammps_encode_image_flags(2, -1, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(9)], lammps_encode_image_flags(2, -1, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(10)], lammps_encode_image_flags(2, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(11)], lammps_encode_image_flags(2, 0, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(12)], lammps_encode_image_flags(2, 0, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(13)], lammps_encode_image_flags(1, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(14)], lammps_encode_image_flags(1, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(15)], lammps_encode_image_flags(1, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(16)], lammps_encode_image_flags(0, 1, 1)); + EXPECT_EQ(lmp->atom->image[GETIDX(17)], lammps_encode_image_flags(0, 1, 1)); + EXPECT_EQ(lmp->atom->image[GETIDX(18)], lammps_encode_image_flags(0, 1, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(19)], lammps_encode_image_flags(0, 1, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(20)], lammps_encode_image_flags(0, 2, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(21)], lammps_encode_image_flags(20, -1, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(22)], lammps_encode_image_flags(20, -1, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(23)], lammps_encode_image_flags(20, -1, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(24)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(25)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(26)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(27)], lammps_encode_image_flags(1, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(28)], lammps_encode_image_flags(1, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(29)], lammps_encode_image_flags(1, 2, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(30)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(31)], lammps_encode_image_flags(-2, 0, 1)); + EXPECT_EQ(lmp->atom->image[GETIDX(32)], lammps_encode_image_flags(0, 20, 0)); + BEGIN_HIDE_OUTPUT(); + command("group subset id 5:32"); + command("reset_atoms image subset"); + END_HIDE_OUTPUT(); + EXPECT_EQ(lmp->atom->image[GETIDX(1)], lammps_encode_image_flags(1, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(2)], lammps_encode_image_flags(1, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(3)], lammps_encode_image_flags(1, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(4)], lammps_encode_image_flags(1, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(5)], lammps_encode_image_flags(0, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(6)], lammps_encode_image_flags(0, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(7)], lammps_encode_image_flags(0, 1, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(8)], lammps_encode_image_flags(1, -1, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(9)], lammps_encode_image_flags(1, -1, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(10)], lammps_encode_image_flags(1, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(11)], lammps_encode_image_flags(1, 0, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(12)], lammps_encode_image_flags(1, 0, -1)); + EXPECT_EQ(lmp->atom->image[GETIDX(13)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(14)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(15)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(16)], lammps_encode_image_flags(-1, 1, 1)); + EXPECT_EQ(lmp->atom->image[GETIDX(17)], lammps_encode_image_flags(-1, 1, 1)); + EXPECT_EQ(lmp->atom->image[GETIDX(18)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(19)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(20)], lammps_encode_image_flags(0, 1, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(21)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(22)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(23)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(24)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(25)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(26)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(27)], lammps_encode_image_flags(0, -1, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(28)], lammps_encode_image_flags(0, -1, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(29)], lammps_encode_image_flags(0, 1, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(30)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(30)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(31)], lammps_encode_image_flags(0, 0, 0)); + EXPECT_EQ(lmp->atom->image[GETIDX(32)], lammps_encode_image_flags(0, 0, 0)); +} + } // namespace LAMMPS_NS int main(int argc, char **argv)