3
\brief Enter brief description of file here
7
#include <libdpd/dpd.h>
13
namespace psi { namespace cclambda {
15
/* projections() computes the projection of the EOM CCSD wavefunction onto the
16
reference, singles and doubles spaces, respectively. These values may be
17
compared to those output by ACES2. Also, an approximate excitation level (AEL)
18
may be defined as <Psi|S><S|Psi> + 2<Psi|D><D|Psi>. For symmetric excitations,
19
this AEL theoretically might have a value slightly less than 1. The sum of
20
these projections must equal 1 if R and L are normalized on this space.
22
<Psi|0><0|Psi> = <0|Le^(-T)|0><0|Re^T|0> =
23
R0 * (-dot_L1T1 - dot_L2T2 + 0.5*dot_L2T1T1);
24
<Psi|S><S|Psi> = <0|Le^(-T)|S><S|Re^T|S> =
25
R0 * (+dot_L1T1 - dot_L2T1T1) + dot_L1R1 - dot_L2T1R1;
26
<Psi|D><D|Psi> = <0|Le^(-T)|D><D|Re^T|D> =
27
R0 * (+dot_L2T2 + 0.5*dot_L2T1T1) + dot_L2T1R1 + dot_L2R2;
29
where dot_L1T1 = Lme Tme dot_L2T2 = Lmnef Tmnef
30
dot_L2T1T1 = Lmnef Tme Tnf dot_L2T1R1 = Lmnef Tme Rnf
31
dot_L1R1 = Lme Rme dot_L2R2 = Lmnef Rmnef
34
void projections(struct L_Params *pL_params) {
37
double R0, projection_0, projection_S, projection_D, projection_tot, ael;
38
double dot_L1T1=0, dot_L2T2=0, dot_L2T1T1=0, dot_L1R1=0, dot_L2T1R1=0;
40
char R1A_lbl[32], R1B_lbl[32], R2AA_lbl[32], R2BB_lbl[32], R2AB_lbl[32];
41
char L1A_lbl[32], L1B_lbl[32], L2AA_lbl[32], L2BB_lbl[32], L2AB_lbl[32], L2AB_lbl2[32];
42
dpdfile2 L1A, L1B, T1A, T1B, I1, R1A, R1B;
44
/* assumes that the excited-Rs are available */
46
if (params.ref == 0) {
47
dpd_file2_init(&T1A, CC_OEI, 0, 0, 1, "tIA");
49
else if (params.ref == 1) {
50
dpd_file2_init(&T1A, CC_OEI, 0, 0, 1, "tIA");
51
dpd_file2_init(&T1B, CC_OEI, 0, 0, 1, "tia");
53
else if (params.ref == 2) {
54
dpd_file2_init(&T1A, CC_OEI, 0, 0, 1, "tIA");
55
dpd_file2_init(&T1B, CC_OEI, 0, 2, 3, "tia");
58
for (i=1; i<params.nstates;++i) {
59
IRR = pL_params[i].irrep;
61
root = pL_params[i].root;
62
sprintf(R1A_lbl, "RIA %d %d", IRR, root);
63
sprintf(R1B_lbl, "Ria %d %d", IRR, root);
64
sprintf(R2AA_lbl, "RIJAB %d %d", IRR, root);
65
sprintf(R2BB_lbl, "Rijab %d %d", IRR, root);
66
sprintf(R2AB_lbl, "RIjAb %d %d", IRR, root);
67
sprintf(L1A_lbl, "LIA %d %d", IRR, root);
68
sprintf(L1B_lbl, "Lia %d %d", IRR, root);
69
sprintf(L2AA_lbl, "LIJAB %d %d", IRR, root);
70
sprintf(L2BB_lbl, "Lijab %d %d", IRR, root);
71
sprintf(L2AB_lbl, "LIjAb %d %d", IRR, root);
72
sprintf(L2AB_lbl2, "2LIjAb - LIjbA %d %d", IRR, root);
74
if (params.ref == 0) {
75
dpd_file2_init(&L1A, CC_LAMPS, IRR, 0, 1, L1A_lbl);
77
else if (params.ref == 1) {
78
dpd_file2_init(&L1A, CC_LAMPS, IRR, 0, 1, L1A_lbl);
79
dpd_file2_init(&L1B, CC_LAMPS, IRR, 0, 1, L1B_lbl);
81
else if (params.ref == 2) {
82
dpd_file2_init(&L1A, CC_LAMPS, IRR, 0, 1, L1A_lbl);
83
dpd_file2_init(&L1B, CC_LAMPS, IRR, 2, 3, L1B_lbl);
87
/* dot_L1T1 = <0|Lme Tme|0>, assuming L0=0 (excited state) */
88
if (params.ref == 0) {
89
dot_L1T1 = 2.0 * dpd_file2_dot(&L1A, &T1A);
91
else if (params.ref >= 1) {
92
dot_L1T1 = dpd_file2_dot(&L1A, &T1A);
93
dot_L1T1 += dpd_file2_dot(&L1B, &T1B);
96
/* dot_L2T2 = <0|Lmnef Tmnef|0> */
97
if (params.ref == 0) {
98
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl);
99
dpd_buf4_init(&T2, CC_TAMPS, 0, 0, 5, 0, 5, 0, "2 tIjAb - tIjBa");
100
dot_L2T2 = dpd_buf4_dot(&L2, &T2);
104
else if (params.ref == 1) {
105
dpd_buf4_init(&L2, CC_LAMPS, IRR, 2, 7, 2, 7, 0, L2AA_lbl);
106
dpd_buf4_init(&T2, CC_TAMPS, 0, 2, 7, 2, 7, 0, "tIJAB");
107
dot_L2T2 = dpd_buf4_dot(&L2, &T2);
110
dpd_buf4_init(&L2, CC_LAMPS, IRR, 2, 7, 2, 7, 0, L2BB_lbl);
111
dpd_buf4_init(&T2, CC_TAMPS, 0, 2, 7, 2, 7, 0, "tijab");
112
dot_L2T2 += dpd_buf4_dot(&L2, &T2);
115
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl);
116
dpd_buf4_init(&T2, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb");
117
dot_L2T2 += dpd_buf4_dot(&L2, &T2);
121
else if (params.ref == 2) {
122
dpd_buf4_init(&L2, CC_LAMPS, IRR, 2, 7, 2, 7, 0, L2AA_lbl);
123
dpd_buf4_init(&T2, CC_TAMPS, 0, 2, 7, 2, 7, 0, "tIJAB");
124
dot_L2T2 = dpd_buf4_dot(&L2, &T2);
127
dpd_buf4_init(&L2, CC_LAMPS, IRR, 12, 17, 12, 17, 0, L2BB_lbl);
128
dpd_buf4_init(&T2, CC_TAMPS, 0, 12, 17, 12, 17, 0, "tijab");
129
dot_L2T2 += dpd_buf4_dot(&L2, &T2);
132
dpd_buf4_init(&L2, CC_LAMPS, IRR, 22, 28, 22, 28, 0, L2AB_lbl);
133
dpd_buf4_init(&T2, CC_TAMPS, 0, 22, 28, 22, 28, 0, "tIjAb");
134
dot_L2T2 += dpd_buf4_dot(&L2, &T2);
138
/* dot_L2T1T1 = TNF (TME LMNEF) + Tnf (Tme Lmnef) + 2*Tnf(TME LMnEf) */
139
if (params.ref == 0) {
140
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X(N,F)");
141
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl2);
142
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
144
dot_L2T1T1 = 2.0 * dpd_file2_dot(&T1A, &I1);
145
dpd_file2_close(&I1);
147
else if (params.ref == 1) {
148
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X(N,F)");
149
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 2, 7, 0, L2AA_lbl);
150
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
152
dot_L2T1T1 = dpd_file2_dot(&T1A, &I1);
153
dpd_file2_close(&I1);
154
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X(n,f)");
155
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 2, 7, 0, L2BB_lbl);
156
dpd_dot13(&T1B, &L2, &I1, 0, 0, 1.0, 0.0);
158
dot_L2T1T1 += dpd_file2_dot(&T1B, &I1);
159
dpd_file2_close(&I1);
160
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X(n,f)");
161
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl);
162
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
164
dot_L2T1T1 += 2.0 * dpd_file2_dot(&T1B, &I1);
165
dpd_file2_close(&I1);
167
else if (params.ref == 2) {
168
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X(N,F)");
169
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 2, 7, 0, L2AA_lbl);
170
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
172
dot_L2T1T1 = dpd_file2_dot(&T1A, &I1);
173
dpd_file2_close(&I1);
174
dpd_file2_init(&I1, CC_TMP, IRR, 2, 3, "X(n,f)");
175
dpd_buf4_init(&L2, CC_LAMPS, IRR, 10, 15, 12, 17, 0, L2BB_lbl);
176
dpd_dot13(&T1B, &L2, &I1, 0, 0, 1.0, 0.0);
178
dot_L2T1T1 += dpd_file2_dot(&T1B, &I1);
179
dpd_file2_close(&I1);
180
dpd_file2_init(&I1, CC_TMP, IRR, 2, 3, "X(n,f)");
181
dpd_buf4_init(&L2, CC_LAMPS, IRR, 22, 28, 22, 28, 0, L2AB_lbl);
182
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
184
dot_L2T1T1 += 2.0 * dpd_file2_dot(&T1B, &I1);
185
dpd_file2_close(&I1);
190
if (params.ref == 0) {
191
dpd_file2_init(&R1A, CC_RAMPS, IRR, 0, 1, R1A_lbl);
193
else if (params.ref == 1) {
194
dpd_file2_init(&R1A, CC_RAMPS, IRR, 0, 1, R1A_lbl);
195
dpd_file2_init(&R1B, CC_RAMPS, IRR, 0, 1, R1B_lbl);
197
else if (params.ref == 2) {
198
dpd_file2_init(&R1A, CC_RAMPS, IRR, 0, 1, R1A_lbl);
199
dpd_file2_init(&R1B, CC_RAMPS, IRR, 2, 3, R1B_lbl);
202
/* dot_L1R1 = Lme Rme */
203
if (params.ref == 0) {
204
dot_L1R1 = 2.0 * dpd_file2_dot(&L1A,&R1A);
206
else if (params.ref >= 1) {
207
dot_L1R1 = dpd_file2_dot(&L1A,&R1A);
208
dot_L1R1 += dpd_file2_dot(&L1B,&R1B);
211
/* dot_L2R2 = <0|Lmnef Rmnef|0> */
212
if (params.ref == 0) {
213
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl2);
214
dpd_buf4_init(&R2, CC_RAMPS, IRR, 0, 5, 0, 5, 0, R2AB_lbl);
215
dot_L2R2 = dpd_buf4_dot(&L2, &R2);
219
else if (params.ref == 1) {
220
dpd_buf4_init(&L2, CC_LAMPS, IRR, 2, 7, 2, 7, 0, L2AA_lbl);
221
dpd_buf4_init(&R2, CC_RAMPS, IRR, 2, 7, 2, 7, 0, R2AA_lbl);
222
dot_L2R2 = dpd_buf4_dot(&L2, &R2);
225
dpd_buf4_init(&L2, CC_LAMPS, IRR, 2, 7, 2, 7, 0, L2BB_lbl);
226
dpd_buf4_init(&R2, CC_RAMPS, IRR, 2, 7, 2, 7, 0, R2BB_lbl);
227
dot_L2R2 += dpd_buf4_dot(&L2, &R2);
230
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl);
231
dpd_buf4_init(&R2, CC_RAMPS, IRR, 0, 5, 0, 5, 0, R2AB_lbl);
232
dot_L2R2 += dpd_buf4_dot(&L2, &R2);
236
else if (params.ref == 2) {
237
dpd_buf4_init(&L2, CC_LAMPS, IRR, 2, 7, 2, 7, 0, L2AA_lbl);
238
dpd_buf4_init(&R2, CC_RAMPS, IRR, 2, 7, 2, 7, 0, R2AA_lbl);
239
dot_L2R2 = dpd_buf4_dot(&L2, &R2);
242
dpd_buf4_init(&L2, CC_LAMPS, IRR, 12, 17, 12, 17, 0, L2BB_lbl);
243
dpd_buf4_init(&R2, CC_RAMPS, IRR, 12, 17, 12, 17, 0, R2BB_lbl);
244
dot_L2R2 += dpd_buf4_dot(&L2, &R2);
247
dpd_buf4_init(&L2, CC_LAMPS, IRR, 22, 28, 22, 28, 0, L2AB_lbl);
248
dpd_buf4_init(&R2, CC_RAMPS, IRR, 22, 28, 22, 28, 0, R2AB_lbl);
249
dot_L2R2 += dpd_buf4_dot(&L2, &R2);
254
/* dot_L2T1R1 = RNF (TME LMNEF) + Rnf (Tme Lmnef) */
255
/* + RNF (Tme LNmFe) + Rnf (TME LMnEf) */
256
if (params.ref == 0) {
257
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl2);
258
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(N,F)");
259
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
261
dot_L2T1R1 = 2.0 * dpd_file2_dot(&R1A, &I1);
262
dpd_file2_close(&I1);
264
else if (params.ref == 1) {
265
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(N,F)");
266
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 2, 7, 0, L2AA_lbl);
267
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
269
dot_L2T1R1 = dpd_file2_dot(&R1A, &I1);
270
dpd_file2_close(&I1);
271
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(n,f)");
272
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 2, 7, 0, L2BB_lbl);
273
dpd_dot13(&T1B, &L2, &I1, 0, 0, 1.0, 0.0);
275
dot_L2T1R1 += dpd_file2_dot(&R1B, &I1);
276
dpd_file2_close(&I1);
277
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl);
278
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(N,F)");
279
dpd_dot24(&T1B, &L2, &I1, 0, 0, 1.0, 0.0);
281
dot_L2T1R1 += dpd_file2_dot(&R1A, &I1);
282
dpd_file2_close(&I1);
283
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(n,f)");
284
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl);
285
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
287
dot_L2T1R1 += dpd_file2_dot(&R1B, &I1);
288
dpd_file2_close(&I1);
290
else if (params.ref == 2) {
291
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(N,F)");
292
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 2, 7, 0, L2AA_lbl);
293
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
295
dot_L2T1R1 = dpd_file2_dot(&R1A, &I1);
296
dpd_file2_close(&I1);
297
dpd_file2_init(&I1, CC_TMP, IRR, 2, 3, "X2(n,f)");
298
dpd_buf4_init(&L2, CC_LAMPS, IRR, 10, 15, 12, 17, 0, L2BB_lbl);
299
dpd_dot13(&T1B, &L2, &I1, 0, 0, 1.0, 0.0);
301
dot_L2T1R1 += dpd_file2_dot(&R1B, &I1);
302
dpd_file2_close(&I1);
303
dpd_buf4_init(&L2, CC_LAMPS, IRR, 22, 28, 22, 28, 0, L2AB_lbl);
304
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(N,F)");
305
dpd_dot24(&T1B, &L2, &I1, 0, 0, 1.0, 0.0);
307
dot_L2T1R1 += dpd_file2_dot(&R1A, &I1);
308
dpd_file2_close(&I1);
309
dpd_file2_init(&I1, CC_TMP, IRR, 2, 3, "X2(n,f)");
310
dpd_buf4_init(&L2, CC_LAMPS, IRR, 22, 28, 22, 28, 0, L2AB_lbl);
311
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
313
dot_L2T1R1 += dpd_file2_dot(&R1B, &I1);
314
dpd_file2_close(&I1);
318
if (params.ref == 0) {
319
dpd_file2_close(&R1A); dpd_file2_close(&L1A);
321
else if (params.ref >= 1) {
322
dpd_file2_close(&R1A); dpd_file2_close(&R1B);
323
dpd_file2_close(&L1A); dpd_file2_close(&L1B);
326
projection_0 = R0 * (-dot_L1T1 - dot_L2T2 + 0.5*dot_L2T1T1);
327
projection_S = R0 * (+dot_L1T1 - dot_L2T1T1) + dot_L1R1 - dot_L2T1R1;
328
projection_D = R0 * (+dot_L2T2 + 0.5*dot_L2T1T1) + dot_L2T1R1 + dot_L2R2;
329
projection_tot = projection_0 + projection_S + projection_D;
330
ael = projection_S + 2.0 * projection_D;
332
fprintf(outfile,"\n\tProjections for excited state, irrep %s, root %d:\n", moinfo.labels[0], root);
333
fprintf(outfile,"\t<0|Le^(-T)|0><0|Re^T|0> = %15.10lf\n", projection_0);
334
fprintf(outfile,"\t<0|Le^(-T)|S><S|Re^T|0> = %15.10lf\n", projection_S);
335
fprintf(outfile,"\t<0|Le^(-T)|D><D|Re^T|0> = %15.10lf\n", projection_D);
336
fprintf(outfile,"\tSum of above = %15.10lf\n", projection_tot);
337
fprintf(outfile,"\tApprox. excitation level = %15.10lf\n", ael);
338
} /* sum over states */
341
dpd_file2_close(&T1A);
343
dpd_file2_close(&T1B);
346
}} // namespace psi::cclambda