3
\brief Enter brief description of file here
7
#include <libdpd/dpd.h>
14
namespace psi { namespace ccenergy {
19
int ma,fe,ef,m,f,M,A,Gm,Ga,Ge,Gf,Gma,nrows,ncols;
23
dpdfile2 fAB, fab, fIA, fia;
26
dpdbuf4 F_anti, F, D_anti, D;
27
dpdbuf4 tautIJAB, tautijab, tautIjAb, taut;
29
nirreps = moinfo.nirreps;
31
if(params.ref == 0) { /** RHF **/
32
dpd_file2_init(&fAB, CC_OEI, 0, 1, 1, "fAB");
33
dpd_file2_copy(&fAB, CC_OEI, "FAE");
34
dpd_file2_close(&fAB);
36
else if(params.ref == 1) { /** ROHF **/
37
dpd_file2_init(&fAB, CC_OEI, 0, 1, 1, "fAB");
38
dpd_file2_copy(&fAB, CC_OEI, "FAE");
39
dpd_file2_close(&fAB);
41
dpd_file2_init(&fab, CC_OEI, 0, 1, 1, "fab");
42
dpd_file2_copy(&fab, CC_OEI, "Fae");
43
dpd_file2_close(&fab);
45
else if(params.ref == 2) { /** UHF **/
46
dpd_file2_init(&fAB, CC_OEI, 0, 1, 1, "fAB");
47
dpd_file2_copy(&fAB, CC_OEI, "FAE");
48
dpd_file2_close(&fAB);
50
dpd_file2_init(&fab, CC_OEI, 0, 3, 3, "fab");
51
dpd_file2_copy(&fab, CC_OEI, "Fae");
52
dpd_file2_close(&fab);
55
if(params.ref == 0) { /** RHF **/
56
dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
58
dpd_file2_mat_init(&FAE);
59
dpd_file2_mat_rd(&FAE);
62
for(h=0; h < moinfo.nirreps; h++) {
63
for(a=0; a < FAE.params->rowtot[h]; a++)
64
FAE.matrix[h][a][a] = 0;
68
dpd_file2_mat_wrt(&FAE);
69
dpd_file2_mat_close(&FAE);
70
dpd_file2_close(&FAE);
72
else if(params.ref == 1) { /** ROHF **/
73
dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
74
dpd_file2_init(&Fae, CC_OEI, 0, 1, 1, "Fae");
76
dpd_file2_mat_init(&FAE);
77
dpd_file2_mat_rd(&FAE);
78
dpd_file2_mat_init(&Fae);
79
dpd_file2_mat_rd(&Fae);
81
for(h=0; h < moinfo.nirreps; h++) {
83
for(a=0; a < FAE.params->rowtot[h]; a++)
84
for(e=0; e < FAE.params->coltot[h]; e++)
85
FAE.matrix[h][a][e] *= (1 - (a==e));
87
for(a=0; a < Fae.params->rowtot[h]; a++)
88
for(e=0; e < Fae.params->coltot[h]; e++)
89
Fae.matrix[h][a][e] *= (1 - (a==e));
93
dpd_file2_mat_wrt(&FAE);
94
dpd_file2_mat_close(&FAE);
95
dpd_file2_mat_wrt(&Fae);
96
dpd_file2_mat_close(&Fae);
98
dpd_file2_close(&FAE);
99
dpd_file2_close(&Fae);
101
else if(params.ref == 2) { /** UHF **/
102
dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
103
dpd_file2_init(&Fae, CC_OEI, 0, 3, 3, "Fae");
105
dpd_file2_mat_init(&FAE);
106
dpd_file2_mat_rd(&FAE);
107
dpd_file2_mat_init(&Fae);
108
dpd_file2_mat_rd(&Fae);
110
for(h=0; h < moinfo.nirreps; h++) {
112
for(a=0; a < FAE.params->rowtot[h]; a++)
113
for(e=0; e < FAE.params->coltot[h]; e++)
114
FAE.matrix[h][a][e] *= (1 - (a==e));
116
for(a=0; a < Fae.params->rowtot[h]; a++)
117
for(e=0; e < Fae.params->coltot[h]; e++)
118
Fae.matrix[h][a][e] *= (1 - (a==e));
122
dpd_file2_mat_wrt(&FAE);
123
dpd_file2_mat_close(&FAE);
124
dpd_file2_mat_wrt(&Fae);
125
dpd_file2_mat_close(&Fae);
127
dpd_file2_close(&FAE);
128
dpd_file2_close(&Fae);
131
if(params.ref == 0) { /** RHF **/
132
dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
133
dpd_file2_init(&fIA, CC_OEI, 0, 0, 1, "fIA");
134
dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
135
dpd_contract222(&tIA, &fIA, &FAE, 1, 1, -0.5, 1);
136
dpd_file2_close(&tIA);
137
dpd_file2_close(&fIA);
138
dpd_file2_close(&FAE);
141
dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
142
dpd_buf4_init(&F_anti, CC_FINTS, 0, 10, 5, 10, 5, 1, "F <ia|bc>");
143
dpd_buf4_init(&F, CC_FINTS, 0, 10, 5, 10, 5, 0,"F <ia|bc>");
144
dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
145
dpd_dot13(&tIA, &F_anti, &FAE, 0, 0, 1.0, 1.0);
146
dpd_dot13(&tIA, &F, &FAE, 0, 0, 1.0, 1.0);
147
dpd_file2_close(&tIA);
148
dpd_buf4_close(&F_anti);
150
dpd_file2_close(&FAE);
153
/* Out-of-core algorithm for F->FAE added 3/20/05 - TDC */
154
/* Fae <-- t(m,f) [2 <ma|fe> - <ma|ef>] */
155
dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
156
dpd_file2_mat_init(&FAE);
157
dpd_file2_mat_rd(&FAE);
158
dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
159
dpd_file2_mat_init(&tIA);
160
dpd_file2_mat_rd(&tIA);
161
dpd_buf4_init(&F, CC_FINTS, 0, 10, 5, 10, 5, 0,"F <ia|bc>");
162
for(Gma=0; Gma < nirreps; Gma++) {
163
dpd_buf4_mat_irrep_row_init(&F, Gma);
164
X = init_array(F.params->coltot[Gma]);
166
for(ma=0; ma < F.params->rowtot[Gma]; ma++) {
167
dpd_buf4_mat_irrep_row_rd(&F, Gma, ma);
168
m = F.params->roworb[Gma][ma][0];
169
a = F.params->roworb[Gma][ma][1];
170
Gm = F.params->psym[m];
171
Ga = Ge = Gm ^ Gma; /* Fae is totally symmetric */
172
Gf = Gm; /* T1 is totally symmetric */
173
M = m - F.params->poff[Gm];
174
A = a - F.params->qoff[Ga];
176
zero_arr(X, F.params->coltot[Gma]);
178
/* build spin-adapted F-integrals for current ma */
179
for(fe=0; fe < F.params->coltot[Gma]; fe++) {
180
f = F.params->colorb[Gma][fe][0];
181
e = F.params->colorb[Gma][fe][1];
182
ef = F.params->colidx[e][f];
183
X[fe] = 2.0 * F.matrix[Gma][0][fe] - F.matrix[Gma][0][ef];
186
nrows = moinfo.virtpi[Gf];
187
ncols = moinfo.virtpi[Ge];
189
C_DGEMV('t',nrows,ncols,1.0,&X[F.col_offset[Gma][Gf]],ncols,
190
tIA.matrix[Gm][M],1,1.0,
191
FAE.matrix[Ga][A],1);
195
dpd_buf4_mat_irrep_row_close(&F, Gma);
198
dpd_file2_mat_close(&tIA);
199
dpd_file2_close(&tIA);
200
dpd_file2_mat_wrt(&FAE);
201
dpd_file2_mat_close(&FAE);
202
dpd_file2_close(&FAE);
204
dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
206
dpd_buf4_init(&D, CC_DINTS, 0, 0, 5, 0, 5, 0, "D 2<ij|ab> - <ij|ba>");
207
dpd_buf4_init(&tautIjAb, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tautIjAb");
208
dpd_contract442(&tautIjAb, &D, &FAE, 3, 3, -1, 1);
210
dpd_buf4_close(&tautIjAb);
212
/* Build the tilde intermediates */
213
dpd_file2_copy(&FAE, CC_OEI, "FAEt");
214
dpd_file2_close(&FAE);
216
dpd_file2_init(&FAEt, CC_OEI, 0, 1, 1, "FAEt");
218
dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
219
dpd_file2_init(&FME, CC_OEI, 0, 0, 1, "FME");
220
dpd_contract222(&tIA, &FME, &FAEt, 1, 1, -0.5, 1);
221
dpd_file2_close(&tIA);
222
dpd_file2_close(&FME);
224
dpd_file2_close(&FAEt);
226
else if(params.ref == 1) { /** ROHF **/
227
dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
228
dpd_file2_init(&Fae, CC_OEI, 0, 1, 1, "Fae");
230
dpd_file2_init(&fIA, CC_OEI, 0, 0, 1, "fIA");
231
dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
232
dpd_contract222(&tIA, &fIA, &FAE, 1, 1, -0.5, 1);
233
dpd_file2_close(&tIA);
234
dpd_file2_close(&fIA);
236
dpd_file2_init(&fia, CC_OEI, 0, 0, 1, "fia");
237
dpd_file2_init(&tia, CC_OEI, 0, 0, 1, "tia");
238
dpd_contract222(&tia, &fia, &Fae, 1, 1, -0.5, 1);
239
dpd_file2_close(&tia);
240
dpd_file2_close(&fia);
242
dpd_buf4_init(&F_anti, CC_FINTS, 0, 10, 5, 10, 5, 1, "F <ia|bc>");
243
dpd_buf4_init(&F, CC_FINTS, 0, 10, 5, 10, 5, 0,"F <ia|bc>");
244
dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
245
dpd_file2_init(&tia, CC_OEI, 0, 0, 1, "tia");
247
dpd_dot13(&tIA, &F_anti, &FAE, 0, 0, 1.0, 1.0);
248
dpd_dot13(&tia, &F, &FAE, 0, 0, 1.0, 1.0);
250
dpd_dot13(&tia, &F_anti, &Fae, 0, 0, 1.0, 1.0);
251
dpd_dot13(&tIA, &F, &Fae, 0, 0, 1.0, 1.0);
253
dpd_file2_close(&tIA);
254
dpd_file2_close(&tia);
255
dpd_buf4_close(&F_anti);
258
dpd_buf4_init(&D_anti, CC_DINTS, 0, 2, 5, 2, 5, 0, "D <ij||ab> (i>j,ab)");
260
dpd_buf4_init(&tautIJAB, CC_TAMPS, 0, 2, 5, 2, 7, 0, "tautIJAB");
261
dpd_buf4_init(&tautijab, CC_TAMPS, 0, 2, 5, 2, 7, 0, "tautijab");
263
dpd_contract442(&tautIJAB, &D_anti, &FAE, 2, 2, -1, 1);
264
dpd_contract442(&tautijab, &D_anti, &Fae, 2, 2, -1, 1);
266
dpd_buf4_close(&D_anti);
267
dpd_buf4_close(&tautIJAB);
268
dpd_buf4_close(&tautijab);
270
dpd_buf4_init(&D, CC_DINTS, 0, 0, 5, 0, 5, 0, "D <ij|ab>");
271
dpd_buf4_init(&tautIjAb, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tautIjAb");
273
dpd_contract442(&tautIjAb, &D, &Fae, 3, 3, -1, 1);
274
dpd_contract442(&tautIjAb, &D, &FAE, 2, 2, -1, 1);
277
dpd_buf4_close(&tautIjAb);
280
/* Build the tilde intermediates */
281
dpd_file2_copy(&FAE, CC_OEI, "FAEt");
282
dpd_file2_copy(&Fae, CC_OEI, "Faet");
284
dpd_file2_close(&FAE);
285
dpd_file2_close(&Fae);
287
dpd_file2_init(&FAEt, CC_OEI, 0, 1, 1, "FAEt");
288
dpd_file2_init(&Faet, CC_OEI, 0, 1, 1, "Faet");
290
dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
291
dpd_file2_init(&FME, CC_OEI, 0, 0, 1, "FME");
292
dpd_contract222(&tIA, &FME, &FAEt, 1, 1, -0.5, 1);
293
dpd_file2_close(&tIA);
294
dpd_file2_close(&FME);
296
dpd_file2_init(&tia, CC_OEI, 0, 0, 1, "tia");
297
dpd_file2_init(&Fme, CC_OEI, 0, 0, 1, "Fme");
298
dpd_contract222(&tia, &Fme, &Faet, 1, 1, -0.5, 1);
299
dpd_file2_close(&tia);
300
dpd_file2_close(&Fme);
302
dpd_file2_close(&FAEt);
303
dpd_file2_close(&Faet);
305
else if(params.ref == 2) { /** UHF **/
307
dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
308
dpd_file2_init(&Fae, CC_OEI, 0, 3, 3, "Fae");
310
dpd_file2_init(&fIA, CC_OEI, 0, 0, 1, "fIA");
311
dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
312
dpd_contract222(&tIA, &fIA, &FAE, 1, 1, -0.5, 1);
313
dpd_file2_close(&tIA);
314
dpd_file2_close(&fIA);
316
dpd_file2_init(&fia, CC_OEI, 0, 2, 3, "fia");
317
dpd_file2_init(&tia, CC_OEI, 0, 2, 3, "tia");
318
dpd_contract222(&tia, &fia, &Fae, 1, 1, -0.5, 1);
319
dpd_file2_close(&tia);
320
dpd_file2_close(&fia);
322
dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
323
dpd_file2_init(&tia, CC_OEI, 0, 2, 3, "tia");
325
dpd_buf4_init(&F, CC_FINTS, 0, 20, 5, 20, 5, 1, "F <IA|BC>");
326
dpd_dot13(&tIA, &F, &FAE, 0, 0, 1, 1);
329
dpd_buf4_init(&F, CC_FINTS, 0, 27, 29, 27, 29, 0, "F <iA|bC>");
330
dpd_dot13(&tia, &F, &FAE, 0, 0, 1, 1);
333
dpd_buf4_init(&F, CC_FINTS, 0, 30, 15, 30, 15, 1, "F <ia|bc>");
334
dpd_dot13(&tia, &F, &Fae, 0, 0, 1, 1);
337
dpd_buf4_init(&F, CC_FINTS, 0, 24, 28, 24, 28, 0, "F <Ia|Bc>");
338
dpd_dot13(&tIA, &F, &Fae, 0, 0, 1, 1);
341
dpd_file2_close(&tIA);
342
dpd_file2_close(&tia);
344
dpd_buf4_init(&D, CC_DINTS, 0, 2, 5, 2, 5, 0, "D <IJ||AB> (I>J,AB)");
345
dpd_buf4_init(&taut, CC_TAMPS, 0, 2, 5, 2, 7, 0, "tautIJAB");
346
dpd_contract442(&taut, &D, &FAE, 2, 2, -1, 1);
347
dpd_buf4_close(&taut);
350
dpd_buf4_init(&D, CC_DINTS, 0, 22, 28, 22, 28, 0, "D <Ij|Ab>");
351
dpd_buf4_init(&taut, CC_TAMPS, 0, 22, 28, 22, 28, 0, "tautIjAb");
352
dpd_contract442(&taut, &D, &FAE, 2, 2, -1, 1);
353
dpd_buf4_close(&taut);
356
dpd_buf4_init(&D, CC_DINTS, 0, 12, 15, 12, 15, 0, "D <ij||ab> (i>j,ab)");
357
dpd_buf4_init(&taut, CC_TAMPS, 0, 12, 15, 12, 17, 0, "tautijab");
358
dpd_contract442(&taut, &D, &Fae, 2, 2, -1, 1);
359
dpd_buf4_close(&taut);
362
dpd_buf4_init(&D, CC_DINTS, 0, 22, 28, 22, 28, 0, "D <Ij|Ab>");
363
dpd_buf4_init(&taut, CC_TAMPS, 0, 22, 28, 22, 28, 0, "tautIjAb");
364
dpd_contract442(&taut, &D, &Fae, 3, 3, -1, 1);
365
dpd_buf4_close(&taut);
368
/* Build the tilde intermediates */
369
dpd_file2_copy(&FAE, CC_OEI, "FAEt");
370
dpd_file2_copy(&Fae, CC_OEI, "Faet");
372
dpd_file2_close(&FAE);
373
dpd_file2_close(&Fae);
375
dpd_file2_init(&FAEt, CC_OEI, 0, 1, 1, "FAEt");
376
dpd_file2_init(&Faet, CC_OEI, 0, 3, 3, "Faet");
378
dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
379
dpd_file2_init(&FME, CC_OEI, 0, 0, 1, "FME");
380
dpd_contract222(&tIA, &FME, &FAEt, 1, 1, -0.5, 1);
381
dpd_file2_close(&tIA);
382
dpd_file2_close(&FME);
384
dpd_file2_init(&tia, CC_OEI, 0, 2, 3, "tia");
385
dpd_file2_init(&Fme, CC_OEI, 0, 2, 3, "Fme");
386
dpd_contract222(&tia, &Fme, &Faet, 1, 1, -0.5, 1);
387
dpd_file2_close(&tia);
388
dpd_file2_close(&Fme);
391
dpd_file2_close(&FAEt);
392
dpd_file2_close(&Faet);
395
}} // namespace psi::ccenergy