NAMD
ComputeSMDCUDA.h
Go to the documentation of this file.
1 #ifndef SMDCUDA_H
2 #define SMDCUDA_H
3 
4 #if defined NAMD_CUDA
5 #include <cuda.h>
6 #endif
7 
8 #include <vector>
9 #include "PatchMap.h"
10 #include "AtomMap.h"
11 #include "Lattice.h"
12 #include "CudaUtils.h"
13 #include "HipDefines.h"
14 
15 #if defined NAMD_CUDA || defined NAMD_HIP
16 #ifdef NODEGROUP_FORCE_REGISTER
17 class ComputeSMDCUDA{
18  public:
19  ComputeSMDCUDA(
20  std::vector<HomePatch*> &patchList,
21  double springConstant,
22  double transverseSpringConstant,
23  double velocity,
24  double3 direction,
25  int outputFrequency,
26  int firsttimestep,
27  const char* filename,
28  int numAtoms );
29 
30  ~ComputeSMDCUDA();
31 
32  void updateAtoms(
33  std::vector<AtomMap*> &atomMapsList,
34  std::vector<CudaLocalRecord> &localRecords,
35  const int* h_globalToLocalID);
36 
37  void doForce(
38  const int timeStep,
39  const Lattice &lat,
40  const bool doEnergy,
41  const float* d_mass,
42  const double* d_pos_x,
43  const double* d_pos_y,
44  const double* d_pos_z,
45  const char3* d_transform,
46  double* f_normal_x,
47  double* f_normal_y,
48  double* f_normal_z,
49  cudaTensor* d_extVirial,
50  double* h_extEnergy,
51  double3* h_extForce,
52  cudaTensor* h_extVirial,
53  cudaStream_t stream
54  );
55 
56  private:
57  double springConstant;
58  double transverseSpringConstant;
59  double velocity;
60  double inv_group_mass;
61  double3 direction;
62  double3 origCOM;
63  double3* curCOM;
64  double3* d_curCOM;
66  std::vector<HomePatch*> *patchList;
67  std::vector<int> smdAtomsGlobalIndex;
68  std::vector<int> smdAtomsSOAIndex;
69  int* d_smdAtomsSOAIndex;
70 
71  // JM: SMD needs to handle IO, so I need to have a pointer to the file somehow
72  int firstTimeStep;
73  const char* filename;
74  int outputFrequency;
75  int numAtoms;
76  int numSMDAtoms;
77 
78  unsigned int* d_tbcatomic;
80  void parseAtoms();
81 };
82 #endif // NODEGROUP_FORCE_REGISTER
83 
84 #endif // NAMD_CUDA
85 
86 #endif // SMDCUDA_H