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