1 /***************************************************************************
2                                  dpd.h
3                              -------------------
4                             Trung Dac Nguyen (ORNL)
5 
6   Class for acceleration of the dpd pair style.
7 
8  __________________________________________________________________________
9     This file is part of the LAMMPS Accelerator Library (LAMMPS_AL)
10  __________________________________________________________________________
11 
12     begin                : Jan 15, 2014
13     email                : nguyentd@ornl.gov
14  ***************************************************************************/
15 
16 #ifndef LAL_DPD_H
17 #define LAL_DPD_H
18 
19 #include "lal_base_dpd.h"
20 
21 namespace LAMMPS_AL {
22 
23 template <class numtyp, class acctyp>
24 class DPD : public BaseDPD<numtyp, acctyp> {
25  public:
26   DPD();
27   ~DPD();
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, double **host_a0,
41            double **host_gamma, double **host_sigma, double **host_cut,
42            double *host_special_lj, bool tstat_only, const int nlocal,
43            const int nall, const int max_nbors, const int maxspecial,
44            const double cell_size, const double gpu_split, FILE *screen);
45 
46   /// Clear all host and device data
47   /** \note This is called at the beginning of the init() routine **/
48   void clear();
49 
50   /// Returns memory usage on device per atom
51   int bytes_per_atom(const int max_nbors) const;
52 
53   /// Total host memory used by library for pair style
54   double host_memory_usage() const;
55 
56   /// Update coeff if needed (tstat only)
57   void update_coeff(int ntypes, double **host_a0, double **host_gamma,
58                     double **host_sigma, double **host_cut);
59 
60   // --------------------------- TYPE DATA --------------------------
61 
62   /// coeff.x = a0, coeff.y = gamma, coeff.z = sigma, coeff.w = cut
63   UCL_D_Vec<numtyp4> coeff;
64 
65   UCL_D_Vec<numtyp> cutsq;
66 
67   /// Special LJ values
68   UCL_D_Vec<numtyp> sp_lj;
69 
70   /// If atom type constants fit in shared memory, use fast kernels
71   bool shared_types;
72 
73   /// Number of atom types
74   int _lj_types;
75 
76   /// Only used for thermostat
77   int _tstat_only;
78 
79  private:
80   bool _allocated;
81   int loop(const int eflag, const int vflag);
82 };
83 
84 }
85 
86 #endif
87