1 /* -*- c++ -*- ---------------------------------------------------------- 2 LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator 3 https://www.lammps.org/, Sandia National Laboratories 4 Steve Plimpton, sjplimp@sandia.gov 5 6 Copyright (2003) Sandia Corporation. Under the terms of Contract 7 DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains 8 certain rights in this software. This software is distributed under 9 the GNU General Public License. 10 11 See the README file in the top-level LAMMPS directory. 12 ------------------------------------------------------------------------- */ 13 14 #ifdef ATOM_CLASS 15 // clang-format off 16 AtomStyle(hybrid/kk,AtomVecHybridKokkos); 17 // clang-format on 18 #else 19 20 // clang-format off 21 #ifndef LMP_ATOM_VEC_HYBRID_KOKKOS_H 22 #define LMP_ATOM_VEC_HYBRID_KOKKOS_H 23 24 #include "atom_vec_kokkos.h" 25 #include "kokkos_type.h" 26 27 namespace LAMMPS_NS { 28 29 class AtomVecHybridKokkos : public AtomVecKokkos { 30 public: 31 int nstyles; 32 class AtomVec **styles; 33 char **keywords; 34 35 AtomVecHybridKokkos(class LAMMPS *); 36 ~AtomVecHybridKokkos(); 37 void process_args(int, char **); 38 void init(); 39 void grow(int); 40 void grow_pointers(); 41 void copy(int, int, int); 42 void clear_bonus(); 43 void force_clear(int, size_t); 44 int pack_comm(int, int *, double *, int, int *); 45 int pack_comm_vel(int, int *, double *, int, int *); 46 void unpack_comm(int, int, double *); 47 void unpack_comm_vel(int, int, double *); 48 int pack_reverse(int, int, double *); 49 void unpack_reverse(int, int *, double *); 50 int pack_border(int, int *, double *, int, int *); 51 int pack_border_vel(int, int *, double *, int, int *); 52 void unpack_border(int, int, double *); 53 void unpack_border_vel(int, int, double *); 54 int pack_exchange(int, double *); 55 int unpack_exchange(double *); 56 int size_restart(); 57 int pack_restart(int, double *); 58 int unpack_restart(double *); 59 void create_atom(int, double *); 60 void data_atom(double *, imageint, char **); data_atom_hybrid(int,char **)61 int data_atom_hybrid(int, char **) {return 0;} 62 void data_vel(int, char **); 63 void pack_data(double **); 64 void write_data(FILE *, int, double **); 65 void pack_vel(double **); 66 void write_vel(FILE *, int, double **); 67 int property_atom(char *); 68 void pack_property_atom(int, double *, int, int); 69 double memory_usage(); 70 71 int pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, 72 const int & iswap, 73 const DAT::tdual_xfloat_2d &buf, 74 const int &pbc_flag, const int pbc[]); 75 void unpack_comm_kokkos(const int &n, const int &nfirst, 76 const DAT::tdual_xfloat_2d &buf); 77 int pack_comm_self(const int &n, const DAT::tdual_int_2d &list, 78 const int & iswap, const int nfirst, 79 const int &pbc_flag, const int pbc[]); 80 int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, 81 DAT::tdual_xfloat_2d buf,int iswap, 82 int pbc_flag, int *pbc, ExecutionSpace space); 83 void unpack_border_kokkos(const int &n, const int &nfirst, 84 const DAT::tdual_xfloat_2d &buf, 85 ExecutionSpace space); 86 int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf, 87 DAT::tdual_int_1d k_sendlist, 88 DAT::tdual_int_1d k_copylist, 89 ExecutionSpace space, int dim, 90 X_FLOAT lo, X_FLOAT hi); 91 int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv, 92 int nlocal, int dim, X_FLOAT lo, X_FLOAT hi, 93 ExecutionSpace space); 94 95 void sync(ExecutionSpace space, unsigned int mask); 96 void modified(ExecutionSpace space, unsigned int mask); 97 void sync_overlapping_device(ExecutionSpace space, unsigned int mask); 98 99 private: 100 tagint *tag; 101 int *type,*mask; 102 imageint *image; 103 double **x,**v,**f; 104 double **omega,**angmom; 105 106 DAT::t_tagint_1d d_tag; 107 DAT::t_int_1d d_type, d_mask; 108 HAT::t_tagint_1d h_tag; 109 HAT::t_int_1d h_type, h_mask; 110 111 DAT::t_imageint_1d d_image; 112 HAT::t_imageint_1d h_image; 113 114 DAT::t_x_array d_x; 115 DAT::t_v_array d_v; 116 DAT::t_f_array d_f; 117 HAT::t_x_array h_x; 118 HAT::t_v_array h_v; 119 HAT::t_f_array h_f; 120 121 DAT::t_v_array d_omega, d_angmom; 122 HAT::t_v_array h_omega, h_angmom; 123 124 DAT::tdual_int_1d k_count; 125 126 int nallstyles; 127 char **allstyles; 128 129 void build_styles(); 130 int known_style(char *); 131 }; 132 133 } 134 135 #endif 136 #endif 137 138 /* ERROR/WARNING messages: 139 140 E: Atom style hybrid cannot have hybrid as an argument 141 142 Self-explanatory. 143 144 E: Atom style hybrid cannot use same atom style twice 145 146 Self-explanatory. 147 148 E: Cannot mix molecular and molecule template atom styles 149 150 Self-explanatory. 151 152 E: Per-processor system is too big 153 154 The number of owned atoms plus ghost atoms on a single 155 processor must fit in 32-bit integer. 156 157 E: AtomVecHybridKokkos doesn't yet support threaded comm 158 159 UNDOCUMENTED 160 161 E: Invalid atom h_type in Atoms section of data file 162 163 UNDOCUMENTED 164 165 U: Invalid atom type in Atoms section of data file 166 167 Atom types must range from 1 to specified # of types. 168 169 */ 170