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