1 /*************************************************************************** 2 lj_gromacs.h 3 ------------------- 4 Trung Dac Nguyen (ORNL) 5 6 Class for acceleration of the lj/gromacs pair style. 7 8 __________________________________________________________________________ 9 This file is part of the LAMMPS Accelerator Library (LAMMPS_AL) 10 __________________________________________________________________________ 11 12 begin : 13 email : nguyentd@ornl.gov 14 ***************************************************************************/ 15 16 #ifndef LAL_LJ_GROMACS_H 17 #define LAL_LJ_GROMACS_H 18 19 #include "lal_base_atomic.h" 20 21 namespace LAMMPS_AL { 22 23 template <class numtyp, class acctyp> 24 class LJGROMACS : public BaseAtomic<numtyp, acctyp> { 25 public: 26 LJGROMACS(); 27 ~LJGROMACS(); 28 29 /// Clear any previous data and set up for a new LAMMPS run 30 /** \param max_nbors initial number of rows in the neighbor matrix 31 * \param cell_size cutoff + skin 32 * \param gpu_split fraction of particles handled by device 33 * 34 * Returns: 35 * - 0 if successful 36 * - -1 if fix gpu not found 37 * - -3 if there is an out of memory error 38 * - -4 if the GPU library was not compiled for GPU 39 * - -5 Double precision is not supported on card **/ 40 int init(const int ntypes, double **host_cutsq, 41 double **host_lj1, double **host_lj2, double **host_lj3, 42 double **host_lj4, double *host_special_lj, 43 const int nlocal, const int nall, const int max_nbors, 44 const int maxspecial, const double cell_size, 45 const double gpu_split, FILE *screen, 46 double **host_ljsw1, double **host_ljsw2, double **host_ljsw3, 47 double **host_ljsw4, double **host_ljsw5, 48 double **cut_inner, double **cut_inner_sq); 49 50 /// Clear all host and device data 51 /** \note This is called at the beginning of the init() routine **/ 52 void clear(); 53 54 /// Returns memory usage on device per atom 55 int bytes_per_atom(const int max_nbors) const; 56 57 /// Total host memory used by library for pair style 58 double host_memory_usage() const; 59 60 // --------------------------- TYPE DATA -------------------------- 61 62 /// lj1.x = lj1, lj1.y = lj2, lj1.z = cutsq, lj1.w = cut_inner_sq 63 UCL_D_Vec<numtyp4> lj1; 64 /// lj3.x = lj3, lj3.y = lj4, lj3.z = cut_inner, lj3.w = ljsw5 65 UCL_D_Vec<numtyp4> lj3; 66 /// ljsw.x = ljsw1, ljsw.y = ljsw2, ljsw.z = ljsw3, ljsw.w = ljsw4 67 UCL_D_Vec<numtyp4> ljsw; 68 /// Special LJ values [0-3] and Special Coul values [4-7] 69 UCL_D_Vec<numtyp> sp_lj; 70 71 /// If atom type constants fit in shared memory, use fast kernels 72 bool shared_types; 73 74 /// Number of atom types 75 int _lj_types; 76 77 private: 78 bool _allocated; 79 int loop(const int eflag, const int vflag); 80 }; 81 82 } 83 84 #endif 85