rename compute local/comp/atom to composition/atom

This commit is contained in:
Axel Kohlmeyer
2023-08-23 14:06:44 -04:00
parent 476446d93c
commit 00345ce8c3
8 changed files with 56 additions and 56 deletions

View File

@ -91,7 +91,7 @@ KOKKOS, o = OPENMP, t = OPT.
* :doc:`ke/atom/eff <compute_ke_atom_eff>` * :doc:`ke/atom/eff <compute_ke_atom_eff>`
* :doc:`ke/eff <compute_ke_eff>` * :doc:`ke/eff <compute_ke_eff>`
* :doc:`ke/rigid <compute_ke_rigid>` * :doc:`ke/rigid <compute_ke_rigid>`
* :doc:`local/comp/atom (k) <compute_local_comp_atom>` * :doc:`composition/atom (k) <compute_composition_atom>`
* :doc:`mliap <compute_mliap>` * :doc:`mliap <compute_mliap>`
* :doc:`momentum <compute_momentum>` * :doc:`momentum <compute_momentum>`
* :doc:`msd <compute_msd>` * :doc:`msd <compute_msd>`

View File

@ -245,7 +245,7 @@ The individual style names on the :doc:`Commands compute <Commands_compute>` pag
* :doc:`ke/atom/eff <compute_ke_atom_eff>` - per-atom translational and radial kinetic energy in the electron force field model * :doc:`ke/atom/eff <compute_ke_atom_eff>` - per-atom translational and radial kinetic energy in the electron force field model
* :doc:`ke/eff <compute_ke_eff>` - kinetic energy of a group of nuclei and electrons in the electron force field model * :doc:`ke/eff <compute_ke_eff>` - kinetic energy of a group of nuclei and electrons in the electron force field model
* :doc:`ke/rigid <compute_ke_rigid>` - translational kinetic energy of rigid bodies * :doc:`ke/rigid <compute_ke_rigid>` - translational kinetic energy of rigid bodies
* :doc:`local/comp/atom <compute_local_comp_atom>` - local composition for each atom * :doc:`composition/atom <compute_composition_atom>` - local composition for each atom
* :doc:`mliap <compute_mliap>` - gradients of energy and forces with respect to model parameters and related quantities for training machine learning interatomic potentials * :doc:`mliap <compute_mliap>` - gradients of energy and forces with respect to model parameters and related quantities for training machine learning interatomic potentials
* :doc:`momentum <compute_momentum>` - translational momentum * :doc:`momentum <compute_momentum>` - translational momentum
* :doc:`msd <compute_msd>` - mean-squared displacement of group of atoms * :doc:`msd <compute_msd>` - mean-squared displacement of group of atoms

View File

@ -1,20 +1,20 @@
.. index:: compute local/comp/atom .. index:: compute composition/atom
.. index:: compute local/comp/atom/kk .. index:: compute composition/atom/kk
compute local/comp/atom command compute composition/atom command
=============================== ================================
Accelerator Variants: *local/comp/atom/kk* Accelerator Variants: *composition/atom/kk*
Syntax Syntax
"""""" """"""
.. code-block:: LAMMPS .. code-block:: LAMMPS
compute ID group-ID local/comp/atom keyword values ... compute ID group-ID composition/atom keyword values ...
* ID, group-ID are documented in :doc:`compute <compute>` command * ID, group-ID are documented in :doc:`compute <compute>` command
* local/comp/atom = style name of this compute command * composition/atom = style name of this compute command
* one or more keyword/value pairs may be appended * one or more keyword/value pairs may be appended
.. parsed-literal:: .. parsed-literal::
@ -27,9 +27,9 @@ Examples
.. code-block:: LAMMPS .. code-block:: LAMMPS
compute 1 all local/comp/atom compute 1 all composition/atom
compute 1 all local/comp/atom cutoff 9.0 compute 1 all composition/atom cutoff 9.0
comm_modify cutoff 9.0 comm_modify cutoff 9.0

4
src/.gitignore vendored
View File

@ -580,8 +580,8 @@
/compute_ke_eff.h /compute_ke_eff.h
/compute_ke_rigid.cpp /compute_ke_rigid.cpp
/compute_ke_rigid.h /compute_ke_rigid.h
/compute_local_comp_atom.cpp /compute_composition_atom.cpp
/compute_local_comp_atom.h /compute_composition_atom.h
/compute_meso_e_atom.cpp /compute_meso_e_atom.cpp
/compute_meso_e_atom.h /compute_meso_e_atom.h
/compute_meso_rho_atom.cpp /compute_meso_rho_atom.cpp

