1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "neigh_list_kokkos.h"
#include "atom.h"
#include "memory_kokkos.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
template<class Device>
NeighListKokkos<Device>::NeighListKokkos(class LAMMPS *lmp):NeighList(lmp)
{
_stride = 1;
maxneighs = 16;
kokkos = 1;
maxatoms = 0;
execution_space = ExecutionSpaceFromDevice<Device>::space;
};
/* ---------------------------------------------------------------------- */
template<class Device>
void NeighListKokkos<Device>::grow(int nmax)
{
// skip if this list is already long enough to store nmax atoms
// and maxneighs neighbors
if (nmax <= maxatoms && d_neighbors.extent(1) >= maxneighs) return;
maxatoms = nmax;
k_ilist =
DAT::tdual_int_1d("neighlist:ilist",maxatoms);
d_ilist = k_ilist.view<Device>();
d_numneigh =
typename ArrayTypes<Device>::t_int_1d("neighlist:numneigh",maxatoms);
d_neighbors =
typename ArrayTypes<Device>::t_neighbors_2d("neighlist:neighbors",
maxatoms,maxneighs);
}
/* ---------------------------------------------------------------------- */
namespace LAMMPS_NS {
template class NeighListKokkos<LMPDeviceType>;
#ifdef KOKKOS_ENABLE_CUDA
template class NeighListKokkos<LMPHostType>;
#endif
}