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/eff <compute_ke_eff>`
* :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:`momentum <compute_momentum>`
* :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/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:`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:`momentum <compute_momentum>` - translational momentum
* :doc:`msd <compute_msd>` - mean-squared displacement of group of atoms

View File

@ -1,20 +1,20 @@
.. index:: compute local/comp/atom
.. index:: compute local/comp/atom/kk
.. index:: compute composition/atom
.. 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
""""""
.. 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
* 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
.. parsed-literal::
@ -27,9 +27,9 @@ Examples
.. 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

4
src/.gitignore vendored
View File

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

View File

@ -15,7 +15,7 @@
Contributing author: Megan McCarthy (SNL)
------------------------------------------------------------------------- */
#include "compute_local_comp_atom.h"
#include "compute_composition_atom.h"
#include "atom.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)
{
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;
int iarg = 3;
while (iarg < narg) {
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);
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;
} else
error->all(FLERR, "Illegal compute local/comp/atom command");
error->all(FLERR, "Illegal compute composition/atom command");
}
peratom_flag = 1;
@ -65,7 +65,7 @@ ComputeLocalCompAtom::ComputeLocalCompAtom(LAMMPS *lmp, int narg, char **arg) :
/* ---------------------------------------------------------------------- */
ComputeLocalCompAtom::~ComputeLocalCompAtom()
ComputeCompositionAtom::~ComputeCompositionAtom()
{
if (copymode) return;
@ -74,11 +74,11 @@ ComputeLocalCompAtom::~ComputeLocalCompAtom()
/* ---------------------------------------------------------------------- */
void ComputeLocalCompAtom::init()
void ComputeCompositionAtom::init()
{
if (!force->pair && cutoff == 0.0)
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");
double skin = neighbor->skin;
@ -91,7 +91,7 @@ void ComputeLocalCompAtom::init()
if (cutoff > cutghost)
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");
}
@ -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;
}
/* ---------------------------------------------------------------------- */
void ComputeLocalCompAtom::compute_peratom()
void ComputeCompositionAtom::compute_peratom()
{
int i, j, ii, jj, inum, jnum;
double xtmp, ytmp, ztmp, delx, dely, delz, rsq;
@ -132,7 +132,7 @@ void ComputeLocalCompAtom::compute_peratom()
if (atom->nmax > nmax) {
memory->destroy(result);
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;
}
@ -205,7 +205,7 @@ void ComputeLocalCompAtom::compute_peratom()
memory usage of local atom-based array
------------------------------------------------------------------------- */
double ComputeLocalCompAtom::memory_usage()
double ComputeCompositionAtom::memory_usage()
{
double bytes = (double) 2 * nmax * sizeof(double);
return bytes;

View File

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

View File

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

View File

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