00001 00002 class LocalHSOSContribution { 00003 private: 00004 double * const gmat; 00005 double * const gmato; 00006 double * const pmat; 00007 double * const pmato; 00008 00009 public: 00010 LocalHSOSContribution(double *g, double *p, double *go, double *po) : 00011 gmat(g), gmato(go), pmat(p), pmato(po) {} 00012 ~LocalHSOSContribution() {} 00013 00014 void set_bound(double,double) {}; 00015 00016 inline void cont1(int ij, int kl, double val) { 00017 gmat[ij] += val*pmat[kl]; 00018 gmat[kl] += val*pmat[ij]; 00019 } 00020 00021 inline void cont2(int ij, int kl, double val) { 00022 val *= 0.25; 00023 gmat[ij] -= val*pmat[kl]; 00024 gmat[kl] -= val*pmat[ij]; 00025 00026 gmato[ij] += val*pmato[kl]; 00027 gmato[kl] += val*pmato[ij]; 00028 } 00029 00030 inline void cont3(int ij, int kl, double val) { 00031 val *= 0.5; 00032 gmat[ij] -= val*pmat[kl]; 00033 gmat[kl] -= val*pmat[ij]; 00034 00035 gmato[ij] += val*pmato[kl]; 00036 gmato[kl] += val*pmato[ij]; 00037 } 00038 00039 inline void cont4(int ij, int kl, double val) { 00040 gmat[ij] += 0.75*val*pmat[kl]; 00041 gmat[kl] += 0.75*val*pmat[ij]; 00042 00043 gmato[ij] += 0.25*val*pmato[kl]; 00044 gmato[kl] += 0.25*val*pmato[ij]; 00045 } 00046 00047 inline void cont5(int ij, int kl, double val) { 00048 val *= 0.5; 00049 gmat[ij] += val*pmat[kl]; 00050 gmat[kl] += val*pmat[ij]; 00051 00052 gmato[ij] += val*pmato[kl]; 00053 gmato[kl] += val*pmato[ij]; 00054 } 00055 }; 00056 00057 class LocalHSOSEnergyContribution { 00058 private: 00059 double * const pmat; 00060 double * const pmato; 00061 00062 public: 00063 double ec; 00064 double ex; 00065 00066 void set_bound(double,double) {}; 00067 00068 LocalHSOSEnergyContribution(double *p, double *po) : pmat(p), pmato(po) { 00069 ec=ex=0; 00070 } 00071 00072 ~LocalHSOSEnergyContribution() {} 00073 00074 inline void cont1(int ij, int kl, double val) { 00075 ec += val*pmat[ij]*pmat[kl]; 00076 } 00077 00078 inline void cont2(int ij, int kl, double val) { 00079 ex -= 0.25*val*(pmat[ij]*pmat[kl] + pmato[ij]*pmato[kl]); 00080 } 00081 00082 inline void cont3(int ij, int kl, double val) { 00083 ex -= 0.5*val*(pmat[ij]*pmat[kl] + pmato[ij]*pmato[kl]); 00084 } 00085 00086 inline void cont4(int ij, int kl, double val) { 00087 ec += val*pmat[ij]*pmat[kl]; 00088 ex -= 0.25*val*(pmat[ij]*pmat[kl] + pmato[ij]*pmato[kl]); 00089 } 00090 00091 inline void cont5(int ij, int kl, double val) { 00092 ec += val*pmat[ij]*pmat[kl]; 00093 ex -= 0.5*val*(pmat[ij]*pmat[kl] + pmato[ij]*pmato[kl]); 00094 } 00095 }; 00096 class LocalHSOSGradContribution { 00097 private: 00098 double * const pmat; 00099 double * const pmato; 00100 00101 public: 00102 LocalHSOSGradContribution(double *p, double *po) : pmat(p), pmato(po) {} 00103 ~LocalHSOSGradContribution() {} 00104 00105 inline double cont1(int ij, int kl) { 00106 return pmat[ij]*pmat[kl] + 00107 0.5*(pmato[ij]*pmat[kl] + pmat[ij]*pmato[kl]) + 00108 0.25*pmato[ij]*pmato[kl]; 00109 } 00110 00111 inline double cont2(int ij, int kl) { 00112 return pmat[ij]*pmat[kl] + 00113 0.5*(pmato[ij]*pmat[kl] + pmat[ij]*pmato[kl] + pmato[ij]*pmato[kl]); 00114 } 00115 };