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 BOND_CLASS 15 // clang-format off 16 BondStyle(fene/kk,BondFENEKokkos<LMPDeviceType>); 17 BondStyle(fene/kk/device,BondFENEKokkos<LMPDeviceType>); 18 BondStyle(fene/kk/host,BondFENEKokkos<LMPHostType>); 19 // clang-format on 20 #else 21 22 // clang-format off 23 #ifndef LMP_BOND_FENE_KOKKOS_H 24 #define LMP_BOND_FENE_KOKKOS_H 25 26 #include "bond_fene.h" 27 #include "kokkos_type.h" 28 29 namespace LAMMPS_NS { 30 31 template<int NEWTON_BOND, int EVFLAG> 32 struct TagBondFENECompute{}; 33 34 template<class DeviceType> 35 class BondFENEKokkos : public BondFENE { 36 public: 37 typedef DeviceType device_type; 38 typedef EV_FLOAT value_type; 39 typedef ArrayTypes<DeviceType> AT; 40 41 BondFENEKokkos(class LAMMPS *); 42 virtual ~BondFENEKokkos(); 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()(TagBondFENECompute<NEWTON_BOND,EVFLAG>, const int&, EV_FLOAT&) const; 50 51 template<int NEWTON_BOND, int EVFLAG> 52 KOKKOS_INLINE_FUNCTION 53 void operator()(TagBondFENECompute<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, 58 const F_FLOAT &ebond, const F_FLOAT &fbond, const F_FLOAT &delx, 59 const F_FLOAT &dely, const F_FLOAT &delz) const; 60 61 protected: 62 63 class NeighborKokkos *neighborKK; 64 65 typename ArrayTypes<DeviceType>::t_x_array_randomread x; 66 typename ArrayTypes<DeviceType>::t_f_array f; 67 typename ArrayTypes<DeviceType>::t_int_2d bondlist; 68 69 DAT::tdual_efloat_1d k_eatom; 70 DAT::tdual_virial_array k_vatom; 71 typename ArrayTypes<DeviceType>::t_efloat_1d d_eatom; 72 typename ArrayTypes<DeviceType>::t_virial_array d_vatom; 73 74 DAT::tdual_int_scalar k_warning_flag; 75 typename AT::t_int_scalar d_warning_flag; 76 HAT::t_int_scalar h_warning_flag; 77 78 DAT::tdual_int_scalar k_error_flag; 79 typename AT::t_int_scalar d_error_flag; 80 HAT::t_int_scalar h_error_flag; 81 82 int nlocal,newton_bond; 83 int eflag,vflag; 84 85 DAT::tdual_ffloat_1d k_k; 86 DAT::tdual_ffloat_1d k_r0; 87 DAT::tdual_ffloat_1d k_epsilon; 88 DAT::tdual_ffloat_1d k_sigma; 89 90 typename AT::t_ffloat_1d d_k; 91 typename AT::t_ffloat_1d d_r0; 92 typename AT::t_ffloat_1d d_epsilon; 93 typename AT::t_ffloat_1d d_sigma; 94 95 void allocate(); 96 }; 97 98 } 99 100 #endif 101 #endif 102 103 /* ERROR/WARNING messages: 104 105 W: FENE bond too long 106 107 A FENE bond has stretched dangerously far. It's interaction strength 108 will be truncated to attempt to prevent the bond from blowing up. 109 110 E: Bad FENE bond 111 112 Two atoms in a FENE bond have become so far apart that the bond cannot 113 be computed. 114 115 */ 116