1 /***************************************************************************
2                                     mie.h
3                              -------------------
4                             Trung Dac Nguyen (ORNL)
5 
6   Class for acceleration of the mie/cut 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_MIE_H
17 #define LAL_MIE_H
18 
19 #include "lal_base_atomic.h"
20 
21 namespace LAMMPS_AL {
22 
23 template <class numtyp, class acctyp>
24 class Mie : public BaseAtomic<numtyp, acctyp> {
25  public:
26   Mie();
27   ~Mie();
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 successfull
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_mie1, double **host_mie2, double **host_mie3,
42            double **host_mie4, double **host_gamA, double **host_gamR,
43            double **host_offset, double *host_special_lj,
44            const int nlocal, const int nall, const int max_nbors,
45            const int maxspecial, const double cell_size,
46            const double gpu_split, FILE *screen);
47 
48   /// Clear all host and device data
49   /** \note This is called at the beginning of the init() routine **/
50   void clear();
51 
52   /// Returns memory usage on device per atom
53   int bytes_per_atom(const int max_nbors) const;
54 
55   /// Total host memory used by library for pair style
56   double host_memory_usage() const;
57 
58   // --------------------------- TYPE DATA --------------------------
59 
60   /// mie1.x = mie1, mie1.y = mie2, mie1.z = gamA, mie1.w = gamR
61   UCL_D_Vec<numtyp4> mie1;
62   /// mie3.x = mie3, mie3.y = mie4, mie3.z = offset, mie3.w = cutsq
63   UCL_D_Vec<numtyp4> mie3;
64   /// Special Mie values
65   UCL_D_Vec<numtyp> sp_lj;
66 
67   /// If atom type constants fit in shared memory, use fast kernels
68   bool shared_types;
69 
70   /// Number of atom types
71   int _lj_types;
72 
73  private:
74   bool _allocated;
75   void loop(const bool _eflag, const bool _vflag);
76 };
77 
78 }
79 
80 #endif
81