Rename and relocate
This commit is contained in:
@ -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 <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 <Build_package>` page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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<class DeviceType>
|
||||
ComputePhaseAtomKokkos<DeviceType>::ComputePhaseAtomKokkos(LAMMPS *lmp, int narg, char **arg) :
|
||||
ComputePhaseAtom(lmp, narg, arg)
|
||||
ComputeAveSphereAtomKokkos<DeviceType>::ComputeAveSphereAtomKokkos(LAMMPS *lmp, int narg, char **arg) :
|
||||
ComputeAveSphereAtom(lmp, narg, arg)
|
||||
{
|
||||
kokkosable = 1;
|
||||
atomKK = (AtomKokkos *) atom;
|
||||
@ -50,19 +50,19 @@ ComputePhaseAtomKokkos<DeviceType>::ComputePhaseAtomKokkos(LAMMPS *lmp, int narg
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
ComputePhaseAtomKokkos<DeviceType>::~ComputePhaseAtomKokkos()
|
||||
ComputeAveSphereAtomKokkos<DeviceType>::~ComputeAveSphereAtomKokkos()
|
||||
{
|
||||
if (copymode) return;
|
||||
|
||||
memoryKK->destroy_kokkos(k_phase,phase);
|
||||
memoryKK->destroy_kokkos(k_result,result);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
void ComputePhaseAtomKokkos<DeviceType>::init()
|
||||
void ComputeAveSphereAtomKokkos<DeviceType>::init()
|
||||
{
|
||||
ComputePhaseAtom::init();
|
||||
ComputeAveSphereAtom::init();
|
||||
|
||||
// need an occasional full neighbor list
|
||||
|
||||
@ -80,18 +80,18 @@ void ComputePhaseAtomKokkos<DeviceType>::init()
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
void ComputePhaseAtomKokkos<DeviceType>::compute_peratom()
|
||||
void ComputeAveSphereAtomKokkos<DeviceType>::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<DeviceType>();
|
||||
array_atom = phase;
|
||||
memoryKK->create_kokkos(k_result,result,nmax,2,"ave/sphere/atom:result");
|
||||
d_result = k_result.view<DeviceType>();
|
||||
array_atom = result;
|
||||
}
|
||||
|
||||
// need velocities of ghost atoms
|
||||
@ -110,7 +110,7 @@ void ComputePhaseAtomKokkos<DeviceType>::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<DeviceType>::compute_peratom()
|
||||
v = atomKK->k_v.view<DeviceType>();
|
||||
mask = atomKK->k_mask.view<DeviceType>();
|
||||
|
||||
Kokkos::deep_copy(d_phase,0.0);
|
||||
Kokkos::deep_copy(d_result,0.0);
|
||||
|
||||
copymode = 1;
|
||||
typename Kokkos::RangePolicy<DeviceType, TagComputePhaseAtom> policy(0,inum);
|
||||
Kokkos::parallel_for("ComputePhaseAtom",policy,*this);
|
||||
typename Kokkos::RangePolicy<DeviceType, TagComputeAveSphereAtom> policy(0,inum);
|
||||
Kokkos::parallel_for("ComputeAveSphereAtom",policy,*this);
|
||||
copymode = 0;
|
||||
|
||||
k_phase.modify<DeviceType>();
|
||||
k_phase.sync_host();
|
||||
k_result.modify<DeviceType>();
|
||||
k_result.sync_host();
|
||||
}
|
||||
|
||||
template<class DeviceType>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ComputePhaseAtomKokkos<DeviceType>::operator()(TagComputePhaseAtom, const int &ii) const
|
||||
void ComputeAveSphereAtomKokkos<DeviceType>::operator()(TagComputeAveSphereAtom, const int &ii) const
|
||||
{
|
||||
const int i = d_ilist[ii];
|
||||
if (mask[i] & groupbit) {
|
||||
@ -196,14 +196,14 @@ void ComputePhaseAtomKokkos<DeviceType>::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<LMPDeviceType>;
|
||||
template class ComputeAveSphereAtomKokkos<LMPDeviceType>;
|
||||
#ifdef LMP_KOKKOS_GPU
|
||||
template class ComputePhaseAtomKokkos<LMPHostType>;
|
||||
template class ComputeAveSphereAtomKokkos<LMPHostType>;
|
||||
#endif
|
||||
}
|
||||
@ -13,35 +13,35 @@
|
||||
|
||||
#ifdef COMPUTE_CLASS
|
||||
|
||||
ComputeStyle(phase/atom/kk,ComputePhaseAtomKokkos<LMPDeviceType>)
|
||||
ComputeStyle(phase/atom/kk/device,ComputePhaseAtomKokkos<LMPDeviceType>)
|
||||
ComputeStyle(phase/atom/kk/host,ComputePhaseAtomKokkos<LMPHostType>)
|
||||
ComputeStyle(ave/sphere/atom/kk,ComputeAveSphereAtomKokkos<LMPDeviceType>)
|
||||
ComputeStyle(ave/sphere/atom/kk/device,ComputeAveSphereAtomKokkos<LMPDeviceType>)
|
||||
ComputeStyle(ave/sphere/atom/kk/host,ComputeAveSphereAtomKokkos<LMPHostType>)
|
||||
|
||||
#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 DeviceType>
|
||||
class ComputePhaseAtomKokkos : public ComputePhaseAtom {
|
||||
class ComputeAveSphereAtomKokkos : public ComputeAveSphereAtom {
|
||||
public:
|
||||
typedef DeviceType device_type;
|
||||
typedef ArrayTypes<DeviceType> 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;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user