3
#include <libdpd/dpd.h>
7
/* projections() computes the projection of the EOM CCSD wavefunction onto the
8
reference, singles and doubles spaces, respectively. These values may be
9
compared to those output by ACES2. Also, an approximate excitation level (AEL)
10
may be defined as <Psi|S><S|Psi> + 2<Psi|D><D|Psi>. For symmetric excitations,
11
this AEL theoretically might have a value slightly less than 1. The sum of
12
these projections must equal 1 if R and L are normalized on this space.
14
<Psi|0><0|Psi> = <0|Le^(-T)|0><0|Re^T|0> =
15
R0 * (-dot_L1T1 - dot_L2T2 + 0.5*dot_L2T1T1);
16
<Psi|S><S|Psi> = <0|Le^(-T)|S><S|Re^T|S> =
17
R0 * (+dot_L1T1 - dot_L2T1T1) + dot_L1R1 - dot_L2T1R1;
18
<Psi|D><D|Psi> = <0|Le^(-T)|D><D|Re^T|D> =
19
R0 * (+dot_L2T2 + 0.5*dot_L2T1T1) + dot_L2T1R1 + dot_L2R2;
21
where dot_L1T1 = Lme Tme dot_L2T2 = Lmnef Tmnef
22
dot_L2T1T1 = Lmnef Tme Tnf dot_L2T1R1 = Lmnef Tme Rnf
23
dot_L1R1 = Lme Rme dot_L2R2 = Lmnef Rmnef
26
void projections(struct L_Params *pL_params) {
29
double R0, projection_0, projection_S, projection_D, projection_tot, ael;
30
double dot_L1T1=0, dot_L2T2=0, dot_L2T1T1=0, dot_L1R1=0, dot_L2T1R1=0;
32
char R1A_lbl[32], R1B_lbl[32], R2AA_lbl[32], R2BB_lbl[32], R2AB_lbl[32];
33
char L1A_lbl[32], L1B_lbl[32], L2AA_lbl[32], L2BB_lbl[32], L2AB_lbl[32], L2AB_lbl2[32];
34
dpdfile2 L1A, L1B, T1A, T1B, I1, R1A, R1B;
36
/* assumes that the excited-Rs are available */
38
if (params.ref == 0) {
39
dpd_file2_init(&T1A, CC_OEI, 0, 0, 1, "tIA");
41
else if (params.ref == 1) {
42
dpd_file2_init(&T1A, CC_OEI, 0, 0, 1, "tIA");
43
dpd_file2_init(&T1B, CC_OEI, 0, 0, 1, "tia");
45
else if (params.ref == 2) {
46
dpd_file2_init(&T1A, CC_OEI, 0, 0, 1, "tIA");
47
dpd_file2_init(&T1B, CC_OEI, 0, 2, 3, "tia");
50
for (i=1; i<params.nstates;++i) {
51
IRR = pL_params[i].irrep;
53
root = pL_params[i].root;
54
sprintf(R1A_lbl, "RIA %d %d", IRR, root);
55
sprintf(R1B_lbl, "Ria %d %d", IRR, root);
56
sprintf(R2AA_lbl, "RIJAB %d %d", IRR, root);
57
sprintf(R2BB_lbl, "Rijab %d %d", IRR, root);
58
sprintf(R2AB_lbl, "RIjAb %d %d", IRR, root);
59
sprintf(L1A_lbl, "LIA %d %d", IRR, root);
60
sprintf(L1B_lbl, "Lia %d %d", IRR, root);
61
sprintf(L2AA_lbl, "LIJAB %d %d", IRR, root);
62
sprintf(L2BB_lbl, "Lijab %d %d", IRR, root);
63
sprintf(L2AB_lbl, "LIjAb %d %d", IRR, root);
64
sprintf(L2AB_lbl2, "2LIjAb - LIjbA %d %d", IRR, root);
66
if (params.ref == 0) {
67
dpd_file2_init(&L1A, CC_LAMPS, IRR, 0, 1, L1A_lbl);
69
else if (params.ref == 1) {
70
dpd_file2_init(&L1A, CC_LAMPS, IRR, 0, 1, L1A_lbl);
71
dpd_file2_init(&L1B, CC_LAMPS, IRR, 0, 1, L1B_lbl);
73
else if (params.ref == 2) {
74
dpd_file2_init(&L1A, CC_LAMPS, IRR, 0, 1, L1A_lbl);
75
dpd_file2_init(&L1B, CC_LAMPS, IRR, 2, 3, L1B_lbl);
79
/* dot_L1T1 = <0|Lme Tme|0>, assuming L0=0 (excited state) */
80
if (params.ref == 0) {
81
dot_L1T1 = 2.0 * dpd_file2_dot(&L1A, &T1A);
83
else if (params.ref >= 1) {
84
dot_L1T1 = dpd_file2_dot(&L1A, &T1A);
85
dot_L1T1 += dpd_file2_dot(&L1B, &T1B);
88
/* dot_L2T2 = <0|Lmnef Tmnef|0> */
89
if (params.ref == 0) {
90
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl);
91
dpd_buf4_init(&T2, CC_TAMPS, 0, 0, 5, 0, 5, 0, "2 tIjAb - tIjBa");
92
dot_L2T2 = dpd_buf4_dot(&L2, &T2);
96
else if (params.ref == 1) {
97
dpd_buf4_init(&L2, CC_LAMPS, IRR, 2, 7, 2, 7, 0, L2AA_lbl);
98
dpd_buf4_init(&T2, CC_TAMPS, 0, 2, 7, 2, 7, 0, "tIJAB");
99
dot_L2T2 = dpd_buf4_dot(&L2, &T2);
102
dpd_buf4_init(&L2, CC_LAMPS, IRR, 2, 7, 2, 7, 0, L2BB_lbl);
103
dpd_buf4_init(&T2, CC_TAMPS, 0, 2, 7, 2, 7, 0, "tijab");
104
dot_L2T2 += dpd_buf4_dot(&L2, &T2);
107
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl);
108
dpd_buf4_init(&T2, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb");
109
dot_L2T2 += dpd_buf4_dot(&L2, &T2);
113
else if (params.ref == 2) {
114
dpd_buf4_init(&L2, CC_LAMPS, IRR, 2, 7, 2, 7, 0, L2AA_lbl);
115
dpd_buf4_init(&T2, CC_TAMPS, 0, 2, 7, 2, 7, 0, "tIJAB");
116
dot_L2T2 = dpd_buf4_dot(&L2, &T2);
119
dpd_buf4_init(&L2, CC_LAMPS, IRR, 12, 17, 12, 17, 0, L2BB_lbl);
120
dpd_buf4_init(&T2, CC_TAMPS, 0, 12, 17, 12, 17, 0, "tijab");
121
dot_L2T2 += dpd_buf4_dot(&L2, &T2);
124
dpd_buf4_init(&L2, CC_LAMPS, IRR, 22, 28, 22, 28, 0, L2AB_lbl);
125
dpd_buf4_init(&T2, CC_TAMPS, 0, 22, 28, 22, 28, 0, "tIjAb");
126
dot_L2T2 += dpd_buf4_dot(&L2, &T2);
130
/* dot_L2T1T1 = TNF (TME LMNEF) + Tnf (Tme Lmnef) + 2*Tnf(TME LMnEf) */
131
if (params.ref == 0) {
132
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X(N,F)");
133
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl2);
134
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
136
dot_L2T1T1 = 2.0 * dpd_file2_dot(&T1A, &I1);
137
dpd_file2_close(&I1);
139
else if (params.ref == 1) {
140
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X(N,F)");
141
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 2, 7, 0, L2AA_lbl);
142
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
144
dot_L2T1T1 = dpd_file2_dot(&T1A, &I1);
145
dpd_file2_close(&I1);
146
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X(n,f)");
147
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 2, 7, 0, L2BB_lbl);
148
dpd_dot13(&T1B, &L2, &I1, 0, 0, 1.0, 0.0);
150
dot_L2T1T1 += dpd_file2_dot(&T1B, &I1);
151
dpd_file2_close(&I1);
152
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X(n,f)");
153
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl);
154
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
156
dot_L2T1T1 += 2.0 * dpd_file2_dot(&T1B, &I1);
157
dpd_file2_close(&I1);
159
else if (params.ref == 2) {
160
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X(N,F)");
161
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 2, 7, 0, L2AA_lbl);
162
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
164
dot_L2T1T1 = dpd_file2_dot(&T1A, &I1);
165
dpd_file2_close(&I1);
166
dpd_file2_init(&I1, CC_TMP, IRR, 2, 3, "X(n,f)");
167
dpd_buf4_init(&L2, CC_LAMPS, IRR, 10, 15, 12, 17, 0, L2BB_lbl);
168
dpd_dot13(&T1B, &L2, &I1, 0, 0, 1.0, 0.0);
170
dot_L2T1T1 += dpd_file2_dot(&T1B, &I1);
171
dpd_file2_close(&I1);
172
dpd_file2_init(&I1, CC_TMP, IRR, 2, 3, "X(n,f)");
173
dpd_buf4_init(&L2, CC_LAMPS, IRR, 22, 28, 22, 28, 0, L2AB_lbl);
174
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
176
dot_L2T1T1 += 2.0 * dpd_file2_dot(&T1B, &I1);
177
dpd_file2_close(&I1);
182
if (params.ref == 0) {
183
dpd_file2_init(&R1A, CC_RAMPS, IRR, 0, 1, R1A_lbl);
185
else if (params.ref == 1) {
186
dpd_file2_init(&R1A, CC_RAMPS, IRR, 0, 1, R1A_lbl);
187
dpd_file2_init(&R1B, CC_RAMPS, IRR, 0, 1, R1B_lbl);
189
else if (params.ref == 2) {
190
dpd_file2_init(&R1A, CC_RAMPS, IRR, 0, 1, R1A_lbl);
191
dpd_file2_init(&R1B, CC_RAMPS, IRR, 2, 3, R1B_lbl);
194
/* dot_L1R1 = Lme Rme */
195
if (params.ref == 0) {
196
dot_L1R1 = 2.0 * dpd_file2_dot(&L1A,&R1A);
198
else if (params.ref >= 1) {
199
dot_L1R1 = dpd_file2_dot(&L1A,&R1A);
200
dot_L1R1 += dpd_file2_dot(&L1B,&R1B);
203
/* dot_L2R2 = <0|Lmnef Rmnef|0> */
204
if (params.ref == 0) {
205
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl2);
206
dpd_buf4_init(&R2, CC_RAMPS, IRR, 0, 5, 0, 5, 0, R2AB_lbl);
207
dot_L2R2 = dpd_buf4_dot(&L2, &R2);
211
else if (params.ref == 1) {
212
dpd_buf4_init(&L2, CC_LAMPS, IRR, 2, 7, 2, 7, 0, L2AA_lbl);
213
dpd_buf4_init(&R2, CC_RAMPS, IRR, 2, 7, 2, 7, 0, R2AA_lbl);
214
dot_L2R2 = dpd_buf4_dot(&L2, &R2);
217
dpd_buf4_init(&L2, CC_LAMPS, IRR, 2, 7, 2, 7, 0, L2BB_lbl);
218
dpd_buf4_init(&R2, CC_RAMPS, IRR, 2, 7, 2, 7, 0, R2BB_lbl);
219
dot_L2R2 += dpd_buf4_dot(&L2, &R2);
222
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl);
223
dpd_buf4_init(&R2, CC_RAMPS, IRR, 0, 5, 0, 5, 0, R2AB_lbl);
224
dot_L2R2 += dpd_buf4_dot(&L2, &R2);
228
else if (params.ref == 2) {
229
dpd_buf4_init(&L2, CC_LAMPS, IRR, 2, 7, 2, 7, 0, L2AA_lbl);
230
dpd_buf4_init(&R2, CC_RAMPS, IRR, 2, 7, 2, 7, 0, R2AA_lbl);
231
dot_L2R2 = dpd_buf4_dot(&L2, &R2);
234
dpd_buf4_init(&L2, CC_LAMPS, IRR, 12, 17, 12, 17, 0, L2BB_lbl);
235
dpd_buf4_init(&R2, CC_RAMPS, IRR, 12, 17, 12, 17, 0, R2BB_lbl);
236
dot_L2R2 += dpd_buf4_dot(&L2, &R2);
239
dpd_buf4_init(&L2, CC_LAMPS, IRR, 22, 28, 22, 28, 0, L2AB_lbl);
240
dpd_buf4_init(&R2, CC_RAMPS, IRR, 22, 28, 22, 28, 0, R2AB_lbl);
241
dot_L2R2 += dpd_buf4_dot(&L2, &R2);
246
/* dot_L2T1R1 = RNF (TME LMNEF) + Rnf (Tme Lmnef) */
247
/* + RNF (Tme LNmFe) + Rnf (TME LMnEf) */
248
if (params.ref == 0) {
249
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl2);
250
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(N,F)");
251
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
253
dot_L2T1R1 = 2.0 * dpd_file2_dot(&R1A, &I1);
254
dpd_file2_close(&I1);
256
else if (params.ref == 1) {
257
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(N,F)");
258
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 2, 7, 0, L2AA_lbl);
259
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
261
dot_L2T1R1 = dpd_file2_dot(&R1A, &I1);
262
dpd_file2_close(&I1);
263
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(n,f)");
264
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 2, 7, 0, L2BB_lbl);
265
dpd_dot13(&T1B, &L2, &I1, 0, 0, 1.0, 0.0);
267
dot_L2T1R1 += dpd_file2_dot(&R1B, &I1);
268
dpd_file2_close(&I1);
269
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl);
270
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(N,F)");
271
dpd_dot24(&T1B, &L2, &I1, 0, 0, 1.0, 0.0);
273
dot_L2T1R1 += dpd_file2_dot(&R1A, &I1);
274
dpd_file2_close(&I1);
275
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(n,f)");
276
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 0, 5, 0, L2AB_lbl);
277
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
279
dot_L2T1R1 += dpd_file2_dot(&R1B, &I1);
280
dpd_file2_close(&I1);
282
else if (params.ref == 2) {
283
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(N,F)");
284
dpd_buf4_init(&L2, CC_LAMPS, IRR, 0, 5, 2, 7, 0, L2AA_lbl);
285
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
287
dot_L2T1R1 = dpd_file2_dot(&R1A, &I1);
288
dpd_file2_close(&I1);
289
dpd_file2_init(&I1, CC_TMP, IRR, 2, 3, "X2(n,f)");
290
dpd_buf4_init(&L2, CC_LAMPS, IRR, 10, 15, 12, 17, 0, L2BB_lbl);
291
dpd_dot13(&T1B, &L2, &I1, 0, 0, 1.0, 0.0);
293
dot_L2T1R1 += dpd_file2_dot(&R1B, &I1);
294
dpd_file2_close(&I1);
295
dpd_buf4_init(&L2, CC_LAMPS, IRR, 22, 28, 22, 28, 0, L2AB_lbl);
296
dpd_file2_init(&I1, CC_TMP, IRR, 0, 1, "X2(N,F)");
297
dpd_dot24(&T1B, &L2, &I1, 0, 0, 1.0, 0.0);
299
dot_L2T1R1 += dpd_file2_dot(&R1A, &I1);
300
dpd_file2_close(&I1);
301
dpd_file2_init(&I1, CC_TMP, IRR, 2, 3, "X2(n,f)");
302
dpd_buf4_init(&L2, CC_LAMPS, IRR, 22, 28, 22, 28, 0, L2AB_lbl);
303
dpd_dot13(&T1A, &L2, &I1, 0, 0, 1.0, 0.0);
305
dot_L2T1R1 += dpd_file2_dot(&R1B, &I1);
306
dpd_file2_close(&I1);
310
if (params.ref == 0) {
311
dpd_file2_close(&R1A); dpd_file2_close(&L1A);
313
else if (params.ref >= 1) {
314
dpd_file2_close(&R1A); dpd_file2_close(&R1B);
315
dpd_file2_close(&L1A); dpd_file2_close(&L1B);
318
projection_0 = R0 * (-dot_L1T1 - dot_L2T2 + 0.5*dot_L2T1T1);
319
projection_S = R0 * (+dot_L1T1 - dot_L2T1T1) + dot_L1R1 - dot_L2T1R1;
320
projection_D = R0 * (+dot_L2T2 + 0.5*dot_L2T1T1) + dot_L2T1R1 + dot_L2R2;
321
projection_tot = projection_0 + projection_S + projection_D;
322
ael = projection_S + 2.0 * projection_D;
324
fprintf(outfile,"\n\tProjections for excited state, irrep %s, root %d:\n", moinfo.labels[0], root);
325
fprintf(outfile,"\t<0|Le^(-T)|0><0|Re^T|0> = %15.10lf\n", projection_0);
326
fprintf(outfile,"\t<0|Le^(-T)|S><S|Re^T|0> = %15.10lf\n", projection_S);
327
fprintf(outfile,"\t<0|Le^(-T)|D><D|Re^T|0> = %15.10lf\n", projection_D);
328
fprintf(outfile,"\tSum of above = %15.10lf\n", projection_tot);
329
fprintf(outfile,"\tApprox. excitation level = %15.10lf\n", ael);
330
} /* sum over states */
333
dpd_file2_close(&T1A);
335
dpd_file2_close(&T1B);