3
\brief Enter brief description of file here
7
#include <libiwl/iwl.h>
8
#include <libdpd/dpd.h>
10
namespace psi { namespace ccsort {
12
void idx_error(const char *message, int p, int q, int r, int s, int pq, int rs,
13
int pq_sym, int rs_sym, FILE *outfile);
14
void idx_permute_multipass(dpdfile4 *File, int this_bucket, int **bucket_map,
15
int **bucket_offset, int p, int q, int r, int s,
16
int perm_pr, int perm_qs, int perm_prqs,
17
double value, FILE *outfile)
19
int p_sym, q_sym, r_sym, s_sym;
20
int pq_sym, rs_sym, rq_sym, ps_sym, qp_sym, sp_sym, sr_sym, qr_sym;
21
int pq, rs, rq, ps, qp, sr, qr, sp;
26
Params = File->params;
27
perm_pq = Params->perm_pq;
28
perm_rs = Params->perm_rs;
30
/* Get the orbital symmetries */
31
p_sym = Params->psym[p]; q_sym = Params->qsym[q];
32
r_sym = Params->rsym[r]; s_sym = Params->ssym[s];
34
/* Go through the allowed permutations --- NB these are Dirac permutations */
36
if(bucket_map[p][q] == this_bucket) {
38
/* Get the left and right symmetry blocks */
42
/* Get the row and column indices and assign the value */
43
pq = Params->rowidx[p][q];
44
rs = Params->colidx[r][s];
45
if((pq >= Params->rowtot[pq_sym]) || (rs >= Params->coltot[rs_sym]))
46
idx_error("MP Params_make: pq, rs", p,q,r,s,pq,rs,pq_sym,rs_sym,outfile);
48
offset = bucket_offset[this_bucket][pq_sym];
49
File->matrix[pq_sym][pq-offset][rs] = value;
53
if(bucket_map[r][q] == this_bucket) {
56
rq = Params->rowidx[r][q];
57
ps = Params->colidx[p][s];
58
if((rq >= Params->rowtot[rq_sym]) || (ps >= Params->coltot[ps_sym]))
59
idx_error("MP Params_make: rq, ps", p,q,r,s,rq,ps,rq_sym,ps_sym,outfile);
61
offset = bucket_offset[this_bucket][rq_sym];
62
File->matrix[rq_sym][rq-offset][ps] = value;
67
if(bucket_map[p][s] == this_bucket) {
70
ps = Params->rowidx[p][s];
71
rq = Params->colidx[r][q];
72
if((ps >= Params->rowtot[ps_sym]) || (rq >= Params->coltot[rq_sym]))
73
idx_error("MP Params_make: ps, rq", p,q,r,s,ps,rq,ps_sym,rq_sym,outfile);
75
offset = bucket_offset[this_bucket][ps_sym];
76
File->matrix[ps_sym][ps-offset][rq] = value;
80
if(perm_pr && perm_qs) {
81
if(bucket_map[r][s] == this_bucket) {
84
rs = Params->rowidx[r][s];
85
pq = Params->colidx[p][q];
86
if((rs >= Params->rowtot[rs_sym]) || (pq >= Params->coltot[pq_sym]))
87
idx_error("MP Params_make: rs, pq", p,q,r,s,rs,pq,rs_sym,pq_sym,outfile);
89
offset = bucket_offset[this_bucket][rs_sym];
90
File->matrix[rs_sym][rs-offset][pq] = value;
95
if(bucket_map[q][p] == this_bucket) {
98
qp = Params->rowidx[q][p];
99
sr = Params->colidx[s][r];
100
if((qp >= Params->rowtot[qp_sym]) || (sr >= Params->coltot[sr_sym]))
101
idx_error("MP Params_make: qp, sr", p,q,r,s,qp,sr,qp_sym,sr_sym,outfile);
103
offset = bucket_offset[this_bucket][qp_sym];
104
File->matrix[qp_sym][qp-offset][sr] = value;
108
if(bucket_map[q][r] == this_bucket) {
109
qr_sym = q_sym^r_sym;
110
sp_sym = s_sym^p_sym;
111
qr = Params->rowidx[q][r];
112
sp = Params->colidx[s][p];
113
if((qr >= Params->rowtot[qr_sym])||(sp >= Params->coltot[sp_sym]))
114
idx_error("MP Params_make: qr, sp", p,q,r,s,qr,sp,qr_sym,sp_sym,
117
offset = bucket_offset[this_bucket][qr_sym];
118
File->matrix[qr_sym][qr-offset][sp] = value;
123
if(bucket_map[s][p] == this_bucket) {
124
sp_sym = s_sym^p_sym;
125
qr_sym = q_sym^r_sym;
126
sp = Params->rowidx[s][p];
127
qr = Params->colidx[q][r];
128
if((sp >= Params->rowtot[sp_sym])||(qr >= Params->coltot[qr_sym]))
129
idx_error("MP Params_make: sp, qr", p,q,r,s,sp,qr,sp_sym,qr_sym,
132
offset = bucket_offset[this_bucket][sp_sym];
133
File->matrix[sp_sym][sp-offset][qr] = value;
137
if(perm_pr && perm_qs) {
138
if(bucket_map[s][r] == this_bucket) {
139
sr_sym = s_sym^r_sym;
140
qp_sym = q_sym^p_sym;
141
sr = Params->rowidx[s][r];
142
qp = Params->colidx[q][p];
143
if((sr >= Params->rowtot[sr_sym])||(qp >= Params->coltot[qp_sym]))
144
idx_error("MP Params_make: sr, qp", p,q,r,s,sr,qp,sr_sym,qp_sym,
147
offset = bucket_offset[this_bucket][sr_sym];
148
File->matrix[sr_sym][sr-offset][qp] = value;
154
}} // namespace psi::ccsort