3
\brief Calculates the one- and two-electron CC energies using the
4
coresponding one- and two-particle density matrices.
9
#include <libdpd/dpd.h>
16
namespace psi { namespace ccdensity {
18
/* ENERGY_UHF(): Compute the UHF CC energy using the one- and two-particle
22
void energy_UHF(struct RHO_Params rho_params)
25
dpdbuf4 G, A, B, C, DInts, E, FInts;
26
double one_energy=0.0, two_energy=0.0, total_two_energy = 0.0;
27
double this_energy, test_energy;
29
fprintf(outfile, "\n\tEnergies re-computed from CC density:\n");
30
fprintf(outfile, "\t-------------------------------------\n");
32
dpd_file2_init(&D, CC_OEI, 0, 0, 0, rho_params.DIJ_lbl);
33
dpd_file2_init(&F, CC_OEI, 0, 0, 0, "fIJ");
34
this_energy = dpd_file2_dot(&D, &F);
38
/* fprintf(outfile, "\tDIJ = %20.15f\n", this_energy); */
39
one_energy += this_energy;
41
dpd_file2_init(&D, CC_OEI, 0, 2, 2, rho_params.Dij_lbl);
42
dpd_file2_init(&F, CC_OEI, 0, 2, 2, "fij");
43
this_energy = dpd_file2_dot(&D, &F);
47
/* fprintf(outfile, "\tDij = %20.15f\n", this_energy); */
48
one_energy += this_energy;
50
dpd_file2_init(&D, CC_OEI, 0, 1, 1, rho_params.DAB_lbl);
51
dpd_file2_init(&F, CC_OEI, 0, 1, 1, "fAB");
52
this_energy = dpd_file2_dot(&D, &F);
56
/* fprintf(outfile, "\tDAB = %20.15f\n", this_energy); */
57
one_energy += this_energy;
59
dpd_file2_init(&D, CC_OEI, 0, 3, 3, rho_params.Dab_lbl);
60
dpd_file2_init(&F, CC_OEI, 0, 3, 3, "fab");
61
this_energy = dpd_file2_dot(&D, &F);
65
/* fprintf(outfile, "\tDab = %20.15f\n", this_energy); */
66
one_energy += this_energy;
68
dpd_file2_init(&D, CC_OEI, 0, 0, 1, rho_params.DIA_lbl);
69
dpd_file2_init(&F, CC_OEI, 0, 0, 1, "fIA");
70
this_energy = dpd_file2_dot(&D, &F);
74
/* fprintf(outfile, "\tDIA = %20.15f\n", this_energy); */
75
one_energy += this_energy;
77
dpd_file2_init(&D, CC_OEI, 0, 2, 3, rho_params.Dia_lbl);
78
dpd_file2_init(&F, CC_OEI, 0, 2, 3, "fia");
79
this_energy = dpd_file2_dot(&D, &F);
83
/* fprintf(outfile, "\tDia = %20.15f\n", this_energy); */
84
one_energy += this_energy;
86
dpd_file2_init(&D, CC_OEI, 0, 0, 1, rho_params.DAI_lbl);
87
dpd_file2_init(&F, CC_OEI, 0, 0, 1, "fIA");
88
this_energy = dpd_file2_dot(&D, &F);
92
/* fprintf(outfile, "\tDAI = %20.15f\n", this_energy); */
93
one_energy += this_energy;
95
dpd_file2_init(&D, CC_OEI, 0, 2, 3, rho_params.Dai_lbl);
96
dpd_file2_init(&F, CC_OEI, 0, 2, 3, "fia");
97
this_energy = dpd_file2_dot(&D, &F);
100
/* fprintf(outfile, "\tDai = %20.15f\n", this_energy); */
101
one_energy += this_energy;
103
fprintf(outfile, "\tOne-electron energy = %20.15f\n", one_energy);
105
if (params.onepdm) return;
107
total_two_energy = 0.0;
112
dpd_buf4_init(&A, CC_AINTS, 0, 2, 2, 0, 0, 1, "A <IJ|KL>");
113
dpd_buf4_init(&G, CC_GAMMA, 0, 2, 2, 2, 2, 0, "GIJKL");
114
two_energy += dpd_buf4_dot(&G, &A);
118
dpd_buf4_init(&A, CC_AINTS, 0, 12, 12, 10, 10, 1, "A <ij|kl>");
119
dpd_buf4_init(&G, CC_GAMMA, 0, 12, 12, 12, 12, 0, "Gijkl");
120
two_energy += dpd_buf4_dot(&G, &A);
124
dpd_buf4_init(&A, CC_AINTS, 0, 22, 22, 22, 22, 0, "A <Ij|Kl>");
125
dpd_buf4_init(&G, CC_GAMMA, 0, 22, 22, 22, 22, 0, "GIjKl");
126
two_energy += dpd_buf4_dot(&G, &A);
130
total_two_energy += two_energy;
131
fprintf(outfile, "\tIJKL energy = %20.15f\n", two_energy);
136
dpd_buf4_init(&E, CC_EINTS, 0, 2, 20, 2, 20, 0, "E <IJ||KA> (I>J,KA)");
137
dpd_buf4_init(&G, CC_GAMMA, 0, 2, 20, 2, 20, 0, "GIJKA");
138
two_energy += dpd_buf4_dot(&G, &E);
142
dpd_buf4_init(&E, CC_EINTS, 0, 12, 30, 12, 30, 0, "E <ij||ka> (i>j,ka)");
143
dpd_buf4_init(&G, CC_GAMMA, 0, 12, 30, 12, 30, 0, "Gijka");
144
two_energy += dpd_buf4_dot(&G, &E);
148
dpd_buf4_init(&E, CC_EINTS, 0, 22, 24, 22, 24, 0, "E <Ij|Ka>");
149
dpd_buf4_init(&G, CC_GAMMA, 0, 22, 24, 22, 24, 0, "GIjKa");
150
two_energy += dpd_buf4_dot(&G, &E);
154
dpd_buf4_init(&E, CC_EINTS, 0, 23, 27, 23, 27, 0, "E <iJ|kA>");
155
dpd_buf4_init(&G, CC_GAMMA, 0, 23, 27, 23, 27, 0, "GiJkA");
156
two_energy += dpd_buf4_dot(&G, &E);
161
total_two_energy += two_energy;
162
fprintf(outfile, "\tIJKA energy = %20.15f\n", two_energy);
168
dpd_buf4_init(&DInts, CC_DINTS, 0, 2, 7, 2, 7, 0, "D <IJ||AB> (I>J,A>B)");
169
dpd_buf4_init(&G, CC_GAMMA, 0, 2, 7, 2, 7, 0, "GIJAB");
170
two_energy += dpd_buf4_dot(&G, &DInts);
172
dpd_buf4_close(&DInts);
174
dpd_buf4_init(&DInts, CC_DINTS, 0, 12, 17, 12, 17, 0, "D <ij||ab> (i>j,a>b)");
175
dpd_buf4_init(&G, CC_GAMMA, 0, 12, 17, 12, 17, 0, "Gijab");
176
two_energy += dpd_buf4_dot(&G, &DInts);
178
dpd_buf4_close(&DInts);
180
dpd_buf4_init(&DInts, CC_DINTS, 0, 22, 28, 22, 28, 0, "D <Ij|Ab>");
181
dpd_buf4_init(&G, CC_GAMMA, 0, 22, 28, 22, 28, 0, "GIjAb");
182
two_energy += dpd_buf4_dot(&G, &DInts);
184
dpd_buf4_close(&DInts);
187
total_two_energy += two_energy;
188
fprintf(outfile, "\tIJAB energy = %20.15f\n", two_energy);
192
** Compute the Gibja contribution to the two-electron energy. By
193
** spin-case this contribution looks like:
195
** E(AA) <-- sum_IBJA G(IB,JA) <JA||IB>
196
** E(BB) <-- sum_ibja G(ib,ja) <ja||ib>
197
** E(AB) <-- sum_IbJa ( G(Ib,Ja) <Ja|Ib> + G(iB,jA) <jA|iB> -
198
** G(Ib,jA) <jA|bI> - G(iB,Ja) <Ja|Bi> )
200
** See Gibja.c for the definition of G here.
205
dpd_buf4_init(&C, CC_CINTS, 0, 20, 20, 20, 20, 0, "C <IA||JB>");
206
dpd_buf4_init(&G, CC_GAMMA, 0, 20, 20, 20, 20, 0, "GIBJA");
207
two_energy += dpd_buf4_dot(&G, &C);
211
dpd_buf4_init(&C, CC_CINTS, 0, 30, 30, 30, 30, 0, "C <ia||jb>");
212
dpd_buf4_init(&G, CC_GAMMA, 0, 30, 30, 30, 30, 0, "Gibja");
213
two_energy += dpd_buf4_dot(&G, &C);
217
dpd_buf4_init(&C, CC_CINTS, 0, 24, 24, 24, 24, 0, "C <Ia|Jb>");
218
dpd_buf4_init(&G, CC_GAMMA, 0, 24, 24, 24, 24, 0, "GIbJa");
219
two_energy += dpd_buf4_dot(&G, &C);
223
dpd_buf4_init(&C, CC_CINTS, 0, 27, 27, 27, 27, 0, "C <iA|jB>");
224
dpd_buf4_init(&G, CC_GAMMA, 0, 27, 27, 27, 27, 0, "GiBjA");
225
two_energy += dpd_buf4_dot(&G, &C);
229
dpd_buf4_init(&DInts, CC_DINTS, 0, 24, 27, 24, 27, 0, "D <Ij|Ab> (Ib,jA)");
230
dpd_buf4_init(&G, CC_GAMMA, 0, 24, 27, 24, 27, 0, "GIbjA");
231
two_energy -= dpd_buf4_dot(&G, &DInts);
233
dpd_buf4_close(&DInts);
235
dpd_buf4_init(&DInts, CC_DINTS, 0, 27, 24, 27, 24, 0, "D <iJ|aB> (iB,Ja)");
236
dpd_buf4_init(&G, CC_GAMMA, 0, 27, 24, 27, 24, 0, "GiBJa");
237
two_energy -= dpd_buf4_dot(&G, &DInts);
239
dpd_buf4_close(&DInts);
241
total_two_energy += two_energy;
242
fprintf(outfile, "\tIBJA energy = %20.15f\n", two_energy);
248
dpd_buf4_init(&FInts, CC_FINTS, 0, 21, 7, 21, 5, 1, "F <AI|BC>");
249
dpd_buf4_init(&G, CC_GAMMA, 0, 21, 7, 21, 7, 0, "GCIAB");
250
two_energy += dpd_buf4_dot(&G, &FInts);
252
dpd_buf4_close(&FInts);
254
dpd_buf4_init(&FInts, CC_FINTS, 0, 31, 17, 31, 15, 1, "F <ai|bc>");
255
dpd_buf4_init(&G, CC_GAMMA, 0, 31, 17, 31, 17, 0, "Gciab");
256
two_energy += dpd_buf4_dot(&G, &FInts);
258
dpd_buf4_close(&FInts);
260
dpd_buf4_init(&FInts, CC_FINTS, 0, 25, 29, 25, 29, 0, "F <aI|bC>");
261
dpd_buf4_init(&G, CC_GAMMA, 0, 25, 29, 25, 29, 0, "GcIaB");
262
two_energy += dpd_buf4_dot(&G, &FInts);
264
dpd_buf4_close(&FInts);
266
dpd_buf4_init(&FInts, CC_FINTS, 0, 26, 28, 26, 28, 0, "F <Ai|Bc>");
267
dpd_buf4_init(&G, CC_GAMMA, 0, 26, 28, 26, 28, 0, "GCiAb");
268
two_energy += dpd_buf4_dot(&G, &FInts);
270
dpd_buf4_close(&FInts);
273
total_two_energy += two_energy;
274
fprintf(outfile, "\tCIAB energy = %20.15f\n", two_energy);
279
dpd_buf4_init(&B, CC_BINTS, 0, 7, 7, 5, 5, 1, "B <AB|CD>");
280
dpd_buf4_init(&G, CC_GAMMA, 0, 7, 7, 7, 7, 0, "GABCD");
281
two_energy += dpd_buf4_dot(&G, &B);
285
dpd_buf4_init(&B, CC_BINTS, 0, 17, 17, 15, 15, 1, "B <ab|cd>");
286
dpd_buf4_init(&G, CC_GAMMA, 0, 17, 17, 17, 17, 0, "Gabcd");
287
two_energy += dpd_buf4_dot(&G, &B);
291
dpd_buf4_init(&B, CC_BINTS, 0, 28, 28, 28, 28, 0, "B <Ab|Cd>");
292
dpd_buf4_init(&G, CC_GAMMA, 0, 28, 28, 28, 28, 0, "GAbCd");
293
two_energy += dpd_buf4_dot(&G, &B);
297
total_two_energy += two_energy;
298
fprintf(outfile, "\tABCD energy = %20.15f\n", two_energy);
300
fprintf(outfile, "\tTotal two-electron energy = %20.15f\n", total_two_energy);
302
fprintf(outfile, "\t%-7s correlation energy = %20.15f\n", !strcmp(params.wfn,"CCSD_T") ? "CCSD(T)" : params.wfn,
303
one_energy + total_two_energy);
304
fprintf(outfile, "\tTotal %-7s energy = %20.15f\n", !strcmp(params.wfn,"CCSD_T") ? "CCSD(T)" : params.wfn,
305
one_energy + total_two_energy + moinfo.eref);
308
fprintf(outfile, "\tTotal EOM CCSD correlation energy = %20.15f\n",
309
one_energy + total_two_energy);
310
fprintf(outfile, "\tCCSD correlation + EOM excitation energy = %20.15f\n",
311
moinfo.ecc + params.cceom_energy);
312
fprintf(outfile, "\tTotal EOM CCSD energy = %20.15f\n",
313
one_energy + total_two_energy + moinfo.eref);
317
}} // namespace psi::ccdensity