- Main Page
- Related Pages
- Classes
- Files

# uhftmpl.h

    00001
    00002 namespace sc {
    00003
    00004 class LocalUHFContribution {
    00005   private:
    00006     double * const gmata;
    00007     double * const gmatb;
    00008     double * const pmata;
    00009     double * const pmatb;
    00010
    00011   public:
    00012     LocalUHFContribution(double *ga, double *pa, double *gb, double *pb) :
    00013       gmata(ga), gmatb(gb), pmata(pa), pmatb(pb) {}
    00014     ~LocalUHFContribution() {}
    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 *= 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       gmata[ij] -= val*pmata[kl];
    00037       gmata[kl] -= val*pmata[ij];
    00038
    00039       gmatb[ij] -= val*pmatb[kl];
    00040       gmatb[kl] -= val*pmatb[ij];
    00041     }
    00042
    00043     inline void cont4(int ij, int kl, double val) {
    00044       cont1(ij,kl,val);
    00045       cont2(ij,kl,val);
    00046     }
    00047
    00048     inline void cont5(int ij, int kl, double val) {
    00049       cont1(ij,kl,val);
    00050       cont3(ij,kl,val);
    00051     }
    00052 };
    00053
    00054 class LocalUHFEnergyContribution {
    00055   private:
    00056     double * const pmata;
    00057     double * const pmatb;
    00058
    00059   public:
    00060     double ec;
    00061     double ex;
    00062
    00063     LocalUHFEnergyContribution(double *a, double *b) : pmata(a), pmatb(b) {
    00064       ec=ex=0;
    00065     }
    00066
    00067     ~LocalUHFEnergyContribution() {}
    00068
    00069     void set_bound(double,double) {};
    00070
    00071     inline void cont1(int ij, int kl, double val) {
    00072       ec += val*(pmata[ij]+pmatb[ij])*(pmata[kl]+pmatb[kl]);
    00073     }
    00074
    00075     inline void cont2(int ij, int kl, double val) {
    00076       ex -= 0.5*val*(pmata[ij]*pmata[kl]+pmatb[ij]*pmatb[kl]);
    00077     }
    00078
    00079     inline void cont3(int ij, int kl, double val) {
    00080       ex -= val*(pmata[ij]*pmata[kl]+pmatb[ij]*pmatb[kl]);
    00081     }
    00082
    00083     inline void cont4(int ij, int kl, double val) {
    00084       cont1(ij,kl,val);
    00085       cont2(ij,kl,val);
    00086     }
    00087
    00088     inline void cont5(int ij, int kl, double val) {
    00089       cont1(ij,kl,val);
    00090       cont3(ij,kl,val);
    00091     }
    00092 };
    00093
    00094 class LocalUHFGradContribution {
    00095   private:
    00096     double * const pmata;
    00097     double * const pmatb;
    00098
    00099   public:
    00100     LocalUHFGradContribution(double *a, double *b) : pmata(a), pmatb(b) {}
    00101     ~LocalUHFGradContribution() {}
    00102
    00103     inline double cont1(int ij, int kl) {
    00104       return (pmata[ij]*pmata[kl])+(pmatb[ij]*pmatb[kl]) +
    00105              (pmata[ij]*pmatb[kl])+(pmatb[ij]*pmata[kl]);
    00106     }
    00107
    00108     inline double cont2(int ij, int kl) {
    00109       return 2*((pmata[ij]*pmata[kl])+(pmatb[ij]*pmatb[kl]));
    00110     }
    00111 };
    00112
    00113 }