# ukstmpl.h

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