git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12405 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -31,6 +31,7 @@ AtomKokkos::AtomKokkos(LAMMPS *lmp) : Atom(lmp)
|
|||||||
// set CommKokkos pointer to Atom class, since CommKokkos allocated first
|
// set CommKokkos pointer to Atom class, since CommKokkos allocated first
|
||||||
|
|
||||||
((CommKokkos *) comm)->atomKK = this;
|
((CommKokkos *) comm)->atomKK = this;
|
||||||
|
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -48,8 +49,7 @@ AtomKokkos::~AtomKokkos()
|
|||||||
memory->destroy_kokkos(k_f, f);
|
memory->destroy_kokkos(k_f, f);
|
||||||
|
|
||||||
memory->destroy_kokkos(k_mass, mass);
|
memory->destroy_kokkos(k_mass, mass);
|
||||||
|
memory->destroy_kokkos(k_q, q);
|
||||||
memory->destroy_kokkos(k_q,q);
|
|
||||||
|
|
||||||
memory->destroy_kokkos(k_nspecial, nspecial);
|
memory->destroy_kokkos(k_nspecial, nspecial);
|
||||||
memory->destroy_kokkos(k_special, special);
|
memory->destroy_kokkos(k_special, special);
|
||||||
@ -73,7 +73,6 @@ AtomKokkos::~AtomKokkos()
|
|||||||
memory->destroy_kokkos(k_improper_atom2, improper_atom2);
|
memory->destroy_kokkos(k_improper_atom2, improper_atom2);
|
||||||
memory->destroy_kokkos(k_improper_atom3, improper_atom3);
|
memory->destroy_kokkos(k_improper_atom3, improper_atom3);
|
||||||
memory->destroy_kokkos(k_improper_atom4, improper_atom4);
|
memory->destroy_kokkos(k_improper_atom4, improper_atom4);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -204,6 +203,7 @@ void AtomKokkos::sort()
|
|||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
reallocate memory to the pointer selected by the mask
|
reallocate memory to the pointer selected by the mask
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void AtomKokkos::grow(unsigned int mask){
|
void AtomKokkos::grow(unsigned int mask){
|
||||||
|
|
||||||
if (mask && SPECIAL_MASK){
|
if (mask && SPECIAL_MASK){
|
||||||
@ -217,6 +217,8 @@ void AtomKokkos::grow(unsigned int mask){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void AtomKokkos::deallocate_topology()
|
void AtomKokkos::deallocate_topology()
|
||||||
{
|
{
|
||||||
memory->destroy_kokkos(k_bond_type, bond_type);
|
memory->destroy_kokkos(k_bond_type, bond_type);
|
||||||
@ -240,3 +242,15 @@ void AtomKokkos::deallocate_topology()
|
|||||||
memory->destroy_kokkos(k_improper_atom4, improper_atom4);
|
memory->destroy_kokkos(k_improper_atom4, improper_atom4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
perform sync and modify for each of 2 masks
|
||||||
|
called by individual styles to override default sync/modify calls
|
||||||
|
done at higher levels (Verlet,Modify,etc)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void AtomKokkos::sync_modify(unsigned int datamask_read,
|
||||||
|
unsigned int datamask_modify)
|
||||||
|
{
|
||||||
|
sync(execution_space,datamask_read);
|
||||||
|
modified(execution_space,datamask_modify);
|
||||||
|
}
|
||||||
|
|||||||
@ -28,7 +28,6 @@ class AtomKokkos : public Atom {
|
|||||||
DAT::tdual_v_array k_v;
|
DAT::tdual_v_array k_v;
|
||||||
DAT::tdual_f_array k_f;
|
DAT::tdual_f_array k_f;
|
||||||
|
|
||||||
|
|
||||||
DAT::tdual_float_1d k_mass;
|
DAT::tdual_float_1d k_mass;
|
||||||
|
|
||||||
DAT::tdual_float_1d k_q;
|
DAT::tdual_float_1d k_q;
|
||||||
@ -48,6 +47,8 @@ class AtomKokkos : public Atom {
|
|||||||
DAT::tdual_int_2d k_improper_type;
|
DAT::tdual_int_2d k_improper_type;
|
||||||
DAT::tdual_tagint_2d k_improper_atom1, k_improper_atom2, k_improper_atom3, k_improper_atom4;
|
DAT::tdual_tagint_2d k_improper_atom1, k_improper_atom2, k_improper_atom3, k_improper_atom4;
|
||||||
|
|
||||||
|
ExecutionSpace execution_space;
|
||||||
|
|
||||||
AtomKokkos(class LAMMPS *);
|
AtomKokkos(class LAMMPS *);
|
||||||
~AtomKokkos();
|
~AtomKokkos();
|
||||||
|
|
||||||
@ -57,6 +58,7 @@ class AtomKokkos : public Atom {
|
|||||||
virtual void sort();
|
virtual void sort();
|
||||||
virtual void grow(unsigned int mask);
|
virtual void grow(unsigned int mask);
|
||||||
virtual void deallocate_topology();
|
virtual void deallocate_topology();
|
||||||
|
void sync_modify(unsigned int, unsigned int);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class ViewType, class IndexView>
|
template<class ViewType, class IndexView>
|
||||||
|
|||||||
@ -34,7 +34,7 @@ FixNVEKokkos<DeviceType>::FixNVEKokkos(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
|
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
|
||||||
|
|
||||||
datamask_read = X_MASK | V_MASK | F_MASK | MASK_MASK | RMASS_MASK | TYPE_MASK;
|
datamask_read = X_MASK | V_MASK | F_MASK | MASK_MASK | RMASS_MASK | TYPE_MASK;
|
||||||
datamask_modify = X_MASK | V_MASK | F_MASK;
|
datamask_modify = X_MASK | V_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -222,6 +222,8 @@ class Atom : protected Pointers {
|
|||||||
int find_custom(char *, int &);
|
int find_custom(char *, int &);
|
||||||
int add_custom(char *, int);
|
int add_custom(char *, int);
|
||||||
void remove_custom(int, int);
|
void remove_custom(int, int);
|
||||||
|
|
||||||
|
virtual void sync_modify(unsigned int, unsigned int) {}
|
||||||
|
|
||||||
void *extract(char *);
|
void *extract(char *);
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
#include "fix_addforce.h"
|
#include "fix_addforce.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
|
#include "atom_masks.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
@ -75,13 +76,19 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// optional args
|
// optional args
|
||||||
|
|
||||||
|
nevery = 1;
|
||||||
iregion = -1;
|
iregion = -1;
|
||||||
idregion = NULL;
|
idregion = NULL;
|
||||||
estr = NULL;
|
estr = NULL;
|
||||||
|
|
||||||
int iarg = 6;
|
int iarg = 6;
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg],"region") == 0) {
|
if (strcmp(arg[iarg],"every") == 0) {
|
||||||
|
if (iarg+2 > narg) error->all(FLERR,"Illegal fix addforce command");
|
||||||
|
nevery = atoi(arg[iarg+1]);
|
||||||
|
if (nevery <= 0) error->all(FLERR,"Illegal fix addforce command");
|
||||||
|
iarg += 2;
|
||||||
|
} else if (strcmp(arg[iarg],"region") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix addforce command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal fix addforce command");
|
||||||
iregion = domain->find_region(arg[iarg+1]);
|
iregion = domain->find_region(arg[iarg+1]);
|
||||||
if (iregion == -1)
|
if (iregion == -1)
|
||||||
@ -124,6 +131,8 @@ FixAddForce::~FixAddForce()
|
|||||||
|
|
||||||
int FixAddForce::setmask()
|
int FixAddForce::setmask()
|
||||||
{
|
{
|
||||||
|
datamask_read = datamask_modify = 0;
|
||||||
|
|
||||||
int mask = 0;
|
int mask = 0;
|
||||||
mask |= POST_FORCE;
|
mask |= POST_FORCE;
|
||||||
mask |= THERMO_ENERGY;
|
mask |= THERMO_ENERGY;
|
||||||
@ -225,6 +234,11 @@ void FixAddForce::post_force(int vflag)
|
|||||||
imageint *image = atom->image;
|
imageint *image = atom->image;
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
|
if (update->ntimestep % nevery) return;
|
||||||
|
|
||||||
|
atom->sync_modify((unsigned int) (F_MASK | MASK_MASK),
|
||||||
|
(unsigned int) F_MASK);
|
||||||
|
|
||||||
// update region if necessary
|
// update region if necessary
|
||||||
|
|
||||||
Region *region = NULL;
|
Region *region = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user