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