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