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 ANGLE_CLASS 15 // clang-format off 16 AngleStyle(harmonic/kk,AngleHarmonicKokkos<LMPDeviceType>); 17 AngleStyle(harmonic/kk/device,AngleHarmonicKokkos<LMPDeviceType>); 18 AngleStyle(harmonic/kk/host,AngleHarmonicKokkos<LMPHostType>); 19 // clang-format on 20 #else 21 22 // clang-format off 23 #ifndef LMP_ANGLE_HARMONIC_KOKKOS_H 24 #define LMP_ANGLE_HARMONIC_KOKKOS_H 25 26 #include "angle_harmonic.h" 27 #include "kokkos_type.h" 28 29 namespace LAMMPS_NS { 30 31 template<int NEWTON_BOND, int EVFLAG> 32 struct TagAngleHarmonicCompute{}; 33 34 template<class DeviceType> 35 class AngleHarmonicKokkos : public AngleHarmonic { 36 37 public: 38 typedef DeviceType device_type; 39 typedef EV_FLOAT value_type; 40 41 AngleHarmonicKokkos(class LAMMPS *); 42 virtual ~AngleHarmonicKokkos(); 43 void compute(int, int); 44 void coeff(int, char **); 45 void read_restart(FILE *); 46 47 template<int NEWTON_BOND, int EVFLAG> 48 KOKKOS_INLINE_FUNCTION 49 void operator()(TagAngleHarmonicCompute<NEWTON_BOND,EVFLAG>, const int&, EV_FLOAT&) const; 50 51 template<int NEWTON_BOND, int EVFLAG> 52 KOKKOS_INLINE_FUNCTION 53 void operator()(TagAngleHarmonicCompute<NEWTON_BOND,EVFLAG>, const int&) const; 54 55 //template<int NEWTON_BOND> 56 KOKKOS_INLINE_FUNCTION 57 void ev_tally(EV_FLOAT &ev, const int i, const int j, const int k, 58 F_FLOAT &eangle, F_FLOAT *f1, F_FLOAT *f3, 59 const F_FLOAT &delx1, const F_FLOAT &dely1, const F_FLOAT &delz1, 60 const F_FLOAT &delx2, const F_FLOAT &dely2, const F_FLOAT &delz2) const; 61 62 protected: 63 64 class NeighborKokkos *neighborKK; 65 66 typename ArrayTypes<DeviceType>::t_x_array_randomread x; 67 typename ArrayTypes<DeviceType>::t_f_array f; 68 typename ArrayTypes<DeviceType>::t_int_2d anglelist; 69 70 typename ArrayTypes<DeviceType>::tdual_efloat_1d k_eatom; 71 typename ArrayTypes<DeviceType>::tdual_virial_array k_vatom; 72 typename ArrayTypes<DeviceType>::t_efloat_1d d_eatom; 73 typename ArrayTypes<DeviceType>::t_virial_array d_vatom; 74 75 int nlocal,newton_bond; 76 int eflag,vflag; 77 78 typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_k; 79 typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_theta0; 80 81 typename ArrayTypes<DeviceType>::t_ffloat_1d d_k; 82 typename ArrayTypes<DeviceType>::t_ffloat_1d d_theta0; 83 84 void allocate(); 85 }; 86 87 } 88 89 #endif 90 #endif 91 92 /* ERROR/WARNING messages: 93 94 */ 95