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, TENSOR(virialIndex), reductionDataSize };
00047   enum { reductionChecksumLabel = REDUCTION_CROSSTERM_CHECKSUM };
00048   static void submitReductionData(BigReal*,SubmitReduction*);
00049 
00050   CrosstermElem() { ; }
00051 
00052   CrosstermElem(AtomID atom0, const TupleSignature *sig, const CrosstermValue *v){
00053     atomID[0] = atom0;
00054     atomID[1] = atom0 + sig->offset[0];
00055     atomID[2] = atom0 + sig->offset[1];
00056     atomID[3] = atom0 + sig->offset[2];
00057     atomID[4] = atom0 + sig->offset[3];
00058     atomID[5] = atom0 + sig->offset[4];
00059     atomID[6] = atom0 + sig->offset[5];
00060     atomID[7] = atom0 + sig->offset[6];
00061     value = &v[sig->tupleParamType];
00062 
00063   }  
00064 
00065   CrosstermElem(const Crossterm *a, const CrosstermValue *v) {
00066     atomID[0] = a->atom1;
00067     atomID[1] = a->atom2;
00068     atomID[2] = a->atom3;
00069     atomID[3] = a->atom4;
00070     atomID[4] = a->atom5;
00071     atomID[5] = a->atom6;
00072     atomID[6] = a->atom7;
00073     atomID[7] = a->atom8;
00074     value = &v[a->crossterm_type];
00075   }
00076 
00077   CrosstermElem(AtomID atom0, AtomID atom1, AtomID atom2, AtomID atom3,
00078                 AtomID atom4, AtomID atom5, AtomID atom6, AtomID atom7) {
00079     atomID[0] = atom0;
00080     atomID[1] = atom1;
00081     atomID[2] = atom2;
00082     atomID[3] = atom3;
00083     atomID[4] = atom4;
00084     atomID[5] = atom5;
00085     atomID[6] = atom6;
00086     atomID[7] = atom7;
00087   }
00088   ~CrosstermElem() {};
00089 
00090   int operator==(const CrosstermElem &a) const {
00091     return (a.atomID[0] == atomID[0] && a.atomID[1] == atomID[1] &&
00092         a.atomID[2] == atomID[2] && a.atomID[3] == atomID[3] &&
00093         a.atomID[4] == atomID[4] && a.atomID[5] == atomID[5] &&
00094         a.atomID[6] == atomID[6] && a.atomID[7] == atomID[7]);
00095   }
00096 
00097   int operator<(const CrosstermElem &a) const {
00098     return  (atomID[0] < a.atomID[0] ||
00099             (atomID[0] == a.atomID[0] &&
00100             (atomID[1] < a.atomID[1] ||
00101             (atomID[1] == a.atomID[1] &&
00102             (atomID[2] < a.atomID[2] ||
00103             (atomID[2] == a.atomID[2] &&
00104             (atomID[3] < a.atomID[3] ||
00105             (atomID[3] == a.atomID[3] &&
00106             (atomID[4] < a.atomID[4] ||
00107             (atomID[4] == a.atomID[4] &&
00108             (atomID[5] < a.atomID[5] ||
00109             (atomID[5] == a.atomID[5] &&
00110             (atomID[6] < a.atomID[6] ||
00111             (atomID[6] == a.atomID[6] &&
00112              atomID[7] < a.atomID[7] 
00113              ))))))))))))));
00114   }
00115 };
00116 
00117 class ComputeCrossterms : public ComputeHomeTuples<CrosstermElem,Crossterm,CrosstermValue>
00118 {
00119 public:
00120 
00121   ComputeCrossterms(ComputeID c, PatchIDList &p) : ComputeHomeTuples<CrosstermElem,Crossterm,CrosstermValue>(c,p) { ; }
00122 
00123 };
00124 
00125 class ComputeSelfCrossterms : public ComputeSelfTuples<CrosstermElem,Crossterm,CrosstermValue>
00126 {
00127 public:
00128 
00129   ComputeSelfCrossterms(ComputeID c, PatchID p) : ComputeSelfTuples<CrosstermElem,Crossterm,CrosstermValue>(c,p) { ; }
00130 
00131 };
00132 
00133 #endif
00134 

Generated on Tue Sep 26 01:17:11 2017 for NAMD by  doxygen 1.4.7