3
#include <libciomr/libciomr.h>
4
#include <libdpd/dpd.h>
10
void scf_check_uhf(void);
11
void scf_check_rhf(void);
15
if(params.ref == 2) scf_check_uhf();
19
void scf_check_uhf(void)
21
int h, nirreps, i, j, I, J, IJ, Gi, Gj;
22
int *aoccpi, *boccpi, *aocc_off, *bocc_off;
23
double E1A, E1B, E2AA, E2BB, E2AB;
27
nirreps = moinfo.nirreps;
28
aoccpi = moinfo.aoccpi;
29
boccpi = moinfo.boccpi;
30
aocc_off = moinfo.aocc_off;
31
bocc_off = moinfo.bocc_off;
33
dpd_file2_init(&hIJ, CC_OEI, 0, 0, 0, "h(I,J)");
34
dpd_file2_init(&hij, CC_OEI, 0, 2, 2, "h(i,j)");
35
dpd_file2_mat_init(&hIJ);
36
dpd_file2_mat_init(&hij);
37
dpd_file2_mat_rd(&hIJ);
38
dpd_file2_mat_rd(&hij);
41
for(h=0; h < nirreps; h++) {
42
for(i=0; i < aoccpi[h]; i++)
43
E1A += hIJ.matrix[h][i][i];
45
for(i=0; i < boccpi[h]; i++)
46
E1B += hij.matrix[h][i][i];
49
dpd_file2_mat_close(&hIJ);
50
dpd_file2_mat_close(&hij);
52
dpd_buf4_init(&A, CC_AINTS, 0, 0, 0, 0, 0, 1, "A <IJ|KL>");
54
for(h=0; h < nirreps; h++) {
55
dpd_buf4_mat_irrep_init(&A, h);
56
dpd_buf4_mat_irrep_rd(&A, h);
57
for(Gi=0; Gi < nirreps; Gi++) {
59
for(i=0; i < aoccpi[Gi]; i++) {
61
for(j=0; j < aoccpi[Gj]; j++) {
63
IJ = A.params->rowidx[I][J];
64
E2AA += 0.5 * A.matrix[h][IJ][IJ];
68
dpd_buf4_mat_irrep_close(&A, h);
72
dpd_buf4_init(&A, CC_AINTS, 0, 10, 10, 10, 10, 1, "A <ij|kl>");
74
for(h=0; h < nirreps; h++) {
75
dpd_buf4_mat_irrep_init(&A, h);
76
dpd_buf4_mat_irrep_rd(&A, h);
77
for(Gi=0; Gi < nirreps; Gi++) {
79
for(i=0; i < boccpi[Gi]; i++) {
81
for(j=0; j < boccpi[Gj]; j++) {
83
IJ = A.params->rowidx[I][J];
84
E2BB += 0.5 * A.matrix[h][IJ][IJ];
88
dpd_buf4_mat_irrep_close(&A, h);
92
dpd_buf4_init(&A, CC_AINTS, 0, 22, 22, 22, 22, 0, "A <Ij|Kl>");
94
for(h=0; h < nirreps; h++) {
95
dpd_buf4_mat_irrep_init(&A, h);
96
dpd_buf4_mat_irrep_rd(&A, h);
97
for(Gi=0; Gi < nirreps; Gi++) {
99
for(i=0; i < aoccpi[Gi]; i++) {
100
I = aocc_off[Gi] + i;
101
for(j=0; j < boccpi[Gj]; j++) {
102
J = bocc_off[Gj] + j;
103
IJ = A.params->rowidx[I][J];
104
E2AB += A.matrix[h][IJ][IJ];
108
dpd_buf4_mat_irrep_close(&A, h);
112
moinfo.eref = E1A+ E1B+ E2AA+ E2BB+ E2AB + moinfo.enuc + moinfo.efzc;
114
fprintf(outfile, "\tOne-electron energy = %20.14f\n", E1A + E1B);
115
fprintf(outfile, "\tTwo-electron (AA) energy = %20.14f\n", E2AA);
116
fprintf(outfile, "\tTwo-electron (BB) energy = %20.14f\n", E2BB);
117
fprintf(outfile, "\tTwo-electron (AB) energy = %20.14f\n", E2AB);
118
fprintf(outfile, "\tTwo-electron energy = %20.14f\n", E2AA + E2BB + E2AB);
119
fprintf(outfile, "\tFrozen-core energy (transqt) = %20.14f\n", moinfo.efzc);
120
fprintf(outfile, "\tReference energy = %20.14f\n", moinfo.eref);
123
void scf_check_rhf(void)
129
int *occ_off, *vir_off;
130
int *occ_sym, *vir_sym;
132
dpdbuf4 AInts_anti, AInts;
134
double E1A, E1B, E2AA, E2BB, E2AB;
136
nirreps = moinfo.nirreps;
137
occpi = moinfo.occpi; virtpi = moinfo.virtpi;
138
occ_off = moinfo.occ_off; vir_off = moinfo.vir_off;
139
occ_sym = moinfo.occ_sym; vir_sym = moinfo.vir_sym;
140
openpi = moinfo.openpi;
142
/* One-electron (frozen-core) contributions */
143
dpd_file2_init(&Hoo, CC_OEI, 0, 0, 0, "h(i,j)");
144
dpd_file2_mat_init(&Hoo);
145
dpd_file2_mat_rd(&Hoo);
148
for(h=0; h < nirreps; h++) {
150
for(i=0; i < occpi[h]; i++)
151
E1A += Hoo.matrix[h][i][i];
153
for(i=0; i < (occpi[h]-openpi[h]); i++)
154
E1B += Hoo.matrix[h][i][i];
157
dpd_file2_mat_close(&Hoo);
158
dpd_file2_close(&Hoo);
160
/* Two-electron contributions */
162
/* Prepare the A integral buffers */
163
dpd_buf4_init(&AInts_anti, CC_AINTS, 0, 0, 0, 0, 0, 1, "A <ij|kl>");
164
dpd_buf4_init(&AInts, CC_AINTS, 0, 0, 0, 0, 0, 0, "A <ij|kl>");
166
E2AA = E2BB = E2AB = 0.0;
167
for(h=0; h < nirreps; h++) {
169
dpd_buf4_mat_irrep_init(&AInts_anti, h);
170
dpd_buf4_mat_irrep_rd(&AInts_anti, h);
172
/* Loop over irreps of the target */
173
for(Gi=0; Gi < nirreps; Gi++) {
176
/* Loop over the orbitals of the target */
177
for(i=0; i < occpi[Gi]; i++) {
179
for(j=0; j < occpi[Gj]; j++) {
182
IJ = AInts_anti.params->rowidx[I][J];
184
E2AA += AInts_anti.matrix[h][IJ][IJ];
189
/* Loop over the orbitals of the target */
190
for(i=0; i < (occpi[Gi] - openpi[Gi]); i++) {
192
for(j=0; j < (occpi[Gj] - openpi[Gj]); j++) {
195
IJ = AInts_anti.params->rowidx[I][J];
197
E2BB += AInts_anti.matrix[h][IJ][IJ];
203
dpd_buf4_mat_irrep_close(&AInts_anti, h);
205
dpd_buf4_mat_irrep_init(&AInts, h);
206
dpd_buf4_mat_irrep_rd(&AInts, h);
208
/* Loop over irreps of the target */
209
for(Gi=0; Gi < nirreps; Gi++) {
212
/* Loop over the orbitals of the target */
213
for(i=0; i < occpi[Gi]; i++) {
215
for(j=0; j < (occpi[Gj] - openpi[Gj]); j++) {
218
IJ = AInts.params->rowidx[I][J];
220
E2AB += AInts.matrix[h][IJ][IJ];
226
dpd_buf4_mat_irrep_close(&AInts, h);
230
/* Close the A Integral buffers */
231
dpd_buf4_close(&AInts_anti);
232
dpd_buf4_close(&AInts);
235
fprintf(outfile, "\n\tEFZC = %20.15f\n", moinfo.efzc);
236
fprintf(outfile, "\n\tE1A = %20.15f\n", E1A);
237
fprintf(outfile, "\tE1B = %20.15f\n", E1B);
238
fprintf(outfile, "\tE2AA = %20.15f\n", E2AA);
239
fprintf(outfile, "\tE2BB = %20.15f\n", E2BB);
240
fprintf(outfile, "\tE2AB = %20.15f\n", E2AB);
243
moinfo.eref = E1A+E1B+0.5*(E2AA+E2BB)+E2AB + moinfo.enuc + moinfo.efzc;
245
fprintf(outfile, "\tOne-electron energy = %20.14f\n", E1A+E1B);
246
fprintf(outfile, "\tTwo-electron (AA) energy = %20.14f\n", E2AA);
247
fprintf(outfile, "\tTwo-electron (BB) energy = %20.14f\n", E2BB);
248
fprintf(outfile, "\tTwo-electron (AB) energy = %20.14f\n", E2AB);
249
fprintf(outfile, "\tTwo-electron energy = %20.14f\n", 0.5*(E2AA+E2BB)+E2AB);
250
fprintf(outfile, "\tFrozen-core energy (transqt) = %20.14f\n", moinfo.efzc);
251
fprintf(outfile, "\tReference energy = %20.14f\n", moinfo.eref);