Hydrogen.h

Go to the documentation of this file.
00001 
00007 #ifndef HYDROGEN_H
00008 #define HYDROGEN_H
00009 
00010 #include "NamdTypes.h"
00011 #include "SortableResizeArray.h"
00012 
00013 // List maintaining the global atom indicies sorted by helix groups.
00014 class HydrogenGroupID {
00015   public:
00016     AtomID atomID;      // global atom ID
00017     // isGP and atomsInGroup are determined when hydrogen bonds are found.
00018     int isGP;           // flag determining whether this atom is a group parent
00019     int atomsInGroup;   // positive number means parent of group.
00020                         // 0 means not in group.
00021     int waterVal;       // number of H bonded to O parent, 2 if water
00022     // although the Molecule object contains get_mother_atom(), we cannot
00023     // use it since Molecule.h, Node.h, and structure.h would have cyclical
00024     // include statements.
00025     int GPID;   // group parent ID, should be atomID if isGP is true
00026     // extension for migration groups
00027     int isMP;  // is this atom a migration group parent
00028     int MPID;  // migration group parent ID
00029     int atomsInMigrationGroup;
00030 #ifdef MEM_OPT_VERSION
00031     int atomHoldIdxPar;
00032 #endif
00033 
00034     HydrogenGroupID() {};
00035     ~HydrogenGroupID() {};
00036 
00037     int operator < (const HydrogenGroupID &a) const {
00038       int rval;
00039       int mp1 = ( isMP ? atomID : MPID );
00040       int mp2 = ( a.isMP ? a.atomID : a.MPID );
00041       if ( mp1 != mp2 ) {
00042         rval = ( mp1 < mp2 );
00043       } else { // same migration group, compare hydrogen groups
00044         int gp1 = ( isGP ? atomID : GPID );
00045         int gp2 = ( a.isGP ? a.atomID : a.GPID );
00046         if ( gp1 != gp2 ) {
00047           rval = ( gp1 < gp2 );
00048         // in the same group, check for group parent
00049         } else if ( a.isGP ) {  // compare to self should return 0
00050           rval = 0;
00051         } else if ( isGP ) {
00052           rval = 1;
00053         // neither is group parent, check for drude
00054         } else if ( a.atomID == gp1 + 1 ) {  // compare to self return 0
00055           rval = 0;
00056         } else if ( atomID == gp1 + 1 ) {
00057           rval = 1;
00058         // neither is drude
00059         } else {
00060           rval = (atomID < a.atomID);
00061         }
00062       }
00063       return rval;
00064     }
00065 };
00066 
00067 typedef SortableResizeArray<HydrogenGroupID> HydrogenGroup ;
00068 
00069 #endif
00070 

Generated on Mon Nov 20 01:17:12 2017 for NAMD by  doxygen 1.4.7