NAMD
Hydrogen.h
Go to the documentation of this file.
1 
7 #ifndef HYDROGEN_H
8 #define HYDROGEN_H
9 
10 #include "NamdTypes.h"
11 #include "SortableResizeArray.h"
12 
13 // List maintaining the global atom indicies sorted by helix groups.
15  public:
16  AtomID atomID; // global atom ID
17  // isGP and atomsInGroup are determined when hydrogen bonds are found.
18  int isGP; // flag determining whether this atom is a group parent
19  int atomsInGroup; // positive number means parent of group.
20  // 0 means not in group.
21  int waterVal; // number of H bonded to O parent, 2 if water
22  // although the Molecule object contains get_mother_atom(), we cannot
23  // use it since Molecule.h, Node.h, and structure.h would have cyclical
24  // include statements.
25  int GPID; // group parent ID, should be atomID if isGP is true
26  // extension for migration groups
27  int isMP; // is this atom a migration group parent
28  int MPID; // migration group parent ID
30 #ifdef MEM_OPT_VERSION
31  int atomHoldIdxPar;
32 #endif
33 
36 
37  int operator < (const HydrogenGroupID &a) const {
38  int rval;
39  int mp1 = ( isMP ? atomID : MPID );
40  int mp2 = ( a.isMP ? a.atomID : a.MPID );
41  if ( mp1 != mp2 ) {
42  rval = ( mp1 < mp2 );
43  } else { // same migration group, compare hydrogen groups
44  int gp1 = ( isGP ? atomID : GPID );
45  int gp2 = ( a.isGP ? a.atomID : a.GPID );
46  if ( gp1 != gp2 ) {
47  rval = ( gp1 < gp2 );
48  // in the same group, check for group parent
49  } else if ( a.isGP ) { // compare to self should return 0
50  rval = 0;
51  } else if ( isGP ) {
52  rval = 1;
53  // neither is group parent, check for drude
54  } else if ( a.atomID == gp1 + 1 ) { // compare to self return 0
55  rval = 0;
56  } else if ( atomID == gp1 + 1 ) {
57  rval = 1;
58  // neither is drude
59  } else {
60  rval = (atomID < a.atomID);
61  }
62  }
63  return rval;
64  }
65 };
66 
68 
69 #endif
70 
int AtomID
Definition: NamdTypes.h:29
int atomsInGroup
Definition: Hydrogen.h:19
int operator<(const HydrogenGroupID &a) const
Definition: Hydrogen.h:37
AtomID atomID
Definition: Hydrogen.h:16
int atomsInMigrationGroup
Definition: Hydrogen.h:29
SortableResizeArray< HydrogenGroupID > HydrogenGroup
Definition: Hydrogen.h:67