MPQC 2.3.1

- Main Page
- Related Pages
- Classes
- Files

- File List

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