3
\brief Enter brief description of file here
6
* write_Rs writes out all of the converged R's to RAMPS for the current irrep
12
#include <libchkpt/chkpt.h>
19
namespace psi { namespace cceom {
21
void write_Rs(int C_irr, double *evals, int *converged) {
24
dpdbuf4 CMNEF, Cmnef, CMnEf;
26
char C_lbl[32], R_lbl[32], E_lbl[32];
27
double etot, expectation_val, C0;
29
for (i=0; i<eom_params.cs_per_irrep[C_irr]; ++i) {
30
if (!converged[i]) continue; /* this root did not converge */
33
if (C_irr == eom_params.prop_sym) {
34
if (i == eom_params.prop_root) {
35
chkpt_init(PSIO_OPEN_OLD);
36
if (!params.full_matrix) {
37
etot = evals[eom_params.prop_root]+moinfo.ecc+moinfo.eref;
39
etot = evals[eom_params.prop_root]+moinfo.eref;
42
fprintf(outfile,"Energy written to chkpt:Etot %15.10lf\n", etot);
46
/* cclambda expects excitation energies */
47
if (!params.full_matrix) {
51
psio_read_entry(CC_HBAR, "Reference expectation value",
52
(char *) &(expectation_val), sizeof(double));
53
etot = evals[i] - expectation_val;
56
if(!strcmp(params.wfn,"EOM_CC2")) {
57
sprintf(E_lbl, "EOM CC2 Energy for root %d %d", C_irr, R_index);
58
psio_write_entry(CC_INFO, E_lbl, (char *) &etot, sizeof(double));
60
else if(!strcmp(params.wfn,"EOM_CCSD")) {
61
sprintf(E_lbl, "EOM CCSD Energy for root %d %d", C_irr, R_index);
62
psio_write_entry(CC_INFO, E_lbl, (char *) &etot, sizeof(double));
64
else if(!strcmp(params.wfn,"EOM_CC3")) {
65
sprintf(E_lbl, "EOM CC3 Energy for root %d %d", C_irr, R_index);
66
psio_write_entry(CC_INFO, E_lbl, (char *) &etot, sizeof(double));
69
sprintf(C_lbl, "CME %d", i);
70
sprintf(R_lbl, "RIA %d %d", C_irr, R_index);
72
dpd_file2_init(&CME, EOM_CME, C_irr, 0, 1, C_lbl);
73
dpd_file2_copy(&CME, CC_RAMPS, R_lbl);
74
dpd_file2_close(&CME);
76
if (params.full_matrix) {
77
sprintf(C_lbl, "C0 %d", i);
78
psio_read_entry(EOM_CME, C_lbl, (char *) &C0, sizeof(double));
79
sprintf(R_lbl, "R0 %d %d", C_irr, R_index);
80
psio_write_entry(CC_RAMPS, R_lbl, (char *) &C0, sizeof(double));
83
sprintf(C_lbl, "CMnEf %d", i);
84
sprintf(R_lbl, "RIjAb %d %d", C_irr, R_index);
85
if (params.eom_ref <= 1)
86
dpd_buf4_init(&CMnEf, EOM_CMnEf, C_irr, 0, 5, 0, 5, 0, C_lbl);
87
else if (params.eom_ref == 2)
88
dpd_buf4_init(&CMnEf, EOM_CMnEf, C_irr, 22, 28, 22, 28, 0, C_lbl);
89
dpd_buf4_copy(&CMnEf, CC_RAMPS, R_lbl);
90
dpd_buf4_close(&CMnEf);
92
if(params.eom_ref > 0) {
93
sprintf(C_lbl, "Cme %d", i);
94
sprintf(R_lbl, "Ria %d %d", C_irr, R_index);
95
if (params.eom_ref == 1)
96
dpd_file2_init(&Cme, EOM_Cme, C_irr, 0, 1, C_lbl);
97
else if (params.eom_ref == 2)
98
dpd_file2_init(&Cme, EOM_Cme, C_irr, 2, 3, C_lbl);
99
dpd_file2_copy(&Cme, CC_RAMPS, R_lbl);
100
dpd_file2_close(&Cme);
102
sprintf(C_lbl, "CMNEF %d", i);
103
sprintf(R_lbl, "RIJAB %d %d", C_irr, R_index);
105
dpd_buf4_init(&CMNEF, EOM_CMNEF, C_irr, 2, 7, 2, 7, 0, C_lbl);
106
dpd_buf4_copy(&CMNEF, CC_RAMPS, R_lbl);
107
dpd_buf4_close(&CMNEF);
109
sprintf(C_lbl, "Cmnef %d", i);
110
sprintf(R_lbl, "Rijab %d %d", C_irr, R_index);
112
if (params.eom_ref == 1)
113
dpd_buf4_init(&Cmnef, EOM_Cmnef, C_irr, 2, 7, 2, 7, 0, C_lbl);
114
else if (params.eom_ref ==2)
115
dpd_buf4_init(&Cmnef, EOM_Cmnef, C_irr, 12, 17, 12, 17, 0, C_lbl);
116
dpd_buf4_copy(&Cmnef, CC_RAMPS, R_lbl);
117
dpd_buf4_close(&Cmnef);
122
}} // namespace psi::cceom