diff --git a/doc/src/compute_phase_atom.rst b/doc/src/compute_ave_sphere_atom.rst similarity index 82% rename from doc/src/compute_phase_atom.rst rename to doc/src/compute_ave_sphere_atom.rst index 6540e52041..db04682865 100644 --- a/doc/src/compute_phase_atom.rst +++ b/doc/src/compute_ave_sphere_atom.rst @@ -1,20 +1,20 @@ -.. index:: compute phase/atom -.. index:: compute phase/atom/kk +.. index:: compute ave/sphere/atom +.. index:: compute ave/sphere/atom/kk -compute phase/atom command +compute ave/sphere/atom command ================================ -Accelerator Variants: *phase/atom/kk* +Accelerator Variants: *ave/sphere/atom/kk* Syntax """""" .. parsed-literal:: - compute ID group-ID phase/atom keyword values ... + compute ID group-ID ave/sphere/atom keyword values ... * ID, group-ID are documented in :doc:`compute ` command -* phase/atom = style name of this compute command +* ave/sphere/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 phase/atom + compute 1 all ave/sphere/atom - compute 1 all phase/atom cutoff 5.0 + compute 1 all ave/sphere/atom cutoff 5.0 comm_modify cutoff 5.0 Description @@ -86,7 +86,8 @@ page for an overview of LAMMPS output options. Restrictions """""""""""" -none +This compute is part of the EXTRA-COMPUTE package. It is only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` page for more info. Related commands """""""""""""""" diff --git a/src/Depend.sh b/src/Depend.sh index af88f24bb4..a8e17e0546 100755 --- a/src/Depend.sh +++ b/src/Depend.sh @@ -77,6 +77,10 @@ if (test $1 = "DPD-BASIC") then depend INTEL fi +if (test $1 = "EXTRA-COMPUTE") then + depend KOKKOS +fi + if (test $1 = "EXTRA-MOLECULE") then depend GPU depend OPENMP diff --git a/src/compute_phase_atom.cpp b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp similarity index 82% rename from src/compute_phase_atom.cpp rename to src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp index f8f5e35abf..14a4c364a1 100644 --- a/src/compute_phase_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "compute_phase_atom.h" +#include "compute_ave_sphere_atom.h" #include "atom.h" #include "comm.h" @@ -36,11 +36,11 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -ComputePhaseAtom::ComputePhaseAtom(LAMMPS *lmp, int narg, char **arg) : +ComputeAveSphereAtom::ComputeAveSphereAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - phase(nullptr) + result(nullptr) { - if (narg < 3 || narg > 5) error->all(FLERR,"Illegal compute phase/atom command"); + if (narg < 3 || narg > 5) error->all(FLERR,"Illegal compute ave/sphere/atom command"); // process optional args @@ -49,11 +49,11 @@ ComputePhaseAtom::ComputePhaseAtom(LAMMPS *lmp, int narg, char **arg) : int iarg = 3; while (iarg < narg) { if (strcmp(arg[iarg],"cutoff") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal compute phase/atom command"); + if (iarg+2 > narg) error->all(FLERR,"Illegal compute ave/sphere/atom command"); cutoff = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (cutoff <= 0.0) error->all(FLERR,"Illegal compute phase/atom command"); + if (cutoff <= 0.0) error->all(FLERR,"Illegal compute ave/sphere/atom command"); iarg += 2; - } else error->all(FLERR,"Illegal compute phase/atom command"); + } else error->all(FLERR,"Illegal compute ave/sphere/atom command"); } peratom_flag = 1; @@ -65,19 +65,19 @@ ComputePhaseAtom::ComputePhaseAtom(LAMMPS *lmp, int narg, char **arg) : /* ---------------------------------------------------------------------- */ -ComputePhaseAtom::~ComputePhaseAtom() +ComputeAveSphereAtom::~ComputeAveSphereAtom() { if (copymode) return; - memory->destroy(phase); + memory->destroy(result); } /* ---------------------------------------------------------------------- */ -void ComputePhaseAtom::init() +void ComputeAveSphereAtom::init() { if (!force->pair && cutoff == 0.0) - error->all(FLERR,"Compute phase/atom requires a cutoff be specified " + error->all(FLERR,"Compute ave/sphere/atom requires a cutoff be specified " "or a pair style be defined"); double skin = neighbor->skin; @@ -89,7 +89,7 @@ void ComputePhaseAtom::init() cutghost = comm->cutghostuser; if (cutoff > cutghost) - error->all(FLERR,"Compute phase/atom cutoff exceeds ghost atom range - " + error->all(FLERR,"Compute ave/sphere/atom cutoff exceeds ghost atom range - " "use comm_modify cutoff command"); } @@ -120,14 +120,14 @@ void ComputePhaseAtom::init() /* ---------------------------------------------------------------------- */ -void ComputePhaseAtom::init_list(int /*id*/, NeighList *ptr) +void ComputeAveSphereAtom::init_list(int /*id*/, NeighList *ptr) { list = ptr; } /* ---------------------------------------------------------------------- */ -void ComputePhaseAtom::compute_peratom() +void ComputeAveSphereAtom::compute_peratom() { int i,j,ii,jj,inum,jnum; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; @@ -137,13 +137,13 @@ void ComputePhaseAtom::compute_peratom() invoked_peratom = update->ntimestep; - // grow phase array if necessary + // grow result array if necessary if (atom->nmax > nmax) { - memory->destroy(phase); + memory->destroy(result); nmax = atom->nmax; - memory->create(phase,nmax,2,"phase/atom:phase"); - array_atom = phase; + memory->create(result,nmax,2,"ave/sphere/atom:result"); + array_atom = result; } // need velocities of ghost atoms @@ -159,7 +159,7 @@ void ComputePhaseAtom::compute_peratom() numneigh = list->numneigh; firstneigh = list->firstneigh; - // compute phase for each atom in group + // compute properties for each atom in group // use full neighbor list to count atoms less than cutoff double **x = atom->x; @@ -229,15 +229,15 @@ void ComputePhaseAtom::compute_peratom() } double density = count/sphere_vol; double temp = ke_sum/3.0/count; - phase[i][0] = density; - phase[i][1] = temp; + result[i][0] = density; + result[i][1] = temp; } } } /* ---------------------------------------------------------------------- */ -int ComputePhaseAtom::pack_forward_comm(int n, int *list, double *buf, +int ComputeAveSphereAtom::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { double **v = atom->v; @@ -254,7 +254,7 @@ int ComputePhaseAtom::pack_forward_comm(int n, int *list, double *buf, /* ---------------------------------------------------------------------- */ -void ComputePhaseAtom::unpack_forward_comm(int n, int first, double *buf) +void ComputeAveSphereAtom::unpack_forward_comm(int n, int first, double *buf) { double **v = atom->v; @@ -271,7 +271,7 @@ void ComputePhaseAtom::unpack_forward_comm(int n, int first, double *buf) memory usage of local atom-based array ------------------------------------------------------------------------- */ -double ComputePhaseAtom::memory_usage() +double ComputeAveSphereAtom::memory_usage() { double bytes = (double)2*nmax * sizeof(double); return bytes; diff --git a/src/compute_phase_atom.h b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.h similarity index 74% rename from src/compute_phase_atom.h rename to src/EXTRA-COMPUTE/compute_ave_sphere_atom.h index b39026b3b5..9b5e38750b 100644 --- a/src/compute_phase_atom.h +++ b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.h @@ -13,21 +13,21 @@ #ifdef COMPUTE_CLASS -ComputeStyle(phase/atom,ComputePhaseAtom) +ComputeStyle(ave/sphere/atom,ComputeAveSphereAtom) #else -#ifndef LMP_COMPUTE_PHASE_ATOM_H -#define LMP_COMPUTE_PHASE_ATOM_H +#ifndef LMP_COMPUTE_AVE_SPHERE_ATOM_H +#define LMP_COMPUTE_AVE_SPHERE_ATOM_H #include "compute.h" namespace LAMMPS_NS { -class ComputePhaseAtom : public Compute { +class ComputeAveSphereAtom : public Compute { public: - ComputePhaseAtom(class LAMMPS *, int, char **); - virtual ~ComputePhaseAtom(); + ComputeAveSphereAtom(class LAMMPS *, int, char **); + virtual ~ComputeAveSphereAtom(); virtual void init(); void init_list(int, class NeighList *); virtual void compute_peratom(); @@ -40,7 +40,7 @@ class ComputePhaseAtom : public Compute { double cutoff,cutsq,sphere_vol; class NeighList *list; - double **phase; + double **result; }; } @@ -56,11 +56,11 @@ Self-explanatory. Check the input script syntax and compare to the documentation for the command. You can use -echo screen as a command-line option when running LAMMPS to see the offending line. -E: Compute phase/atom requires a cutoff be specified or a pair style be defined +E: Compute ave/sphere/atom requires a cutoff be specified or a pair style be defined Self-explanatory. -E: Compute phase/atom cutoff exceeds ghost atom range - use comm_modify cutoff command +E: Compute ave/sphere/atom cutoff exceeds ghost atom range - use comm_modify cutoff command Self-explanatory. diff --git a/src/KOKKOS/Install.sh b/src/KOKKOS/Install.sh index ac5efec076..261a4d807a 100755 --- a/src/KOKKOS/Install.sh +++ b/src/KOKKOS/Install.sh @@ -88,12 +88,12 @@ action comm_kokkos.cpp action comm_kokkos.h action comm_tiled_kokkos.cpp action comm_tiled_kokkos.h +action compute_ave_sphere_atom_kokkos.cpp +action compute_ave_sphere_atom_kokkos.h action compute_coord_atom_kokkos.cpp action compute_coord_atom_kokkos.h action compute_orientorder_atom_kokkos.cpp action compute_orientorder_atom_kokkos.h -action compute_phase_atom_kokkos.cpp -action compute_phase_atom_kokkos.h action compute_temp_kokkos.cpp action compute_temp_kokkos.h action compute_temp_deform_kokkos.cpp diff --git a/src/KOKKOS/compute_phase_atom_kokkos.cpp b/src/KOKKOS/compute_ave_sphere_atom_kokkos.cpp similarity index 79% rename from src/KOKKOS/compute_phase_atom_kokkos.cpp rename to src/KOKKOS/compute_ave_sphere_atom_kokkos.cpp index 5a21393252..3f83c24fb6 100644 --- a/src/KOKKOS/compute_phase_atom_kokkos.cpp +++ b/src/KOKKOS/compute_ave_sphere_atom_kokkos.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "compute_phase_atom_kokkos.h" +#include "compute_ave_sphere_atom_kokkos.h" #include "atom_kokkos.h" #include "atom_masks.h" @@ -37,8 +37,8 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ template -ComputePhaseAtomKokkos::ComputePhaseAtomKokkos(LAMMPS *lmp, int narg, char **arg) : - ComputePhaseAtom(lmp, narg, arg) +ComputeAveSphereAtomKokkos::ComputeAveSphereAtomKokkos(LAMMPS *lmp, int narg, char **arg) : + ComputeAveSphereAtom(lmp, narg, arg) { kokkosable = 1; atomKK = (AtomKokkos *) atom; @@ -50,19 +50,19 @@ ComputePhaseAtomKokkos::ComputePhaseAtomKokkos(LAMMPS *lmp, int narg /* ---------------------------------------------------------------------- */ template -ComputePhaseAtomKokkos::~ComputePhaseAtomKokkos() +ComputeAveSphereAtomKokkos::~ComputeAveSphereAtomKokkos() { if (copymode) return; - memoryKK->destroy_kokkos(k_phase,phase); + memoryKK->destroy_kokkos(k_result,result); } /* ---------------------------------------------------------------------- */ template -void ComputePhaseAtomKokkos::init() +void ComputeAveSphereAtomKokkos::init() { - ComputePhaseAtom::init(); + ComputeAveSphereAtom::init(); // need an occasional full neighbor list @@ -80,18 +80,18 @@ void ComputePhaseAtomKokkos::init() /* ---------------------------------------------------------------------- */ template -void ComputePhaseAtomKokkos::compute_peratom() +void ComputeAveSphereAtomKokkos::compute_peratom() { invoked_peratom = update->ntimestep; - // grow phase array if necessary + // grow result array if necessary if (atom->nmax > nmax) { - memoryKK->destroy_kokkos(k_phase,phase); + memoryKK->destroy_kokkos(k_result,result); nmax = atom->nmax; - memoryKK->create_kokkos(k_phase,phase,nmax,2,"phase/atom:phase"); - d_phase = k_phase.view(); - array_atom = phase; + memoryKK->create_kokkos(k_result,result,nmax,2,"ave/sphere/atom:result"); + d_result = k_result.view(); + array_atom = result; } // need velocities of ghost atoms @@ -110,7 +110,7 @@ void ComputePhaseAtomKokkos::compute_peratom() d_neighbors = k_list->d_neighbors; d_ilist = k_list->d_ilist; - // compute phase for each atom in group + // compute properties for each atom in group // use full neighbor list to count atoms less than cutoff atomKK->sync(execution_space,X_MASK|V_MASK|TYPE_MASK|MASK_MASK); @@ -118,20 +118,20 @@ void ComputePhaseAtomKokkos::compute_peratom() v = atomKK->k_v.view(); mask = atomKK->k_mask.view(); - Kokkos::deep_copy(d_phase,0.0); + Kokkos::deep_copy(d_result,0.0); copymode = 1; - typename Kokkos::RangePolicy policy(0,inum); - Kokkos::parallel_for("ComputePhaseAtom",policy,*this); + typename Kokkos::RangePolicy policy(0,inum); + Kokkos::parallel_for("ComputeAveSphereAtom",policy,*this); copymode = 0; - k_phase.modify(); - k_phase.sync_host(); + k_result.modify(); + k_result.sync_host(); } template KOKKOS_INLINE_FUNCTION -void ComputePhaseAtomKokkos::operator()(TagComputePhaseAtom, const int &ii) const +void ComputeAveSphereAtomKokkos::operator()(TagComputeAveSphereAtom, const int &ii) const { const int i = d_ilist[ii]; if (mask[i] & groupbit) { @@ -196,14 +196,14 @@ void ComputePhaseAtomKokkos::operator()(TagComputePhaseAtom, const i } double density = count/sphere_vol; double temp = ke_sum/3.0/count; - d_phase(i,0) = density; - d_phase(i,1) = temp; + d_result(i,0) = density; + d_result(i,1) = temp; } } namespace LAMMPS_NS { -template class ComputePhaseAtomKokkos; +template class ComputeAveSphereAtomKokkos; #ifdef LMP_KOKKOS_GPU -template class ComputePhaseAtomKokkos; +template class ComputeAveSphereAtomKokkos; #endif } diff --git a/src/KOKKOS/compute_phase_atom_kokkos.h b/src/KOKKOS/compute_ave_sphere_atom_kokkos.h similarity index 63% rename from src/KOKKOS/compute_phase_atom_kokkos.h rename to src/KOKKOS/compute_ave_sphere_atom_kokkos.h index d65f3d571e..42607e5239 100644 --- a/src/KOKKOS/compute_phase_atom_kokkos.h +++ b/src/KOKKOS/compute_ave_sphere_atom_kokkos.h @@ -13,35 +13,35 @@ #ifdef COMPUTE_CLASS -ComputeStyle(phase/atom/kk,ComputePhaseAtomKokkos) -ComputeStyle(phase/atom/kk/device,ComputePhaseAtomKokkos) -ComputeStyle(phase/atom/kk/host,ComputePhaseAtomKokkos) +ComputeStyle(ave/sphere/atom/kk,ComputeAveSphereAtomKokkos) +ComputeStyle(ave/sphere/atom/kk/device,ComputeAveSphereAtomKokkos) +ComputeStyle(ave/sphere/atom/kk/host,ComputeAveSphereAtomKokkos) #else -#ifndef LMP_COMPUTE_PHASE_KOKKOS_ATOM_H -#define LMP_COMPUTE_PHASE_KOKKOS_ATOM_H +#ifndef LMP_COMPUTE_AVE_SPHERE_ATOM_KOKKOS_H +#define LMP_COMPUTE_AVE_SPHERE_ATOM_KOKKOS_H -#include "compute_phase_atom.h" +#include "compute_ave_sphere_atom.h" #include "kokkos_type.h" namespace LAMMPS_NS { -struct TagComputePhaseAtom{}; +struct TagComputeAveSphereAtom{}; template -class ComputePhaseAtomKokkos : public ComputePhaseAtom { +class ComputeAveSphereAtomKokkos : public ComputeAveSphereAtom { public: typedef DeviceType device_type; typedef ArrayTypes AT; - ComputePhaseAtomKokkos(class LAMMPS *, int, char **); - virtual ~ComputePhaseAtomKokkos(); + ComputeAveSphereAtomKokkos(class LAMMPS *, int, char **); + virtual ~ComputeAveSphereAtomKokkos(); void init(); void compute_peratom(); KOKKOS_INLINE_FUNCTION - void operator()(TagComputePhaseAtom, const int&) const; + void operator()(TagComputeAveSphereAtom, const int&) const; private: typename AT::t_x_array_randomread x; @@ -52,8 +52,8 @@ class ComputePhaseAtomKokkos : public ComputePhaseAtom { typename AT::t_int_1d_randomread d_ilist; typename AT::t_int_1d_randomread d_numneigh; - DAT::tdual_float_2d k_phase; - typename AT::t_float_2d d_phase; + DAT::tdual_float_2d k_result; + typename AT::t_float_2d d_result; }; }