Merge pull request #341 from stanmoore1/qeq_kk_neighlist

Make fix_qeq_reax_kokkos request its own neighbor list
This commit is contained in:
sjplimp 2017-01-17 09:13:47 -07:00 committed by GitHub
commit cd7bdf9251
2 changed files with 20 additions and 53 deletions

View File

@ -62,11 +62,6 @@ FixQEqReaxKokkos<DeviceType>::FixQEqReaxKokkos(LAMMPS *lmp, int narg, char **arg
nmax = nmax = m_cap = 0; nmax = nmax = m_cap = 0;
allocated_flag = 0; allocated_flag = 0;
reaxc = (PairReaxC *) force->pair_match("reax/c/kk",1);
use_pair_list = 0;
if (reaxc->execution_space == this->execution_space)
use_pair_list = 1;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -85,52 +80,27 @@ void FixQEqReaxKokkos<DeviceType>::init()
atomKK->k_q.modify<LMPHostType>(); atomKK->k_q.modify<LMPHostType>();
atomKK->k_q.sync<LMPDeviceType>(); atomKK->k_q.sync<LMPDeviceType>();
//FixQEqReax::init(); FixQEqReax::init();
{
if (!atom->q_flag) error->all(FLERR,"Fix qeq/reax requires atom attribute q");
ngroup = group->count(igroup);
if (ngroup == 0) error->all(FLERR,"Fix qeq/reax group has no atoms");
// need a half neighbor list w/ Newton off and ghost neighbors
// built whenever re-neighboring occurs
if (!use_pair_list) {
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->pair = 0;
neighbor->requests[irequest]->fix = 1;
neighbor->requests[irequest]->newton = 2;
neighbor->requests[irequest]->ghost = 1;
}
init_shielding();
init_taper();
if (strstr(update->integrate_style,"respa"))
nlevels_respa = ((Respa *) update->integrate)->nlevels;
}
neighflag = lmp->kokkos->neighflag; neighflag = lmp->kokkos->neighflag;
int irequest = neighbor->nrequest - 1;
if (!use_pair_list) {
int irequest = neighbor->nrequest - 1; neighbor->requests[irequest]->
neighbor->requests[irequest]-> kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value &&
kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value && !Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value;
!Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; neighbor->requests[irequest]->
neighbor->requests[irequest]-> kokkos_device = Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value;
kokkos_device = Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value;
if (neighflag == FULL) { if (neighflag == FULL) {
neighbor->requests[irequest]->fix = 1; neighbor->requests[irequest]->fix = 1;
neighbor->requests[irequest]->pair = 0; neighbor->requests[irequest]->pair = 0;
neighbor->requests[irequest]->full = 1; neighbor->requests[irequest]->full = 1;
neighbor->requests[irequest]->half = 0; neighbor->requests[irequest]->half = 0;
} else { //if (neighflag == HALF || neighflag == HALFTHREAD) } else { //if (neighflag == HALF || neighflag == HALFTHREAD)
neighbor->requests[irequest]->fix = 1; neighbor->requests[irequest]->fix = 1;
neighbor->requests[irequest]->full = 0; neighbor->requests[irequest]->full = 0;
neighbor->requests[irequest]->half = 1; neighbor->requests[irequest]->half = 1;
neighbor->requests[irequest]->ghost = 1; neighbor->requests[irequest]->ghost = 1;
}
} }
int ntypes = atom->ntypes; int ntypes = atom->ntypes;
@ -149,7 +119,6 @@ void FixQEqReaxKokkos<DeviceType>::init()
init_shielding_k(); init_shielding_k();
init_hist(); init_hist();
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -241,8 +210,6 @@ void FixQEqReaxKokkos<DeviceType>::pre_force(int vflag)
k_shield.template sync<DeviceType>(); k_shield.template sync<DeviceType>();
k_tap.template sync<DeviceType>(); k_tap.template sync<DeviceType>();
if (use_pair_list)
list = reaxc->list;
NeighListKokkos<DeviceType>* k_list = static_cast<NeighListKokkos<DeviceType>*>(list); NeighListKokkos<DeviceType>* k_list = static_cast<NeighListKokkos<DeviceType>*>(list);
d_numneigh = k_list->d_numneigh; d_numneigh = k_list->d_numneigh;
d_neighbors = k_list->d_neighbors; d_neighbors = k_list->d_neighbors;
@ -1260,4 +1227,4 @@ template class FixQEqReaxKokkos<LMPDeviceType>;
#ifdef KOKKOS_HAVE_CUDA #ifdef KOKKOS_HAVE_CUDA
template class FixQEqReaxKokkos<LMPHostType>; template class FixQEqReaxKokkos<LMPHostType>;
#endif #endif
} }

View File

@ -146,7 +146,7 @@ class FixQEqReaxKokkos : public FixQEqReax {
double memory_usage(); double memory_usage();
protected: protected:
int inum,use_pair_list; int inum;
int allocated_flag; int allocated_flag;
typedef Kokkos::DualView<int***,DeviceType> tdual_int_1d; typedef Kokkos::DualView<int***,DeviceType> tdual_int_1d;