MPQC 2.3.1

- Main Page
- Related Pages
- Classes
- Files

- File List

ukstmpl.h
1
2 namespace sc {
3
4 class LocalUKSContribution {
5 private:
6 double * const gmata;
7 double * const gmatb;
8 double * const pmata;
9 double * const pmatb;
10 double a0;
11
12 public:
13 LocalUKSContribution(double *ga, double *pa, double *gb, double *pb,
14 double a) :
15 gmata(ga), gmatb(gb), pmata(pa), pmatb(pb), a0(a) {}
16 ~LocalUKSContribution() {}
17
18 void set_bound(double, double) {}
19
20 inline void cont1(int ij, int kl, double val) {
21 gmata[ij] += val*(pmata[kl]+pmatb[kl]);
22 gmata[kl] += val*(pmata[ij]+pmatb[ij]);
23
24 gmatb[ij] += val*(pmata[kl]+pmatb[kl]);
25 gmatb[kl] += val*(pmata[ij]+pmatb[ij]);
26 }
27
28 inline void cont2(int ij, int kl, double val) {
29 val *= a0*0.5;
30 gmata[ij] -= val*pmata[kl];
31 gmata[kl] -= val*pmata[ij];
32
33 gmatb[ij] -= val*pmatb[kl];
34 gmatb[kl] -= val*pmatb[ij];
35 }
36
37 inline void cont3(int ij, int kl, double val) {
38 val *= a0;
39 gmata[ij] -= val*pmata[kl];
40 gmata[kl] -= val*pmata[ij];
41
42 gmatb[ij] -= val*pmatb[kl];
43 gmatb[kl] -= val*pmatb[ij];
44 }
45
46 inline void cont4(int ij, int kl, double val) {
47 cont1(ij,kl,val);
48 cont2(ij,kl,val);
49 }
50
51 inline void cont5(int ij, int kl, double val) {
52 cont1(ij,kl,val);
53 cont3(ij,kl,val);
54 }
55 };
56
57 class LocalUKSEnergyContribution {
58 private:
59 double * const pmata;
60 double * const pmatb;
61 double a0;
62
63 public:
64 double ec;
65 double ex;
66
67 LocalUKSEnergyContribution(double *a, double *b, double an) :
68 pmata(a), pmatb(b), a0(an) {
69 ec=ex=0;
70 }
71
72 ~LocalUKSEnergyContribution() {}
73
74 void set_bound(double, double) {}
75
76 inline void cont1(int ij, int kl, double val) {
77 ec += val*(pmata[ij]+pmatb[ij])*(pmata[kl]+pmatb[kl]);
78 }
79
80 inline void cont2(int ij, int kl, double val) {
81 ex -= a0*0.5*val*(pmata[ij]*pmata[kl]+pmatb[ij]*pmatb[kl]);
82 }
83
84 inline void cont3(int ij, int kl, double val) {
85 ex -= a0*val*(pmata[ij]*pmata[kl]+pmatb[ij]*pmatb[kl]);
86 }
87
88 inline void cont4(int ij, int kl, double val) {
89 cont1(ij,kl,val);
90 cont2(ij,kl,val);
91 }
92
93 inline void cont5(int ij, int kl, double val) {
94 cont1(ij,kl,val);
95 cont3(ij,kl,val);
96 }
97 };
98
99 }