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 PAIR_CLASS 15 // clang-format off 16 PairStyle(lj/cut/coul/dsf/kk,PairLJCutCoulDSFKokkos<LMPDeviceType>); 17 PairStyle(lj/cut/coul/dsf/kk/device,PairLJCutCoulDSFKokkos<LMPDeviceType>); 18 PairStyle(lj/cut/coul/dsf/kk/host,PairLJCutCoulDSFKokkos<LMPHostType>); 19 // clang-format on 20 #else 21 22 // clang-format off 23 #ifndef LMP_PAIR_LJ_CUT_COUL_DSF_KOKKOS_H 24 #define LMP_PAIR_LJ_CUT_COUL_DSF_KOKKOS_H 25 26 #include "pair_kokkos.h" 27 #include "pair_lj_cut_coul_dsf.h" 28 #include "neigh_list_kokkos.h" 29 30 namespace LAMMPS_NS { 31 32 template<class DeviceType> 33 class PairLJCutCoulDSFKokkos : public PairLJCutCoulDSF { 34 public: 35 enum {EnabledNeighFlags=FULL|HALFTHREAD|HALF}; 36 enum {COUL_FLAG=1}; 37 typedef DeviceType device_type; 38 typedef ArrayTypes<DeviceType> AT; 39 PairLJCutCoulDSFKokkos(class LAMMPS *); 40 ~PairLJCutCoulDSFKokkos(); 41 42 void compute(int, int); 43 44 void init_style(); 45 double init_one(int, int); 46 47 protected: 48 template<bool STACKPARAMS, class Specialisation> 49 KOKKOS_INLINE_FUNCTION 50 F_FLOAT compute_fpair(const F_FLOAT& rsq, const int& i, const int&j, 51 const int& itype, const int& jtype) const; 52 53 template<bool STACKPARAMS, class Specialisation> 54 KOKKOS_INLINE_FUNCTION 55 F_FLOAT compute_fcoul(const F_FLOAT& rsq, const int& i, const int&j, 56 const int& itype, const int& jtype, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const; 57 58 template<bool STACKPARAMS, class Specialisation> 59 KOKKOS_INLINE_FUNCTION 60 F_FLOAT compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, 61 const int& itype, const int& jtype) const; 62 63 template<bool STACKPARAMS, class Specialisation> 64 KOKKOS_INLINE_FUNCTION 65 F_FLOAT compute_ecoul(const F_FLOAT& rsq, const int& i, const int&j, 66 const int& itype, const int& jtype, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const; 67 68 Kokkos::DualView<params_lj_coul**,Kokkos::LayoutRight,DeviceType> k_params; 69 typename Kokkos::DualView<params_lj_coul**, 70 Kokkos::LayoutRight,DeviceType>::t_dev_const_um params; 71 // hardwired to space for 12 atom types 72 params_lj_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; 73 74 F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; 75 F_FLOAT m_cut_ljsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; 76 F_FLOAT m_cut_coulsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; 77 typename AT::t_x_array_randomread x; 78 typename AT::t_x_array c_x; 79 typename AT::t_f_array f; 80 typename AT::t_int_1d_randomread type; 81 typename AT::t_float_1d_randomread q; 82 83 DAT::tdual_efloat_1d k_eatom; 84 DAT::tdual_virial_array k_vatom; 85 typename AT::t_efloat_1d d_eatom; 86 typename AT::t_virial_array d_vatom; 87 88 int newton_pair; 89 90 typename AT::tdual_ffloat_2d k_cutsq; 91 typename AT::t_ffloat_2d d_cutsq; 92 typename AT::tdual_ffloat_2d k_cut_ljsq; 93 typename AT::t_ffloat_2d d_cut_ljsq; 94 typename AT::t_ffloat_2d d_cut_coulsq; 95 96 int neighflag; 97 int nlocal,nall,eflag,vflag; 98 99 double special_coul[4]; 100 double special_lj[4]; 101 double qqrd2e; 102 103 void allocate(); 104 friend struct PairComputeFunctor<PairLJCutCoulDSFKokkos,FULL,true>; 105 friend struct PairComputeFunctor<PairLJCutCoulDSFKokkos,HALF,true>; 106 friend struct PairComputeFunctor<PairLJCutCoulDSFKokkos,HALFTHREAD,true>; 107 friend struct PairComputeFunctor<PairLJCutCoulDSFKokkos,FULL,false>; 108 friend struct PairComputeFunctor<PairLJCutCoulDSFKokkos,HALF,false>; 109 friend struct PairComputeFunctor<PairLJCutCoulDSFKokkos,HALFTHREAD,false>; 110 friend EV_FLOAT pair_compute_neighlist<PairLJCutCoulDSFKokkos,FULL,void>(PairLJCutCoulDSFKokkos*,NeighListKokkos<DeviceType>*); 111 friend EV_FLOAT pair_compute_neighlist<PairLJCutCoulDSFKokkos,HALF,void>(PairLJCutCoulDSFKokkos*,NeighListKokkos<DeviceType>*); 112 friend EV_FLOAT pair_compute_neighlist<PairLJCutCoulDSFKokkos,HALFTHREAD,void>(PairLJCutCoulDSFKokkos*,NeighListKokkos<DeviceType>*); 113 friend EV_FLOAT pair_compute<PairLJCutCoulDSFKokkos,void>(PairLJCutCoulDSFKokkos*, 114 NeighListKokkos<DeviceType>*); 115 friend void pair_virial_fdotr_compute<PairLJCutCoulDSFKokkos>(PairLJCutCoulDSFKokkos*); 116 117 }; 118 119 } 120 121 #endif 122 #endif 123 124 /* ERROR/WARNING messages: 125 126 E: Cannot use Kokkos pair style with rRESPA inner/middle 127 128 Self-explanatory. 129 130 E: Cannot use chosen neighbor list style with lj/cut/coul/cut/kk 131 132 That style is not supported by Kokkos. 133 134 */ 135