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