3
\brief Enter brief description of file here
6
#include <libciomr/libciomr.h>
7
#include <libiwl/iwl.h>
8
#include <libdpd/dpd.h>
16
namespace psi { namespace ccdensity {
18
/* DUMP_ROHF(): Mulliken-order the ROHF-CCSD two-electron density and
19
** dump it to a file for subsequent backtransformation. Basically all
20
** we have to do is swap indices two and three, e.g.
22
** G'(pr,qs) = G(pq,rs)
24
** In order for the Mulliken-ordered density to be valid for the
25
** backtransformation algorithm used in TRANSQT, the final density
26
** must have eight-fold permutational symmetry like the original
27
** integrals. Unfortunately, there are a couple of complications
28
** introduced by the redundant storage I use for open-shell orbitals
29
** (useful for spin-restricted references --- see the CCSORT code). In
30
** particular, if the Mulliken-ordered density is not bra-ket
31
** symmetric, specific elements of the final density must be
32
** multiplied by two or they will not appear with the correct
33
** prefactor in the backtransformation. This only affects the IJKA,
34
** IAJB, and ABCI Dirac-ordered densities, since the remaining three
35
** components are bra-ket symmetric in Mulliken order.
37
** I really need to give an example of this problem using specific
38
** elements of GIJKA so that the code below will be clearer.*/
40
void dump_ROHF(struct iwlbuf *OutBuf, struct RHO_Params rho_params)
42
int nirreps, nmo, nfzv;
44
int h, row, col, p, q, r, s;
47
qt_occ = moinfo.qt_occ; qt_vir = moinfo.qt_vir;
48
nirreps = moinfo.nirreps;
52
psio_open(PSIF_MO_OPDM, PSIO_OPEN_OLD);
53
/* psio_write_entry(PSIF_MO_OPDM, "MO-basis OPDM", (char *) moinfo.opdm[0], */
54
psio_write_entry(PSIF_MO_OPDM, rho_params.opdm_lbl, (char *) moinfo.opdm[0],
55
sizeof(double)*(nmo-nfzv)*(nmo-nfzv));
56
psio_close(PSIF_MO_OPDM, 1);
59
psio_open(PSIF_MO_LAG, PSIO_OPEN_OLD);
60
psio_write_entry(PSIF_MO_LAG, "MO-basis Lagrangian", (char *) moinfo.I[0],
61
sizeof(double)*nmo*nmo);
62
psio_close(PSIF_MO_LAG, 1);
64
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 0, 0, 0, 0, "GIjKl");
65
dpd_buf4_sort(&G, CC_TMP0, prqs, 0, 0, "G(IK,JL)");
67
dpd_buf4_init(&G, CC_TMP0, 0, 0, 0, 0, 0, 0, "G(IK,JL)");
68
dpd_buf4_dump(&G, OutBuf, qt_occ, qt_occ, qt_occ, qt_occ, 1, 0);
71
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 10, 0, 10, 0, "GIjKa");
72
dpd_buf4_sort(&G, CC_TMP0, prqs, 0, 10, "G(IK,JA)");
74
dpd_buf4_init(&G, CC_TMP0, 0, 0, 10, 0, 10, 0, "G(IK,JA)");
76
for(h=0; h < nirreps; h++) {
77
dpd_buf4_mat_irrep_init(&G, h);
78
dpd_buf4_mat_irrep_rd(&G, h);
80
for(row=0; row < G.params->rowtot[h]; row++) {
81
p = G.params->roworb[h][row][0];
82
q = G.params->roworb[h][row][1];
83
for(col=0; col < G.params->coltot[h]; col++) {
84
r = G.params->colorb[h][col][0];
85
s = G.params->colorb[h][col][1];
87
if((qt_occ[q] == qt_vir[s]) && (p == r))
88
G.matrix[h][row][col] *= 2;
92
dpd_buf4_mat_irrep_wrt(&G, h);
93
dpd_buf4_mat_irrep_close(&G, h);
96
dpd_buf4_dump(&G, OutBuf, qt_occ, qt_occ, qt_occ, qt_vir, 0, 0);
99
dpd_buf4_init(&G, CC_GAMMA, 0, 0, 5, 0, 5, 0, "GIjAb");
100
dpd_buf4_sort(&G, CC_TMP9, prqs, 10, 10, "G(IA,JB)");
102
dpd_buf4_init(&G, CC_TMP9, 0, 10, 10, 10, 10, 0, "G(IA,JB)");
104
dpd_buf4_dump(&G, OutBuf, qt_occ, qt_vir, qt_occ, qt_vir, 1, 0);
107
dpd_buf4_init(&G, CC_GAMMA, 0, 10, 10, 10, 10, 0, "GIBJA");
108
dpd_buf4_sort(&G, CC_TMP0, prqs, 0, 5, "G(IJ,AB)");
110
dpd_buf4_init(&G, CC_TMP0, 0, 0, 5, 0, 5, 0, "G(IJ,AB)");
111
dpd_buf4_scm(&G, 0.5);
113
for(h=0; h < nirreps; h++) {
114
dpd_buf4_mat_irrep_init(&G, h);
115
dpd_buf4_mat_irrep_rd(&G, h);
117
for(row=0; row < G.params->rowtot[h]; row++) {
118
p = G.params->roworb[h][row][0];
119
q = G.params->roworb[h][row][1];
120
for(col=0; col < G.params->coltot[h]; col++) {
121
r = G.params->colorb[h][col][0];
122
s = G.params->colorb[h][col][1];
124
if((qt_occ[p] == qt_vir[r]) && (qt_occ[q] == qt_vir[s]))
125
G.matrix[h][row][col] *= 2;
129
dpd_buf4_mat_irrep_wrt(&G, h);
130
dpd_buf4_mat_irrep_close(&G, h);
133
dpd_buf4_dump(&G, OutBuf, qt_occ, qt_occ, qt_vir, qt_vir, 0, 0);
136
dpd_buf4_init(&G, CC_GAMMA, 0, 11, 5, 11, 5, 0, "GCiAb");
137
dpd_buf4_sort(&G, CC_TMP0, prqs, 5, 10, "G(ca,IB)");
139
dpd_buf4_init(&G, CC_TMP0, 0, 5, 10, 5, 10, 0, "G(ca,IB)");
141
for(h=0; h < nirreps; h++) {
142
dpd_buf4_mat_irrep_init(&G, h);
143
dpd_buf4_mat_irrep_rd(&G, h);
145
for(row=0; row < G.params->rowtot[h]; row++) {
146
p = G.params->roworb[h][row][0];
147
q = G.params->roworb[h][row][1];
148
for(col=0; col < G.params->coltot[h]; col++) {
149
r = G.params->colorb[h][col][0];
150
s = G.params->colorb[h][col][1];
152
if((qt_vir[p] == qt_occ[r]) && (q == s))
153
G.matrix[h][row][col] *= 2;
157
dpd_buf4_mat_irrep_wrt(&G, h);
158
dpd_buf4_mat_irrep_close(&G, h);
161
dpd_buf4_dump(&G, OutBuf, qt_vir, qt_vir, qt_occ, qt_vir, 0, 0);
163
dpd_buf4_init(&G, CC_GAMMA, 0, 5, 5, 5, 5, 0, "GAbCd");
164
dpd_buf4_sort(&G, CC_TMP0, prqs, 5, 5, "G(AC,BD)");
166
dpd_buf4_init(&G, CC_TMP0, 0, 5, 5, 5, 5, 0, "G(AC,BD)");
167
dpd_buf4_dump(&G, OutBuf, qt_vir, qt_vir, qt_vir, qt_vir, 1, 0);
173
}} // namespace psi::ccdensity