NAMD
LjPmeMgr.h
Go to the documentation of this file.
1 /* modified from NAMD */
2 
9 #ifndef LJ_PME_MGR_H
10 #define LJ_PME_MGR_H
11 
12 #ifdef NAMD_FFTW
13 //#define MANUAL_DEBUG_FFTW3 1
14 #ifdef NAMD_FFTW_3
15 #include <fftw3.h>
16 #else
17 // fftw2 doesn't have these defined
18 #define fftwf_malloc fftw_malloc
19 #define fftwf_free fftw_free
20 #ifdef NAMD_FFTW_NO_TYPE_PREFIX
21 #include <fftw.h>
22 #include <rfftw.h>
23 #else
24 #include <sfftw.h>
25 #include <srfftw.h>
26 #endif
27 #endif
28 #endif
29 
30 #include "NamdTypes.h"
31 #include "LjPmeBase.h"
32 #include "LjPmeKSpace.h"
33 #include "LjPmeRealSpace.h"
34 #include "Lattice.h"
35 #include "InfoStream.h"
36 #include "SimParameters.h"
37 #include "common.h"
38 #include "Vector.h"
39 #include <string.h>
40 #include <stdio.h>
41 #include <math.h>
42 
43 class LjPmeKSpace;
44 class LjPmeRealSpace;
45 class SimParameters;
46 struct LjPmeGrid;
47 
48 class LjPmeMgr {
49 public:
50  LjPmeMgr() : myRealSpace(0), myKSpace(0), dataArr(0), qGrid(0),
51  q_arr(0), f_arr(0), fz_arr(0) {
52  setSelf = false;
53  initialized = false;
54  numAtoms = 0;
55  }
56  ~LjPmeMgr();
57  void initialize(const SimParameters *simParams, const int nAtoms);
58 
60  void computeLongRange(const double *ljPmeCoord,
61  const Lattice &lattice, const double &alphaLJ,
62  double *force, double &energy, double virial[][3], bool doEnergy);
63 
64  void optimizeFFT();
66  void setScaledCoordinates(const double *refPos, const Lattice &lattice);
68  void gridCalculation(const double &alpha, const Lattice &lattice);
70  double selfCompute(const double &alphaLJ);
71 
72  private:
73  LjPmeRealSpace *myRealSpace;
74  LjPmeKSpace *myKSpace;
75 
76  double *dataArr;
77  float **q_arr;
78  float *qGrid;
79  char *f_arr;
80  char *fz_arr;
82  #ifdef NAMD_FFTW
83  #ifdef NAMD_FFTW_3
84  fftwf_plan *forward_plan_x, *backward_plan_x;
85  fftwf_plan *forward_plan_yz, *backward_plan_yz;
86  fftwf_complex *work;
87  #else
88  fftw_plan forward_plan_x, backward_plan_x;
89  rfftwnd_plan forward_plan_yz, backward_plan_yz;
90  fftw_complex *work;
91  #endif
92  #else
93  float *work;
94  #endif
95 
96  LjPmeGrid myGrid;
97  double recipEnergy;
98  double selfEnergy;
99  double recipVirial[6];
100  int numAtoms;
101  int fsize;
102  int qsize;
103  bool setSelf; // Check if we already have calculated the self term
104  bool initialized;
105 };
106 
107 #endif
108 
void computeLongRange(const double *ljPmeCoord, const Lattice &lattice, const double &alphaLJ, double *force, double &energy, double virial[][3], bool doEnergy)
Definition: LjPmeMgr.C:158
void gridCalculation(const double &alpha, const Lattice &lattice)
Definition: LjPmeMgr.C:251
~LjPmeMgr()
Definition: LjPmeMgr.C:73
void setScaledCoordinates(const double *refPos, const Lattice &lattice)
Definition: LjPmeMgr.C:202
void initialize(const SimParameters *simParams, const int nAtoms)
Definition: LjPmeMgr.C:14
LjPmeMgr()
Definition: LjPmeMgr.h:50
void optimizeFFT()
Definition: LjPmeMgr.C:91
double selfCompute(const double &alphaLJ)
Definition: LjPmeMgr.C:321
#define simParams
Definition: Output.C:129