NAMD
ComputeThole.inl
Go to the documentation of this file.
1 
7 #ifndef COMPUTETHOLE_INL
8 #define COMPUTETHOLE_INL
9 
10 #include "ComputeThole.h"
11 
12 inline TholeElem::TholeElem() { ; }
13 
14 inline TholeElem::TholeElem(AtomID atom0, const TupleSignature *sig, const TholeValue *v){
15  NAMD_die("Can't use Thole with memory optimized version of NAMD.");
16  // atomID[0] = atom0;
17  // atomID[1] = atom0 + sig->offset[0];
18  // atomID[2] = atom0 + sig->offset[1];
19  // atomID[3] = atom0 + sig->offset[2];
20  // value = &v[sig->tupleParamType];
21 }
22 
23 inline TholeElem::TholeElem(const Thole *a, const TholeValue *v)
24  {
25  atomID[0] = a->atom1;
26  atomID[1] = a->atom2;
27  atomID[2] = a->atom3;
28  atomID[3] = a->atom4;
29  value = a; // expect v to be NULL
30  }
31 
32 inline TholeElem::TholeElem(AtomID atom0, AtomID atom1,
33  AtomID atom2, AtomID atom3)
34  {
35  // atoms arranged: HEAVY DRUDE HEAVY DRUDE
36  if (atom0 > atom2) { // Swap heavy atoms so lowest is first!
37  AtomID tmp = atom2; atom2 = atom0; atom0 = tmp;
38  tmp = atom1; atom1 = atom3; atom3 = tmp;
39  }
40  atomID[0] = atom0;
41  atomID[1] = atom1;
42  atomID[2] = atom2;
43  atomID[3] = atom3;
44  }
45 
46 inline int TholeElem::operator==(const TholeElem &a) const
47  {
48  return (a.atomID[0] == atomID[0] && a.atomID[1] == atomID[1] &&
49  a.atomID[2] == atomID[2] && a.atomID[3] == atomID[3]);
50  }
51 
52 inline int TholeElem::operator<(const TholeElem &a) const
53  {
54  return (atomID[0] < a.atomID[0] ||
55  (atomID[0] == a.atomID[0] &&
56  (atomID[1] < a.atomID[1] ||
57  (atomID[1] == a.atomID[1] &&
58  (atomID[2] < a.atomID[2] ||
59  (atomID[2] == a.atomID[2] &&
60  atomID[3] < a.atomID[3]
61  ))))));
62  }
63 
64 #endif
65 
int32 atom3
Definition: structures.h:145
int AtomID
Definition: NamdTypes.h:29
int operator==(const TholeElem &a) const
int32 atom4
Definition: structures.h:146
int32 atom2
Definition: structures.h:144
int32 atom1
Definition: structures.h:143
void NAMD_die(const char *err_msg)
Definition: common.C:83
const TholeValue * value
Definition: ComputeThole.h:43
int operator<(const TholeElem &a) const
AtomID atomID[size]
Definition: ComputeThole.h:22