1
#include <libdpd/dpd.h>
5
/* FOLD(): Fold the Fock matrix contributions to the energy (or energy
6
** derivative) into the two-particle density matrix. Here we are
7
** trying to convert from an energy expression of the form:
9
** E = sum_pq Dpq fpq + 1/4 sum_pqrs Gpqrs <pq||rs>
13
** E = sum_pq Dpq hpq + 1/4 sum_pqrs Gpqrs <pq||rs>
15
** We do this by shifting some one-particle density matrix components
16
** into appropriate two-particle density matrix components:
18
** G'pmrm = Dpr + 4 * Gpmrm
20
** One problem is that we need to make sure the resulting density,
21
** G'pqrs, is still antisymmetric to permutation of p and q or r and
22
** s. So, for example, for the Gimkm component we compute:
24
** G'pmrm = Dpr + Gpmrm
25
** G'mprm = Dpr - Gmprm
26
** G'pmmr = Dpr - Gpmmr
27
** G'mpmr = Dpr + Gmpmr
30
void rhf_sf_fold(void);
31
void uhf_sf_fold(void);
35
if(params.ref == 0) rhf_sf_fold();
36
else if(params.ref == 2) uhf_sf_fold();
39
void rhf_sf_fold(void)
42
int i, j, k, l, m, a, b;
43
int I, J, K, L, M, A, B;
44
int IM, JM, MI, MJ, MK, ML, MA, MB;
45
int Gi, Gj, Gk, Gl, Gm, Ga, Gb;
47
int *occ_off, *vir_off;
48
int *occ_sym, *vir_sym;
49
dpdfile2 D, D1, D2, F;
50
dpdbuf4 G, Aints, E, C, DInts, FInts, BInts, G1, G2;
51
double one_energy=0.0, two_energy=0.0, total_two_energy=0.0;
52
double test_energy = 0.0, tmp;
63
fprintf(outfile, "\n\tEnergies re-computed from Fock-adjusted CC density:\n");
64
fprintf(outfile, "\t---------------------------------------------------\n");
66
dpd_file2_init(&D, CC_OEI, 0, 0, 0, "DIJ");
67
dpd_file2_init(&F, CC_OEI, 0, 0, 0, "h(i,j)");
68
this_energy = dpd_file2_dot(&D, &F);
72
/* fprintf(outfile, "\tDIJ = %20.15f\n", this_energy); */
73
one_energy += this_energy;
75
dpd_file2_init(&D, CC_OEI, 0, 0, 0, "Dij");
76
dpd_file2_init(&F, CC_OEI, 0, 0, 0, "h(i,j)");
77
this_energy = dpd_file2_dot(&D, &F);
81
/* fprintf(outfile, "\tDij = %20.15f\n", this_energy); */
82
one_energy += this_energy;
84
dpd_file2_init(&D, CC_OEI, 0, 1, 1, "DAB");
85
dpd_file2_init(&F, CC_OEI, 0, 1, 1, "h(a,b)");
86
this_energy = dpd_file2_dot(&D, &F);
90
/* fprintf(outfile, "\tDAB = %20.15f\n", this_energy); */
91
one_energy += this_energy;
93
dpd_file2_init(&D, CC_OEI, 0, 1, 1, "Dab");
94
dpd_file2_init(&F, CC_OEI, 0, 1, 1, "h(a,b)");
95
this_energy = dpd_file2_dot(&D, &F);
99
/* fprintf(outfile, "\tDab = %20.15f\n", this_energy); */
100
one_energy += this_energy;
102
dpd_file2_init(&D, CC_OEI, 0, 0, 1, "DIA");
103
dpd_file2_init(&F, CC_OEI, 0, 0, 1, "h(i,a)");
104
this_energy = dpd_file2_dot(&D, &F);
108
/* fprintf(outfile, "\tDIA = %20.15f\n", this_energy); */
109
one_energy += this_energy;
111
dpd_file2_init(&D, CC_OEI, 0, 0, 1, "Dia");
112
dpd_file2_init(&F, CC_OEI, 0, 0, 1, "h(i,a)");
113
this_energy = dpd_file2_dot(&D, &F);
117
/* fprintf(outfile, "\tDia = %20.15f\n", this_energy); */
118
one_energy += this_energy;
120
dpd_file2_init(&D, CC_OEI, 0, 0, 1, "DAI");
121
dpd_file2_init(&F, CC_OEI, 0, 0, 1, "h(i,a)");
122
this_energy = dpd_file2_dot(&D, &F);
126
/* fprintf(outfile, "\tDAI = %20.15f\n", this_energy); */
127
one_energy += this_energy;
129
dpd_file2_init(&D, CC_OEI, 0, 0, 1, "Dai");
130
dpd_file2_init(&F, CC_OEI, 0, 0, 1, "h(i,a)");
131
this_energy = dpd_file2_dot(&D, &F);
135
/* fprintf(outfile, "\tDai = %20.15f\n", this_energy); */
136
one_energy += this_energy;
138
fprintf(outfile, "\tOne-electron energy = %20.15f\n", one_energy);
141
dpd_file2_init(&D, CC_OEI, 0, 0, 0, "DIJ");
142
dpd_file2_mat_init(&D);
143
dpd_file2_mat_rd(&D);
145
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 0, 2, 2, 0, "GIJKL");
146
dpd_buf4_scm(&G,0.0);
149
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 0, 2, 2, 0, "GIJKL");
150
for(h=0; h < nirreps; h++) {
151
dpd_buf4_mat_irrep_init(&G, h);
152
dpd_buf4_mat_irrep_rd(&G, h);
154
for(Gm=0; Gm < nirreps; Gm++) {
157
for(i=0; i < occpi[Gi]; i++) {
159
for(j=0; j < occpi[Gj]; j++) {
161
for(m=0; m < occpi[Gm]; m++) {
164
IM = G.params->rowidx[I][M];
165
JM = G.params->colidx[J][M];
166
MI = G.params->rowidx[M][I];
167
MJ = G.params->colidx[M][J];
169
G.matrix[h][IM][JM] += D.matrix[Gi][i][j];
170
G.matrix[h][IM][MJ] -= D.matrix[Gi][i][j];
171
G.matrix[h][MI][MJ] += D.matrix[Gi][i][j];
172
G.matrix[h][MI][JM] -= D.matrix[Gi][i][j];
178
dpd_buf4_mat_irrep_wrt(&G, h);
179
dpd_buf4_mat_irrep_close(&G, h);
183
dpd_buf4_init(&Aints, CC_AINTS, 0, 0, 0, 0, 0, 1, "A <ij|kl>");
184
two_energy += 0.25 * dpd_buf4_dot(&Aints, &G);
185
dpd_buf4_close(&Aints);
189
dpd_file2_mat_close(&D);
192
dpd_file2_init(&D, CC_OEI, 0, 0, 0, "Dij");
193
dpd_file2_mat_init(&D);
194
dpd_file2_mat_rd(&D);
196
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 0, 2, 2, 0, "Gijkl");
197
dpd_buf4_scm(&G,0.0);
200
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 0, 2, 2, 0, "Gijkl");
201
for(h=0; h < nirreps; h++) {
202
dpd_buf4_mat_irrep_init(&G, h);
203
dpd_buf4_mat_irrep_rd(&G, h);
205
for(Gm=0; Gm < nirreps; Gm++) {
208
for(i=0; i < occpi[Gi]; i++) {
210
for(j=0; j < occpi[Gj]; j++) {
212
for(m=0; m < occpi[Gm]; m++) {
215
IM = G.params->rowidx[I][M];
216
JM = G.params->colidx[J][M];
217
MI = G.params->rowidx[M][I];
218
MJ = G.params->colidx[M][J];
220
G.matrix[h][IM][JM] += D.matrix[Gi][i][j];
221
G.matrix[h][MI][JM] -= D.matrix[Gi][i][j];
222
G.matrix[h][MI][MJ] += D.matrix[Gi][i][j];
223
G.matrix[h][IM][MJ] -= D.matrix[Gi][i][j];
229
dpd_buf4_mat_irrep_wrt(&G, h);
230
dpd_buf4_mat_irrep_close(&G, h);
233
dpd_buf4_init(&Aints, CC_AINTS, 0, 0, 0, 0, 0, 1, "A <ij|kl>");
234
two_energy += 0.25 * dpd_buf4_dot(&Aints, &G);
235
dpd_buf4_close(&Aints);
239
dpd_file2_mat_close(&D);
242
dpd_file2_init(&D, CC_OEI, 0, 0, 0, "DIJ");
243
dpd_file2_mat_init(&D);
244
dpd_file2_mat_rd(&D);
246
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 0, 0, 0, 0, "GIjKl");
247
dpd_buf4_scm(&G,0.0);
250
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 0, 0, 0, 0, "GIjKl");
251
for(h=0; h < nirreps; h++) {
252
dpd_buf4_mat_irrep_init(&G, h);
253
dpd_buf4_mat_irrep_rd(&G, h);
255
for(Gm=0; Gm < nirreps; Gm++) {
258
for(i=0; i < occpi[Gi]; i++) {
260
for(j=0; j < occpi[Gj]; j++) {
262
for(m=0; m < occpi[Gm]; m++) {
265
IM = G.params->rowidx[I][M];
266
JM = G.params->colidx[J][M];
268
G.matrix[h][IM][JM] += D.matrix[Gi][i][j];
274
dpd_buf4_mat_irrep_wrt(&G, h);
275
dpd_buf4_mat_irrep_close(&G, h);
279
dpd_file2_mat_close(&D);
283
dpd_file2_init(&D, CC_OEI, 0, 0, 0, "Dij");
284
dpd_file2_mat_init(&D);
285
dpd_file2_mat_rd(&D);
287
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 0, 0, 0, 0, "GIjKl");
288
for(h=0; h < nirreps; h++) {
289
dpd_buf4_mat_irrep_init(&G, h);
290
dpd_buf4_mat_irrep_rd(&G, h);
292
for(Gm=0; Gm < nirreps; Gm++) {
295
for(k=0; k < occpi[Gk]; k++) {
297
for(l=0; l < occpi[Gl]; l++) {
299
for(m=0; m < occpi[Gm]; m++) {
302
MK = G.params->rowidx[M][K];
303
ML = G.params->colidx[M][L];
305
G.matrix[h][MK][ML] += D.matrix[Gk][k][l];
311
dpd_buf4_mat_irrep_wrt(&G, h);
312
dpd_buf4_mat_irrep_close(&G, h);
315
dpd_buf4_init(&Aints, CC_AINTS, 0, 0, 0, 0, 0, 0, "A <ij|kl>");
316
two_energy += dpd_buf4_dot(&Aints, &G);
317
dpd_buf4_close(&Aints);
321
total_two_energy += two_energy;
322
fprintf(outfile, "\tIJKL energy = %20.15f\n", two_energy);
325
dpd_file2_mat_close(&D);
328
dpd_file2_init(&D1, CC_OEI, 0, 0, 1, "DIA");
329
dpd_file2_mat_init(&D1);
330
dpd_file2_mat_rd(&D1);
331
dpd_file2_init(&D2, CC_OEI, 0, 0, 1, "DAI");
332
dpd_file2_mat_init(&D2);
333
dpd_file2_mat_rd(&D2);
335
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 10, 2, 10, 0, "GIJKA");
336
dpd_buf4_scm(&G,0.0);
339
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 10, 2, 10, 0, "GIJKA");
340
for(h=0; h < nirreps; h++) {
341
dpd_buf4_mat_irrep_init(&G, h);
342
dpd_buf4_mat_irrep_rd(&G, h);
344
for(Gm=0; Gm < nirreps; Gm++) {
347
for(i=0; i < occpi[Gi]; i++) {
349
for(a=0; a < virtpi[Ga]; a++) {
351
for(m=0; m < occpi[Gm]; m++) {
354
MI = G.params->rowidx[M][I];
355
IM = G.params->rowidx[I][M];
356
MA = G.params->colidx[M][A];
358
G.matrix[h][MI][MA] += 0.5 * (D1.matrix[Gi][i][a] +
359
D2.matrix[Gi][i][a]);
360
G.matrix[h][IM][MA] -= 0.5 * (D1.matrix[Gi][i][a] +
361
D2.matrix[Gi][i][a]);
367
dpd_buf4_mat_irrep_wrt(&G, h);
368
dpd_buf4_mat_irrep_close(&G, h);
372
dpd_buf4_init(&E, CC_EINTS, 0, 0, 10, 2, 10, 0, "E <ij||ka> (i>j,ka)");
373
two_energy += dpd_buf4_dot(&E, &G);
378
dpd_file2_mat_close(&D1);
379
dpd_file2_close(&D1);
380
dpd_file2_mat_close(&D2);
381
dpd_file2_close(&D2);
383
dpd_file2_init(&D1, CC_OEI, 0, 0, 1, "Dia");
384
dpd_file2_mat_init(&D1);
385
dpd_file2_mat_rd(&D1);
386
dpd_file2_init(&D2, CC_OEI, 0, 0, 1, "Dai");
387
dpd_file2_mat_init(&D2);
388
dpd_file2_mat_rd(&D2);
390
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 10, 2, 10, 0, "Gijka");
391
dpd_buf4_scm(&G,0.0);
394
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 10, 2, 10, 0, "Gijka");
395
for(h=0; h < nirreps; h++) {
396
dpd_buf4_mat_irrep_init(&G, h);
397
dpd_buf4_mat_irrep_rd(&G, h);
399
for(Gm=0; Gm < nirreps; Gm++) {
402
for(i=0; i < occpi[Gi]; i++) {
404
for(a=0; a < virtpi[Ga]; a++) {
406
for(m=0; m < occpi[Gm]; m++) {
409
MI = G.params->rowidx[M][I];
410
IM = G.params->rowidx[I][M];
411
MA = G.params->colidx[M][A];
413
G.matrix[h][MI][MA] += 0.5 * (D1.matrix[Gi][i][a] +
414
D2.matrix[Gi][i][a]);
415
G.matrix[h][IM][MA] -= 0.5 * (D1.matrix[Gi][i][a] +
416
D2.matrix[Gi][i][a]);
422
dpd_buf4_mat_irrep_wrt(&G, h);
423
dpd_buf4_mat_irrep_close(&G, h);
426
dpd_buf4_init(&E, CC_EINTS, 0, 0, 10, 2, 10, 0, "E <ij||ka> (i>j,ka)");
427
two_energy += dpd_buf4_dot(&E, &G);
432
dpd_file2_mat_close(&D1);
433
dpd_file2_close(&D1);
434
dpd_file2_mat_close(&D2);
435
dpd_file2_close(&D2);
437
dpd_file2_init(&D1, CC_OEI, 0, 0, 1, "DIA");
438
dpd_file2_mat_init(&D1);
439
dpd_file2_mat_rd(&D1);
440
dpd_file2_init(&D2, CC_OEI, 0, 0, 1, "DAI");
441
dpd_file2_mat_init(&D2);
442
dpd_file2_mat_rd(&D2);
444
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 10, 0, 10, 0, "GiJkA");
445
dpd_buf4_scm(&G,0.0);
448
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 10, 0, 10, 0, "GiJkA");
449
for(h=0; h < nirreps; h++) {
450
dpd_buf4_mat_irrep_init(&G, h);
451
dpd_buf4_mat_irrep_rd(&G, h);
453
for(Gm=0; Gm < nirreps; Gm++) {
456
for(i=0; i < occpi[Gi]; i++) {
458
for(a=0; a < virtpi[Ga]; a++) {
460
for(m=0; m < occpi[Gm]; m++) {
463
MI = G.params->rowidx[M][I];
464
MA = G.params->colidx[M][A];
466
G.matrix[h][MI][MA] += 0.5 * (D1.matrix[Gi][i][a] +
467
D2.matrix[Gi][i][a]);
473
dpd_buf4_mat_irrep_wrt(&G, h);
474
dpd_buf4_mat_irrep_close(&G, h);
477
dpd_buf4_init(&E, CC_EINTS, 0, 0, 10, 0, 10, 0, "E <ij|ka>");
478
two_energy += 2 * dpd_buf4_dot(&E, &G);
483
dpd_file2_mat_close(&D1);
484
dpd_file2_close(&D1);
485
dpd_file2_mat_close(&D2);
486
dpd_file2_close(&D2);
488
dpd_file2_init(&D1, CC_OEI, 0, 0, 1, "Dia");
489
dpd_file2_mat_init(&D1);
490
dpd_file2_mat_rd(&D1);
491
dpd_file2_init(&D2, CC_OEI, 0, 0, 1, "Dai");
492
dpd_file2_mat_init(&D2);
493
dpd_file2_mat_rd(&D2);
495
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 10, 0, 10, 0, "GIjKa");
496
dpd_buf4_scm(&G,0.0);
499
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 10, 0, 10, 0, "GIjKa");
500
for(h=0; h < nirreps; h++) {
501
dpd_buf4_mat_irrep_init(&G, h);
502
dpd_buf4_mat_irrep_rd(&G, h);
504
for(Gm=0; Gm < nirreps; Gm++) {
507
for(i=0; i < occpi[Gi]; i++) {
509
for(a=0; a < virtpi[Ga]; a++) {
511
for(m=0; m < occpi[Gm]; m++) {
514
MI = G.params->rowidx[M][I];
515
MA = G.params->colidx[M][A];
517
G.matrix[h][MI][MA] += 0.5 * (D1.matrix[Gi][i][a] +
518
D2.matrix[Gi][i][a]);
524
dpd_buf4_mat_irrep_wrt(&G, h);
525
dpd_buf4_mat_irrep_close(&G, h);
528
dpd_buf4_init(&E, CC_EINTS, 0, 0, 10, 0, 10, 0, "E <ij|ka>");
529
two_energy += 2 * dpd_buf4_dot(&E, &G);
534
total_two_energy += two_energy;
535
fprintf(outfile, "\tIJKA energy = %20.15f\n", two_energy);
538
dpd_file2_mat_close(&D1);
539
dpd_file2_close(&D1);
540
dpd_file2_mat_close(&D2);
541
dpd_file2_close(&D2);
544
dpd_buf4_init(&DInts, CC_DINTS, 0, 2, 7, 2, 7, 0, "D <ij||ab> (i>j,a>b)");
545
dpd_buf4_init(&G, CC_GAMMA, 0, 2, 7, 2, 7, 0, "GIJAB");
546
two_energy += dpd_buf4_dot(&G, &DInts);
548
dpd_buf4_init(&G, CC_GAMMA, 0, 2, 7, 2, 7, 0, "Gijab");
549
two_energy += dpd_buf4_dot(&G, &DInts);
551
dpd_buf4_close(&DInts);
552
dpd_buf4_init(&DInts, CC_DINTS, 0, 0, 5, 0, 5, 0, "D <ij|ab>");
553
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 5, 0, 5, 0, "GIjAb");
554
two_energy += dpd_buf4_dot(&G, &DInts);
556
dpd_buf4_close(&DInts);
559
total_two_energy += two_energy;
560
fprintf(outfile, "\tIJAB energy = %20.15f\n", two_energy);
563
dpd_file2_init(&D, CC_OEI, 0, 1, 1, "DAB");
564
dpd_file2_mat_init(&D);
565
dpd_file2_mat_rd(&D);
567
dpd_buf4_init(&G, CC_GAMMA, 0, 10, 10, 10, 10, 0, "GIBJA");
568
dpd_buf4_scm(&G, 0.0);
571
dpd_buf4_init(&G, CC_GAMMA, 0, 10, 10, 10, 10, 0, "GIBJA");
572
for(h=0; h < nirreps; h++) {
573
dpd_buf4_mat_irrep_init(&G, h);
574
dpd_buf4_mat_irrep_rd(&G, h);
576
for(Gm=0; Gm < nirreps; Gm++) {
579
for(b=0; b < virtpi[Gb]; b++) {
581
for(a=0; a < virtpi[Ga]; a++) {
583
for(m=0; m < occpi[Gm]; m++) {
586
MB = G.params->rowidx[M][B];
587
MA = G.params->colidx[M][A];
589
G.matrix[h][MB][MA] += D.matrix[Ga][a][b];
595
dpd_buf4_mat_irrep_wrt(&G, h);
596
dpd_buf4_mat_irrep_close(&G, h);
600
dpd_buf4_init(&C, CC_CINTS, 0, 10, 10, 10, 10, 0, "C <ia||jb>");
601
two_energy += dpd_buf4_dot(&C, &G);
606
dpd_file2_mat_close(&D);
610
dpd_file2_init(&D, CC_OEI, 0, 1, 1, "Dab");
611
dpd_file2_mat_init(&D);
612
dpd_file2_mat_rd(&D);
614
dpd_buf4_init(&G, CC_GAMMA, 0, 10, 10, 10, 10, 0, "Gibja");
615
dpd_buf4_scm(&G, 0.0);
618
dpd_buf4_init(&G, CC_GAMMA, 0, 10, 10, 10, 10, 0, "Gibja");
619
for(h=0; h < nirreps; h++) {
620
dpd_buf4_mat_irrep_init(&G, h);
621
dpd_buf4_mat_irrep_rd(&G, h);
623
for(Gm=0; Gm < nirreps; Gm++) {
626
for(b=0; b < virtpi[Gb]; b++) {
628
for(a=0; a < virtpi[Ga]; a++) {
630
for(m=0; m < occpi[Gm]; m++) {
633
MB = G.params->rowidx[M][B];
634
MA = G.params->colidx[M][A];
636
G.matrix[h][MB][MA] += D.matrix[Ga][a][b];
642
dpd_buf4_mat_irrep_wrt(&G, h);
643
dpd_buf4_mat_irrep_close(&G, h);
646
dpd_buf4_init(&C, CC_CINTS, 0, 10, 10, 10, 10, 0, "C <ia||jb>");
647
two_energy += dpd_buf4_dot(&C, &G);
652
dpd_file2_mat_close(&D);
655
dpd_file2_init(&D, CC_OEI, 0, 1, 1, "Dab");
656
dpd_file2_mat_init(&D);
657
dpd_file2_mat_rd(&D);
659
dpd_buf4_init(&G, CC_GAMMA, 0, 10, 10, 10, 10, 0, "GIbJa");
660
dpd_buf4_scm(&G, 0.0);
663
dpd_buf4_init(&G, CC_GAMMA, 0, 10, 10, 10, 10, 0, "GIbJa");
664
for(h=0; h < nirreps; h++) {
665
dpd_buf4_mat_irrep_init(&G, h);
666
dpd_buf4_mat_irrep_rd(&G, h);
668
for(Gm=0; Gm < nirreps; Gm++) {
671
for(b=0; b < virtpi[Gb]; b++) {
673
for(a=0; a < virtpi[Ga]; a++) {
675
for(m=0; m < occpi[Gm]; m++) {
678
MB = G.params->rowidx[M][B];
679
MA = G.params->colidx[M][A];
681
G.matrix[h][MB][MA] += D.matrix[Ga][a][b];
687
dpd_buf4_mat_irrep_wrt(&G, h);
688
dpd_buf4_mat_irrep_close(&G, h);
691
dpd_buf4_init(&C, CC_CINTS, 0, 10, 10, 10, 10, 0, "C <ia|jb>");
692
two_energy += dpd_buf4_dot(&C, &G);
697
dpd_file2_mat_close(&D);
700
dpd_file2_init(&D, CC_OEI, 0, 1, 1, "DAB");
701
dpd_file2_mat_init(&D);
702
dpd_file2_mat_rd(&D);
704
dpd_buf4_init(&G, CC_GAMMA, 0, 10, 10, 10, 10, 0, "GiBjA");
705
dpd_buf4_scm(&G, 0.0);
708
dpd_buf4_init(&G, CC_GAMMA, 0, 10, 10, 10, 10, 0, "GiBjA");
709
for(h=0; h < nirreps; h++) {
710
dpd_buf4_mat_irrep_init(&G, h);
711
dpd_buf4_mat_irrep_rd(&G, h);
713
for(Gm=0; Gm < nirreps; Gm++) {
716
for(b=0; b < virtpi[Gb]; b++) {
718
for(a=0; a < virtpi[Ga]; a++) {
720
for(m=0; m < occpi[Gm]; m++) {
723
MB = G.params->rowidx[M][B];
724
MA = G.params->colidx[M][A];
726
G.matrix[h][MB][MA] += D.matrix[Ga][a][b];
731
dpd_buf4_mat_irrep_wrt(&G, h);
732
dpd_buf4_mat_irrep_close(&G, h);
735
dpd_buf4_init(&C, CC_CINTS, 0, 10, 10, 10, 10, 0, "C <ia|jb>");
736
two_energy += dpd_buf4_dot(&C, &G);
741
dpd_file2_mat_close(&D);
744
dpd_buf4_init(&DInts, CC_DINTS, 0, 10, 10, 10, 10, 0, "D <ij|ab> (ib,ja)");
745
dpd_buf4_init(&G, CC_GAMMA, 0, 10, 10, 10, 10, 0, "GIbjA");
746
two_energy -= dpd_buf4_dot(&G, &DInts);
748
dpd_buf4_init(&G, CC_GAMMA, 0, 10, 10, 10, 10, 0, "GiBJa");
749
two_energy -= dpd_buf4_dot(&G, &DInts);
751
dpd_buf4_close(&DInts);
753
total_two_energy += two_energy;
754
fprintf(outfile, "\tIBJA energy = %20.15f\n", two_energy);
757
fprintf(outfile, "\tMP2 correlation energy = %20.15f\n",
758
one_energy + total_two_energy);
759
fprintf(outfile, "\tTotal MP2 energy = %20.15f\n",
760
one_energy + total_two_energy + mo.Escf);
763
void uhf_sf_fold(void)