NAMD
ComputeImpropers.h
Go to the documentation of this file.
1 
7 #ifndef COMPUTEIMPROPERS_H
8 #define COMPUTEIMPROPERS_H
9 
10 #include "ComputeHomeTuples.h"
11 #include "ComputeSelfTuples.h"
12 #include "ReductionMgr.h"
13 
14 class Molecule;
15 class ImproperValue;
16 
17 class ImproperElem {
18 public:
19  // ComputeHomeTuples interface
20  enum { size = 4 };
25  static void computeForce(ImproperElem*, int, BigReal*, BigReal *);
26 
27  static void getMoleculePointers(Molecule*, int*, int32***, Improper**);
28  static void getParameterPointers(Parameters*, const ImproperValue**);
29  static void getTupleInfo(AtomSignature* sig, int *count, TupleSignature** t) {
30  *count = sig->improperCnt;
31  *t = sig->improperSigs;
32  }
33 
34  // pressure profile parameters
39 
40  // Internal data
42 
43  int hash() const {
44  return 0x7FFFFFFF &((atomID[0]<<24) + (atomID[1]<<16) + (atomID[2]<<8) + atomID[3]);
45  }
50 
51  ImproperElem() { ; }
52 
53  ImproperElem(AtomID atom0, const TupleSignature *sig, const ImproperValue *v){
54  atomID[0] = atom0;
55  atomID[1] = atom0 + sig->offset[0];
56  atomID[2] = atom0 + sig->offset[1];
57  atomID[3] = atom0 + sig->offset[2];
58  value = &v[sig->tupleParamType];
59  }
60 
61  ImproperElem(const Improper *a, const ImproperValue *v) {
62  atomID[0] = a->atom1;
63  atomID[1] = a->atom2;
64  atomID[2] = a->atom3;
65  atomID[3] = a->atom4;
66  value = &v[a->improper_type];
67  }
68 
69  ImproperElem(AtomID atom0, AtomID atom1, AtomID atom2, AtomID atom3) {
70  if (atom0 > atom3) { // Swap end atoms so lowest is first!
71  AtomID tmp = atom3; atom3 = atom0; atom0 = tmp;
72  tmp = atom1; atom1 = atom2; atom2 = tmp;
73  }
74  atomID[0] = atom0;
75  atomID[1] = atom1;
76  atomID[2] = atom2;
77  atomID[3] = atom3;
78  }
80 
81  int operator==(const ImproperElem &a) const {
82  return (a.atomID[0] == atomID[0] && a.atomID[1] == atomID[1] &&
83  a.atomID[2] == atomID[2] && a.atomID[3] == atomID[3]);
84  }
85 
86  int operator<(const ImproperElem &a) const {
87  return (atomID[0] < a.atomID[0] ||
88  (atomID[0] == a.atomID[0] &&
89  (atomID[1] < a.atomID[1] ||
90  (atomID[1] == a.atomID[1] &&
91  (atomID[2] < a.atomID[2] ||
92  (atomID[2] == a.atomID[2] &&
93  atomID[3] < a.atomID[3]
94  ))))));
95  }
96 };
97 
98 class ComputeImpropers : public ComputeHomeTuples<ImproperElem,Improper,ImproperValue>
99 {
100 public:
101 
103 
104 };
105 
106 class ComputeSelfImpropers : public ComputeSelfTuples<ImproperElem,Improper,ImproperValue>
107 {
108 public:
109 
111 
112 };
113 
114 #endif
115 
static int pressureProfileAtomTypes
int32 atom4
Definition: structures.h:75
Index improper_type
Definition: structures.h:76
static void submitReductionData(BigReal *, SubmitReduction *)
static void getMoleculePointers(Molecule *, int *, int32 ***, Improper **)
TuplePatchElem * p[size]
const ImproperValue * value
short int32
Definition: dumpdcd.c:24
int ComputeID
Definition: NamdTypes.h:183
int AtomID
Definition: NamdTypes.h:29
ComputeSelfImpropers(ComputeID c, PatchID p)
TupleSignature * improperSigs
Definition: structures.h:336
ImproperElem(const Improper *a, const ImproperValue *v)
float Real
Definition: common.h:109
AtomID atomID[size]
static void getParameterPointers(Parameters *, const ImproperValue **)
static BigReal pressureProfileMin
int hash() const
static int pressureProfileSlabs
int PatchID
Definition: NamdTypes.h:182
int operator<(const ImproperElem &a) const
int32 atom1
Definition: structures.h:72
int operator==(const ImproperElem &a) const
ComputeImpropers(ComputeID c, PatchIDList &p)
static void computeForce(ImproperElem *, int, BigReal *, BigReal *)
int localIndex[size]
Index tupleParamType
Definition: structures.h:202
int32 atom2
Definition: structures.h:73
ImproperElem(AtomID atom0, AtomID atom1, AtomID atom2, AtomID atom3)
static void getTupleInfo(AtomSignature *sig, int *count, TupleSignature **t)
static BigReal pressureProfileThickness
ImproperElem(AtomID atom0, const TupleSignature *sig, const ImproperValue *v)
int32 atom3
Definition: structures.h:74
double BigReal
Definition: common.h:114