1 // clang-format off
2 /* -*- c++ -*- ----------------------------------------------------------
3    LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
4    https://www.lammps.org/, Sandia National Laboratories
5    Steve Plimpton, sjplimp@sandia.gov
6 
7    Copyright (2003) Sandia Corporation.  Under the terms of Contract
8    DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
9    certain rights in this software.  This software is distributed under
10    the GNU General Public License.
11 
12    See the README file in the top-level LAMMPS directory.
13 ------------------------------------------------------------------------- */
14 
15 #ifndef LMP_NEIGHBOR_KOKKOS_H
16 #define LMP_NEIGHBOR_KOKKOS_H
17 
18 #include "neighbor.h"           // IWYU pragma: export
19 #include "neigh_list_kokkos.h"
20 #include "neigh_bond_kokkos.h"
21 #include "kokkos_type.h"
22 
23 namespace LAMMPS_NS {
24 
25 template<class DeviceType>
26 struct TagNeighborCheckDistance{};
27 
28 template<class DeviceType>
29 struct TagNeighborXhold{};
30 
31 class NeighborKokkos : public Neighbor {
32  public:
33   typedef int value_type;
34 
35   NeighborKokkos(class LAMMPS *);
36   ~NeighborKokkos();
37   void init();
38   void init_topology();
39   void build_topology();
40 
41   template<class DeviceType>
42   KOKKOS_INLINE_FUNCTION
43   void operator()(TagNeighborCheckDistance<DeviceType>, const int&, int&) const;
44 
45   template<class DeviceType>
46   KOKKOS_INLINE_FUNCTION
47   void operator()(TagNeighborXhold<DeviceType>, const int&) const;
48 
49   DAT::tdual_xfloat_2d k_cutneighsq;
50 
51   DAT::tdual_int_1d k_ex1_type,k_ex2_type;
52   DAT::tdual_int_2d k_ex_type;
53   DAT::tdual_int_1d k_ex1_group,k_ex2_group;
54   DAT::tdual_int_1d k_ex1_bit,k_ex2_bit;
55   DAT::tdual_int_1d k_ex_mol_group;
56   DAT::tdual_int_1d k_ex_mol_bit;
57   DAT::tdual_int_1d k_ex_mol_intra;
58 
59   NeighBondKokkos<LMPHostType> neighbond_host;
60   NeighBondKokkos<LMPDeviceType> neighbond_device;
61 
62   DAT::tdual_int_2d k_bondlist;
63   DAT::tdual_int_2d k_anglelist;
64   DAT::tdual_int_2d k_dihedrallist;
65   DAT::tdual_int_2d k_improperlist;
66 
67   int device_flag;
68 
69  private:
70 
71   DAT::tdual_x_array x;
72   DAT::tdual_x_array xhold;
73 
74   X_FLOAT deltasq;
75 
76   void init_cutneighsq_kokkos(int);
77   void create_kokkos_list(int);
78   void init_ex_type_kokkos(int);
79   void init_ex_bit_kokkos();
80   void init_ex_mol_bit_kokkos();
81   void grow_ex_mol_intra_kokkos();
82   virtual int check_distance();
83   template<class DeviceType> int check_distance_kokkos();
84   virtual void build(int);
85   template<class DeviceType> void build_kokkos(int);
86   void setup_bins_kokkos(int);
87   void modify_ex_type_grow_kokkos();
88   void modify_ex_group_grow_kokkos();
89   void modify_mol_group_grow_kokkos();
90   void modify_mol_intra_grow_kokkos();
91   void set_binsize_kokkos();
92 };
93 
94 }
95 
96 #endif
97 
98 /* ERROR/WARNING messages:
99 
100 E: KOKKOS package only supports 'bin' neighbor lists
101 
102 Self-explanatory.
103 
104 E: Too many local+ghost atoms for neighbor list
105 
106 The number of nlocal + nghost atoms on a processor
107 is limited by the size of a 32-bit integer with 2 bits
108 removed for masking 1-2, 1-3, 1-4 neighbors.
109 
110 */
111