ComputeCrossterms.h

Go to the documentation of this file.
00001 
00007 #ifndef COMPUTECROSSTERMS_H
00008 #define COMPUTECROSSTERMS_H
00009 
00010 #include "ComputeHomeTuples.h"
00011 #include "ComputeSelfTuples.h"
00012 #include "ReductionMgr.h"
00013 
00014 class Molecule;
00015 class CrosstermValue;
00016 
00017 class CrosstermElem {
00018 public:
00019     // ComputeHomeTuples interface
00020     enum { size = 8 };
00021     AtomID atomID[size];
00022     int    localIndex[size];
00023     TuplePatchElem *p[size];
00024     Real scale;
00025     static void computeForce(CrosstermElem*, int, BigReal*, BigReal *);
00026 
00027     static void getMoleculePointers(Molecule*, int*, int32***, Crossterm**);
00028     static void getParameterPointers(Parameters*, const CrosstermValue**);
00029     static void getTupleInfo(AtomSignature* sig, int *count, TupleSignature** t) {
00030         *count = sig->crosstermCnt;
00031         *t = sig->crosstermSigs;
00032     }
00033     
00034     // pressure profile parameters
00035     static int pressureProfileSlabs;
00036     static int pressureProfileAtomTypes;
00037     static BigReal pressureProfileThickness;
00038     static BigReal pressureProfileMin;
00039 
00040     // Internal data
00041     const CrosstermValue *value;
00042 
00043   int hash() const {
00044     return 0x7FFFFFFF &((atomID[0]<<24) + (atomID[1]<<16) + (atomID[2]<<8) + atomID[3]);
00045   }
00046   enum { crosstermEnergyIndex, crosstermEnergyIndex_f,
00047          crosstermEnergyIndex_ti_1, crosstermEnergyIndex_ti_2,
00048          TENSOR(virialIndex), reductionDataSize };
00049   enum { reductionChecksumLabel = REDUCTION_CROSSTERM_CHECKSUM };
00050   static void submitReductionData(BigReal*,SubmitReduction*);
00051 
00052   CrosstermElem() { ; }
00053 
00054   CrosstermElem(AtomID atom0, const TupleSignature *sig, const CrosstermValue *v){
00055     atomID[0] = atom0;
00056     atomID[1] = atom0 + sig->offset[0];
00057     atomID[2] = atom0 + sig->offset[1];
00058     atomID[3] = atom0 + sig->offset[2];
00059     atomID[4] = atom0 + sig->offset[3];
00060     atomID[5] = atom0 + sig->offset[4];
00061     atomID[6] = atom0 + sig->offset[5];
00062     atomID[7] = atom0 + sig->offset[6];
00063     value = &v[sig->tupleParamType];
00064 
00065   }  
00066 
00067   CrosstermElem(const Crossterm *a, const CrosstermValue *v) {
00068     atomID[0] = a->atom1;
00069     atomID[1] = a->atom2;
00070     atomID[2] = a->atom3;
00071     atomID[3] = a->atom4;
00072     atomID[4] = a->atom5;
00073     atomID[5] = a->atom6;
00074     atomID[6] = a->atom7;
00075     atomID[7] = a->atom8;
00076     value = &v[a->crossterm_type];
00077   }
00078 
00079   CrosstermElem(AtomID atom0, AtomID atom1, AtomID atom2, AtomID atom3,
00080                 AtomID atom4, AtomID atom5, AtomID atom6, AtomID atom7) {
00081     atomID[0] = atom0;
00082     atomID[1] = atom1;
00083     atomID[2] = atom2;
00084     atomID[3] = atom3;
00085     atomID[4] = atom4;
00086     atomID[5] = atom5;
00087     atomID[6] = atom6;
00088     atomID[7] = atom7;
00089   }
00090   ~CrosstermElem() {};
00091 
00092   int operator==(const CrosstermElem &a) const {
00093     return (a.atomID[0] == atomID[0] && a.atomID[1] == atomID[1] &&
00094         a.atomID[2] == atomID[2] && a.atomID[3] == atomID[3] &&
00095         a.atomID[4] == atomID[4] && a.atomID[5] == atomID[5] &&
00096         a.atomID[6] == atomID[6] && a.atomID[7] == atomID[7]);
00097   }
00098 
00099   int operator<(const CrosstermElem &a) const {
00100     return  (atomID[0] < a.atomID[0] ||
00101             (atomID[0] == a.atomID[0] &&
00102             (atomID[1] < a.atomID[1] ||
00103             (atomID[1] == a.atomID[1] &&
00104             (atomID[2] < a.atomID[2] ||
00105             (atomID[2] == a.atomID[2] &&
00106             (atomID[3] < a.atomID[3] ||
00107             (atomID[3] == a.atomID[3] &&
00108             (atomID[4] < a.atomID[4] ||
00109             (atomID[4] == a.atomID[4] &&
00110             (atomID[5] < a.atomID[5] ||
00111             (atomID[5] == a.atomID[5] &&
00112             (atomID[6] < a.atomID[6] ||
00113             (atomID[6] == a.atomID[6] &&
00114              atomID[7] < a.atomID[7] 
00115              ))))))))))))));
00116   }
00117 };
00118 
00119 class ComputeCrossterms : public ComputeHomeTuples<CrosstermElem,Crossterm,CrosstermValue>
00120 {
00121 public:
00122 
00123   ComputeCrossterms(ComputeID c, PatchIDList &p) : ComputeHomeTuples<CrosstermElem,Crossterm,CrosstermValue>(c,p) { ; }
00124 
00125 };
00126 
00127 class ComputeSelfCrossterms : public ComputeSelfTuples<CrosstermElem,Crossterm,CrosstermValue>
00128 {
00129 public:
00130 
00131   ComputeSelfCrossterms(ComputeID c, PatchID p) : ComputeSelfTuples<CrosstermElem,Crossterm,CrosstermValue>(c,p) { ; }
00132 
00133 };
00134 
00135 #endif
00136 

Generated on Tue May 22 01:17:12 2018 for NAMD by  doxygen 1.4.7