MPQC  3.0.0-alpha
tchftmpl.h
1 
2 namespace sc {
3 
5  private:
6  double * const gmata;
7  double * const gmatb;
8  double * const kmata;
9  double * const kmatb;
10 
11  double * const pmata;
12  double * const pmatb;
13  double * const opmata;
14  double * const opmatb;
15  public:
16  LocalTCContribution(double *ga, double *pa, double *gb, double *pb,
17  double *ka, double *opa, double *kb, double *opb) :
18  gmata(ga), gmatb(gb), kmata(ka), kmatb(kb),
19  pmata(pa), pmatb(pb), opmata(opa), opmatb(opb) {}
21 
22  void set_bound(double,double) {}
23 
24  inline void cont1(int ij, int kl, double val) {
25  gmata[ij] += val*pmata[kl];
26  gmata[kl] += val*pmata[ij];
27 
28  gmatb[ij] += val*pmatb[kl];
29  gmatb[kl] += val*pmatb[ij];
30  }
31 
32  inline void cont2(int ij, int kl, double val) {
33  val *= 0.25;
34  gmata[ij] -= val*pmata[kl];
35  gmata[kl] -= val*pmata[ij];
36 
37  gmatb[ij] -= val*pmatb[kl];
38  gmatb[kl] -= val*pmatb[ij];
39 
40  kmata[ij] += val*opmata[kl];
41  kmata[kl] += val*opmata[ij];
42 
43  kmatb[ij] += val*opmatb[kl];
44  kmatb[kl] += val*opmatb[ij];
45  }
46 
47  inline void cont3(int ij, int kl, double val) {
48  val *= 0.5;
49  gmata[ij] -= val*pmata[kl];
50  gmata[kl] -= val*pmata[ij];
51 
52  gmatb[ij] -= val*pmatb[kl];
53  gmatb[kl] -= val*pmatb[ij];
54 
55  kmata[ij] += val*opmata[kl];
56  kmata[kl] += val*opmata[ij];
57 
58  kmatb[ij] += val*opmatb[kl];
59  kmatb[kl] += val*opmatb[ij];
60  }
61 
62  inline void cont4(int ij, int kl, double val) {
63  gmata[ij] += 0.75*val*pmata[kl];
64  gmata[kl] += 0.75*val*pmata[ij];
65 
66  gmatb[ij] += 0.75*val*pmatb[kl];
67  gmatb[kl] += 0.75*val*pmatb[ij];
68 
69  kmata[ij] += 0.25*val*opmata[kl];
70  kmata[kl] += 0.25*val*opmata[ij];
71 
72  kmatb[ij] += 0.25*val*opmatb[kl];
73  kmatb[kl] += 0.25*val*opmatb[ij];
74  }
75 
76  inline void cont5(int ij, int kl, double val) {
77  val *= 0.5;
78  gmata[ij] += val*pmata[kl];
79  gmata[kl] += val*pmata[ij];
80 
81  gmatb[ij] += val*pmatb[kl];
82  gmatb[kl] += val*pmatb[ij];
83 
84  kmata[ij] += val*opmata[kl];
85  kmata[kl] += val*opmata[ij];
86 
87  kmatb[ij] += val*opmatb[kl];
88  kmatb[kl] += val*opmatb[ij];
89  }
90 };
91 
93  private:
94  double * const pmata;
95  double * const pmatb;
96  double * const opmata;
97  double * const opmatb;
98 
99  public:
100  double eca;
101  double exa;
102  double ecb;
103  double exb;
104  double ecab;
105  double exab;
106 
107  LocalTCEnergyContribution(double *pa, double *pb, double *opa, double *opb) :
108  pmata(pa), pmatb(pb), opmata(opa), opmatb(opb) {
109  exa=eca=0;
110  exb=ecb=0;
111  exab=ecab=0;
112  }
114 
115  void set_bound(double,double) {};
116 
117  inline void cont1(int ij, int kl, double val) {
118  eca += val*pmata[ij]*pmata[kl];
119  ecb += val*pmatb[ij]*pmatb[kl];
120  ecab += val*(pmata[ij]*pmatb[kl]-pmatb[ij]*pmata[kl]);
121  }
122 
123  inline void cont2(int ij, int kl, double val) {
124  exa -= 0.25*val*pmata[ij]*pmata[kl];
125  exb -= 0.25*val*pmatb[ij]*pmatb[kl];
126  exab -= 0.25*val*(pmata[ij]*pmatb[kl]-pmatb[ij]*pmata[kl]);
127  }
128 
129  inline void cont3(int ij, int kl, double val) {
130  exa -= 0.5*val*pmata[ij]*pmata[kl];
131  exb -= 0.5*val*pmatb[ij]*pmatb[kl];
132  exab -= 0.5*val*(pmata[ij]*pmatb[kl]-pmatb[ij]*pmata[kl]);
133  }
134 
135  inline void cont4(int ij, int kl, double val) {
136  eca += val*pmata[ij]*pmata[kl];
137  ecb += val*pmatb[ij]*pmatb[kl];
138  ecab += val*(pmata[ij]*pmatb[kl]-pmatb[ij]*pmata[kl]);
139 
140  exa -= 0.25*val*pmata[ij]*pmata[kl];
141  exb -= 0.25*val*pmatb[ij]*pmatb[kl];
142  exab -= 0.25*val*(pmata[ij]*pmatb[kl]-pmatb[ij]*pmata[kl]);
143  }
144 
145  inline void cont5(int ij, int kl, double val) {
146  eca += val*pmata[ij]*pmata[kl];
147  ecb += val*pmatb[ij]*pmatb[kl];
148  ecab += val*(pmata[ij]*pmatb[kl]-pmatb[ij]*pmata[kl]);
149 
150  exa -= 0.5*val*pmata[ij]*pmata[kl];
151  exb -= 0.5*val*pmatb[ij]*pmatb[kl];
152  exab -= 0.5*val*(pmata[ij]*pmatb[kl]-pmatb[ij]*pmata[kl]);
153  }
154 };
155 
157  private:
158  double * const pmat;
159  double * const pmata;
160  double * const pmatb;
161  double c1sq;
162  double c2sq;
163  double c1c2;
164 
165  public:
166  LocalTCGradContribution(double *p, double *pa, double *pb,
167  double c1, double c2) :
168  pmat(p), pmata(pa), pmatb(pb)
169  {
170  c1sq = c1*c1;
171  c2sq = c2*c2;
172  c1c2 = c1*c2;
173  }
175 
176  inline double cont1(int ij, int kl) {
177  return pmat[ij]*pmat[kl] +
178  c1sq*(pmata[ij]*pmat[kl] + pmat[ij]*pmata[kl]) +
179  c2sq*(pmatb[ij]*pmat[kl] + pmat[ij]*pmatb[kl]) +
180  0.5*c1sq*pmata[ij]*pmata[kl] +
181  0.5*c2sq*pmatb[ij]*pmatb[kl];
182  }
183 
184  inline double cont2(int ij, int kl) {
185  return pmat[ij]*pmat[kl] +
186  c1sq*(pmata[ij]*pmat[kl] + pmat[ij]*pmata[kl]) +
187  c2sq*(pmatb[ij]*pmat[kl] + pmat[ij]*pmatb[kl]) -
188  c1c2*(pmata[ij]*pmatb[kl] + pmatb[ij]*pmata[kl]);
189  }
190 };
191 
192 }
sc::LocalTCGradContribution
Definition: tchftmpl.h:156
sc::LocalTCEnergyContribution
Definition: tchftmpl.h:92
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::LocalTCContribution
Definition: tchftmpl.h:4

Generated at Sun Jan 26 2020 23:24:00 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.