View File

@ -15,7 +15,7 @@
Contributing author: Megan McCarthy (SNL) Contributing author: Megan McCarthy (SNL)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "compute_local_comp_atom.h" #include "compute_composition_atom.h"
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
@ -37,22 +37,22 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeLocalCompAtom::ComputeLocalCompAtom(LAMMPS *lmp, int narg, char **arg) : ComputeCompositionAtom::ComputeCompositionAtom(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), list(nullptr), result(nullptr) Compute(lmp, narg, arg), list(nullptr), result(nullptr)
{ {
if (narg < 3 || narg > 5) error->all(FLERR, "Illegal compute local/comp/atom command"); if (narg < 3 || narg > 5) error->all(FLERR, "Illegal compute composition/atom command");
cutsq = cutoff = 0.0; cutsq = cutoff = 0.0;
int iarg = 3; int iarg = 3;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg], "cutoff") == 0) { if (strcmp(arg[iarg], "cutoff") == 0) {
if (iarg + 2 > narg) error->all(FLERR, "Illegal compute local/comp/atom command"); if (iarg + 2 > narg) error->all(FLERR, "Illegal compute composition/atom command");
cutoff = utils::numeric(FLERR, arg[iarg + 1], false, lmp); cutoff = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
if (cutoff <= 0.0) error->all(FLERR, "Illegal compute local/comp/atom command"); if (cutoff <= 0.0) error->all(FLERR, "Illegal compute composition/atom command");
iarg += 2; iarg += 2;
} else } else
error->all(FLERR, "Illegal compute local/comp/atom command"); error->all(FLERR, "Illegal compute composition/atom command");
} }
peratom_flag = 1; peratom_flag = 1;
@ -65,7 +65,7 @@ ComputeLocalCompAtom::ComputeLocalCompAtom(LAMMPS *lmp, int narg, char **arg) :
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeLocalCompAtom::~ComputeLocalCompAtom() ComputeCompositionAtom::~ComputeCompositionAtom()
{ {
if (copymode) return; if (copymode) return;
@ -74,11 +74,11 @@ ComputeLocalCompAtom::~ComputeLocalCompAtom()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void ComputeLocalCompAtom::init() void ComputeCompositionAtom::init()
{ {
if (!force->pair && cutoff == 0.0) if (!force->pair && cutoff == 0.0)
error->all(FLERR, error->all(FLERR,
"Compute local/comp/atom requires a cutoff be specified " "Compute composition/atom requires a cutoff be specified "
"or a pair style be defined"); "or a pair style be defined");
double skin = neighbor->skin; double skin = neighbor->skin;
@ -91,7 +91,7 @@ void ComputeLocalCompAtom::init()
if (cutoff > cutghost) if (cutoff > cutghost)
error->all(FLERR, error->all(FLERR,
"Compute local/comp/atom cutoff exceeds ghost atom range - " "Compute composition/atom cutoff exceeds ghost atom range - "
"use comm_modify cutoff command"); "use comm_modify cutoff command");
} }
@ -111,14 +111,14 @@ void ComputeLocalCompAtom::init()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void ComputeLocalCompAtom::init_list(int /*id*/, NeighList *ptr) void ComputeCompositionAtom::init_list(int /*id*/, NeighList *ptr)
{ {
list = ptr; list = ptr;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void ComputeLocalCompAtom::compute_peratom() void ComputeCompositionAtom::compute_peratom()
{ {
int i, j, ii, jj, inum, jnum; int i, j, ii, jj, inum, jnum;
double xtmp, ytmp, ztmp, delx, dely, delz, rsq; double xtmp, ytmp, ztmp, delx, dely, delz, rsq;
@ -132,7 +132,7 @@ void ComputeLocalCompAtom::compute_peratom()
if (atom->nmax > nmax) { if (atom->nmax > nmax) {
memory->destroy(result); memory->destroy(result);
nmax = atom->nmax; nmax = atom->nmax;
memory->create(result, nmax, size_peratom_cols, "local/comp/atom:result"); memory->create(result, nmax, size_peratom_cols, "composition/atom:result");
array_atom = result; array_atom = result;
} }
@ -205,7 +205,7 @@ void ComputeLocalCompAtom::compute_peratom()
memory usage of local atom-based array memory usage of local atom-based array
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
double ComputeLocalCompAtom::memory_usage() double ComputeCompositionAtom::memory_usage()
{ {
double bytes = (double) 2 * nmax * sizeof(double); double bytes = (double) 2 * nmax * sizeof(double);
return bytes; return bytes;

View File

@ -13,21 +13,21 @@
#ifdef COMPUTE_CLASS #ifdef COMPUTE_CLASS
// clang-format off // clang-format off
ComputeStyle(local/comp/atom,ComputeLocalCompAtom); ComputeStyle(composition/atom,ComputeCompositionAtom);
// clang-format on // clang-format on
#else #else
#ifndef LMP_COMPUTE_LOCAL_COMP_ATOM_H #ifndef LMP_COMPUTE_COMPOSITION_ATOM_H
#define LMP_COMPUTE_LOCAL_COMP_ATOM_H #define LMP_COMPUTE_COMPOSITION_ATOM_H
#include "compute.h" #include "compute.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class ComputeLocalCompAtom : public Compute { class ComputeCompositionAtom : public Compute {
public: public:
ComputeLocalCompAtom(class LAMMPS *, int, char **); ComputeCompositionAtom(class LAMMPS *, int, char **);
~ComputeLocalCompAtom() override; ~ComputeCompositionAtom() override;
void init() override; void init() override;
void init_list(int, class NeighList *) override; void init_list(int, class NeighList *) override;
void compute_peratom() override; void compute_peratom() override;

View File

@ -15,7 +15,7 @@
Contributing author: Megan McCarthy (SNL) Contributing author: Megan McCarthy (SNL)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "compute_local_comp_atom_kokkos.h" #include "compute_composition_atom_kokkos.h"
#include "atom_kokkos.h" #include "atom_kokkos.h"
#include "atom_masks.h" #include "atom_masks.h"
@ -39,8 +39,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
template<class DeviceType> template<class DeviceType>
ComputeLocalCompAtomKokkos<DeviceType>::ComputeLocalCompAtomKokkos(LAMMPS *lmp, int narg, char **arg) : ComputeCompositionAtomKokkos<DeviceType>::ComputeCompositionAtomKokkos(LAMMPS *lmp, int narg, char **arg) :
ComputeLocalCompAtom(lmp, narg, arg) ComputeCompositionAtom(lmp, narg, arg)
{ {
kokkosable = 1; kokkosable = 1;
atomKK = (AtomKokkos *) atom; atomKK = (AtomKokkos *) atom;
@ -52,7 +52,7 @@ ComputeLocalCompAtomKokkos<DeviceType>::ComputeLocalCompAtomKokkos(LAMMPS *lmp,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
template<class DeviceType> template<class DeviceType>
ComputeLocalCompAtomKokkos<DeviceType>::~ComputeLocalCompAtomKokkos() ComputeCompositionAtomKokkos<DeviceType>::~ComputeCompositionAtomKokkos()
{ {
if (copymode) return; if (copymode) return;
@ -62,9 +62,9 @@ ComputeLocalCompAtomKokkos<DeviceType>::~ComputeLocalCompAtomKokkos()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
template<class DeviceType> template<class DeviceType>
void ComputeLocalCompAtomKokkos<DeviceType>::init() void ComputeCompositionAtomKokkos<DeviceType>::init()
{ {
ComputeLocalCompAtom::init(); ComputeCompositionAtom::init();
// adjust neighbor list request for KOKKOS // adjust neighbor list request for KOKKOS
@ -77,7 +77,7 @@ void ComputeLocalCompAtomKokkos<DeviceType>::init()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
template<class DeviceType> template<class DeviceType>
void ComputeLocalCompAtomKokkos<DeviceType>::compute_peratom() void ComputeCompositionAtomKokkos<DeviceType>::compute_peratom()
{ {
invoked_peratom = update->ntimestep; invoked_peratom = update->ntimestep;
@ -87,7 +87,7 @@ void ComputeLocalCompAtomKokkos<DeviceType>::compute_peratom()
if (atom->nmax > nmax) { if (atom->nmax > nmax) {
memoryKK->destroy_kokkos(k_result,result); memoryKK->destroy_kokkos(k_result,result);
nmax = atom->nmax; nmax = atom->nmax;
memoryKK->create_kokkos(k_result,result,nmax,size_peratom_cols,"local/comp/atom:result"); memoryKK->create_kokkos(k_result,result,nmax,size_peratom_cols,"composition/atom:result");
d_result = k_result.view<DeviceType>(); d_result = k_result.view<DeviceType>();
array_atom = result; array_atom = result;
} }
@ -114,7 +114,7 @@ void ComputeLocalCompAtomKokkos<DeviceType>::compute_peratom()
Kokkos::deep_copy(d_result,0.0); Kokkos::deep_copy(d_result,0.0);
copymode = 1; copymode = 1;
typename Kokkos::RangePolicy<DeviceType, TagComputeLocalCompAtom> policy(0,inum); typename Kokkos::RangePolicy<DeviceType, TagComputeCompositionAtom> policy(0,inum);
Kokkos::parallel_for("ComputeLocalComp",policy,*this); Kokkos::parallel_for("ComputeLocalComp",policy,*this);
copymode = 0; copymode = 0;
@ -124,7 +124,7 @@ void ComputeLocalCompAtomKokkos<DeviceType>::compute_peratom()
template<class DeviceType> template<class DeviceType>
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
void ComputeLocalCompAtomKokkos<DeviceType>::operator()(TagComputeLocalCompAtom, const int &ii) const void ComputeCompositionAtomKokkos<DeviceType>::operator()(TagComputeCompositionAtom, const int &ii) const
{ {
const int i = d_ilist[ii]; const int i = d_ilist[ii];
@ -173,8 +173,8 @@ void ComputeLocalCompAtomKokkos<DeviceType>::operator()(TagComputeLocalCompAtom,
} }
namespace LAMMPS_NS { namespace LAMMPS_NS {
template class ComputeLocalCompAtomKokkos<LMPDeviceType>; template class ComputeCompositionAtomKokkos<LMPDeviceType>;
#ifdef LMP_KOKKOS_GPU #ifdef LMP_KOKKOS_GPU
template class ComputeLocalCompAtomKokkos<LMPHostType>; template class ComputeCompositionAtomKokkos<LMPHostType>;
#endif #endif
} }

View File

@ -13,37 +13,37 @@
#ifdef COMPUTE_CLASS #ifdef COMPUTE_CLASS
// clang-format off // clang-format off
ComputeStyle(local/comp/atom/kk,ComputeLocalCompAtomKokkos<LMPDeviceType>); ComputeStyle(composition/atom/kk,ComputeCompositionAtomKokkos<LMPDeviceType>);
ComputeStyle(local/comp/atom/kk/device,ComputeLocalCompAtomKokkos<LMPDeviceType>); ComputeStyle(composition/atom/kk/device,ComputeCompositionAtomKokkos<LMPDeviceType>);
ComputeStyle(local/comp/atom/kk/host,ComputeLocalCompAtomKokkos<LMPHostType>); ComputeStyle(composition/atom/kk/host,ComputeCompositionAtomKokkos<LMPHostType>);
// clang-format on // clang-format on
#else #else
#ifndef LMP_COMPUTE_LOCAL_COMP_ATOM_KOKKOS_H #ifndef LMP_COMPUTE_COMPOSITION_ATOM_KOKKOS_H
#define LMP_COMPUTE_LOCAL_COMP_ATOM_KOKKOS_H #define LMP_COMPUTE_COMPOSITION_ATOM_KOKKOS_H
#include "compute_local_comp_atom.h" #include "compute_composition_atom.h"
#include "kokkos_type.h" #include "kokkos_type.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
// clang-format off // clang-format off
struct TagComputeLocalCompAtom {}; struct TagComputeCompositionAtom {};
// clang-format on // clang-format on
template <class DeviceType> class ComputeLocalCompAtomKokkos : public ComputeLocalCompAtom { template <class DeviceType> class ComputeCompositionAtomKokkos : public ComputeCompositionAtom {
public: public:
typedef DeviceType device_type; typedef DeviceType device_type;
typedef ArrayTypes<DeviceType> AT; typedef ArrayTypes<DeviceType> AT;
ComputeLocalCompAtomKokkos(class LAMMPS *, int, char **); ComputeCompositionAtomKokkos(class LAMMPS *, int, char **);
~ComputeLocalCompAtomKokkos() override; ~ComputeCompositionAtomKokkos() override;
void init() override; void init() override;
void compute_peratom() override; void compute_peratom() override;
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
void operator()(TagComputeLocalCompAtom, const int &) const; void operator()(TagComputeCompositionAtom, const int &) const;
private: private: