NAMD
ComputeAngles.inl
Go to the documentation of this file.
1 
7 #ifndef COMPUTEANGLE_INL
8 #define COMPUTEANGLE_INL
9 
10 #include "ComputeAngles.h"
11 
12 inline AngleElem::AngleElem() { ; }
13 
14 inline AngleElem::AngleElem(AtomID atom0, const TupleSignature *sig, const AngleValue *v){
15  atomID[0] = atom0;
16  atomID[1] = atom0 + sig->offset[0];
17  atomID[2] = atom0 + sig->offset[1];
18  value = &v[sig->tupleParamType];
19 }
20 
21 inline AngleElem::AngleElem(const Angle *a, const AngleValue *v)
22  {
23  atomID[0] = a->atom1;
24  atomID[1] = a->atom2;
25  atomID[2] = a->atom3;
26  value = &v[a->angle_type];
27  }
28 
29 inline AngleElem::AngleElem(AtomID atom0, AtomID atom1, AtomID atom2)
30  {
31  if (atom0 > atom2) { // Swap end atoms so lowest is first!
32  AtomID tmp = atom2; atom2 = atom0; atom0 = tmp;
33  }
34  atomID[0] = atom0;
35  atomID[1] = atom1;
36  atomID[2] = atom2;
37  }
38 
39 inline int AngleElem::operator==(const AngleElem &a) const
40  {
41  return (a.atomID[0] == atomID[0] && a.atomID[1] == atomID[1] &&
42  a.atomID[2] == atomID[2]);
43  }
44 
45 inline int AngleElem::operator<(const AngleElem &a) const
46  {
47  return (atomID[0] < a.atomID[0] ||
48  (atomID[0] == a.atomID[0] &&
49  (atomID[1] < a.atomID[1] ||
50  (atomID[1] == a.atomID[1] &&
51  atomID[2] < a.atomID[2]) )));
52  }
53 
54 #endif
55 
int AtomID
Definition: NamdTypes.h:29
int operator<(const AngleElem &a) const
int32 atom2
Definition: structures.h:56
int32 atom1
Definition: structures.h:55
AtomID atomID[size]
Definition: ComputeAngles.h:20
int32 atom3
Definition: structures.h:57
Index angle_type
Definition: structures.h:58
int operator==(const AngleElem &a) const
Index tupleParamType
Definition: structures.h:202
const AngleValue * value
Definition: ComputeAngles.h:40