~ubuntu-branches/ubuntu/karmic/psicode/karmic

« back to all changes in this revision

Viewing changes to src/bin/cchbar/purge.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*! \file
 
2
    \ingroup CCHBAR
 
3
    \brief Enter brief description of file here 
 
4
*/
 
5
#include <cstdio>
 
6
#include <libdpd/dpd.h>
 
7
#include <cmath>
 
8
#include "MOInfo.h"
 
9
#include "Params.h"
 
10
#define EXTERN
 
11
#include "globals.h"
 
12
 
 
13
namespace psi { namespace cchbar {
 
14
 
 
15
void purge(void) {
 
16
  dpdfile2 FAE, Fmi, FME, Fme;
 
17
  dpdfile4 W;
 
18
  int *occpi, *virtpi;
 
19
  int h, a, b, e, f, i, j, m, n;
 
20
  int    A, B, E, F, I, J, M, N;
 
21
  int mn, ei, ma, ef, me, jb, mb, ij, ab;
 
22
  int asym, bsym, esym, fsym, isym, jsym, msym, nsym;
 
23
  int *occ_off, *vir_off;
 
24
  int *occ_sym, *vir_sym;
 
25
  int *openpi, nirreps;
 
26
 
 
27
  nirreps = moinfo.nirreps;
 
28
  occpi = moinfo.occpi; virtpi = moinfo.virtpi;
 
29
  occ_off = moinfo.occ_off; vir_off = moinfo.vir_off;
 
30
  occ_sym = moinfo.occ_sym; vir_sym = moinfo.vir_sym;
 
31
  openpi = moinfo.openpi;
 
32
 
 
33
  /* Purge FME matrix elements */
 
34
  dpd_file2_init(&FME, CC_OEI, 0, 0, 1, "FME");
 
35
  dpd_file2_mat_init(&FME);
 
36
  dpd_file2_mat_rd(&FME);
 
37
  for(h=0; h < nirreps; h++) {
 
38
    for(m=0; m<occpi[h]; m++)
 
39
      for(e=(virtpi[h]-openpi[h]); e<virtpi[h]; e++)
 
40
        FME.matrix[h][m][e] = 0.0;
 
41
  }
 
42
  dpd_file2_mat_wrt(&FME);
 
43
  dpd_file2_mat_close(&FME);
 
44
  dpd_file2_close(&FME);
 
45
 
 
46
  /* Purge Fme matrix elements */
 
47
  dpd_file2_init(&Fme, CC_OEI, 0, 0, 1, "Fme");
 
48
  dpd_file2_mat_init(&Fme);
 
49
  dpd_file2_mat_rd(&Fme);
 
50
  for(h=0; h < nirreps; h++) {
 
51
    for(e=0; e<virtpi[h]; e++)
 
52
      for(m=(occpi[h]-openpi[h]); m<occpi[h]; m++)
 
53
        Fme.matrix[h][m][e] = 0.0;
 
54
  }
 
55
  dpd_file2_mat_wrt(&Fme);
 
56
  dpd_file2_mat_close(&Fme);
 
57
  dpd_file2_close(&Fme);
 
58
 
 
59
  /* Purge Fmi matrix elements */
 
60
  dpd_file2_init(&Fmi, CC_OEI, 0, 0, 0, "Fmi");
 
61
  dpd_file2_mat_init(&Fmi);
 
62
  dpd_file2_mat_rd(&Fmi);
 
63
  for(h=0; h < nirreps; h++) {
 
64
 
 
65
    for(i=0; i<occpi[h]; i++)
 
66
      for(j=(occpi[h]-openpi[h]); j<occpi[h]; j++)
 
67
        Fmi.matrix[h][i][j] = 0.0;
 
68
 
 
69
    for(i=(occpi[h]-openpi[h]); i<occpi[h]; i++)
 
70
      for(j=0; j<occpi[h]; j++)
 
71
        Fmi.matrix[h][i][j] = 0.0;
 
72
 
 
73
  }
 
74
  dpd_file2_mat_wrt(&Fmi);
 
75
  dpd_file2_mat_close(&Fmi);
 
76
  dpd_file2_close(&Fmi);
 
77
 
 
78
  /* Purge FAE matrix elements */
 
79
  dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
 
80
  dpd_file2_mat_init(&FAE);
 
81
  dpd_file2_mat_rd(&FAE);
 
82
  for(h=0; h < nirreps; h++) {
 
83
 
 
84
    for(a=0; a<virtpi[h]; a++)
 
85
      for(b=(virtpi[h]-openpi[h]); b<virtpi[h]; b++)
 
86
        FAE.matrix[h][a][b] = 0.0;
 
87
 
 
88
    for(a=(virtpi[h]-openpi[h]); a<virtpi[h]; a++)
 
89
      for(b=0; b<virtpi[h]; b++)
 
90
        FAE.matrix[h][a][b] = 0.0;
 
91
 
 
92
  }
 
93
  dpd_file2_mat_wrt(&FAE);
 
94
  dpd_file2_mat_close(&FAE);
 
95
  dpd_file2_close(&FAE);
 
96
 
 
97
  /* Purge Fmit (matrix elements with zero diagonal) */
 
98
  dpd_file2_init(&Fmi, CC_OEI, 0, 0, 0, "Fmit");
 
99
  dpd_file2_mat_init(&Fmi);
 
100
  dpd_file2_mat_rd(&Fmi);
 
101
  for(h=0; h < nirreps; h++) {
 
102
 
 
103
    for(i=0; i<occpi[h]; i++)
 
104
      for(j=(occpi[h]-openpi[h]); j<occpi[h]; j++)
 
105
        Fmi.matrix[h][i][j] = 0.0;
 
106
 
 
107
    for(i=(occpi[h]-openpi[h]); i<occpi[h]; i++)
 
108
      for(j=0; j<occpi[h]; j++)
 
109
        Fmi.matrix[h][i][j] = 0.0;
 
110
 
 
111
  }
 
112
  dpd_file2_mat_wrt(&Fmi);
 
113
  dpd_file2_mat_close(&Fmi);
 
114
  dpd_file2_close(&Fmi);
 
115
 
 
116
  /* Purge FAEt (matrix elements with zero diagonal) */
 
117
  dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAEt");
 
118
  dpd_file2_mat_init(&FAE);
 
119
  dpd_file2_mat_rd(&FAE);
 
120
  for(h=0; h < nirreps; h++) {
 
121
 
 
122
    for(a=0; a<virtpi[h]; a++)
 
123
      for(b=(virtpi[h]-openpi[h]); b<virtpi[h]; b++)
 
124
        FAE.matrix[h][a][b] = 0.0;
 
125
 
 
126
    for(a=(virtpi[h]-openpi[h]); a<virtpi[h]; a++)
 
127
      for(b=0; b<virtpi[h]; b++)
 
128
        FAE.matrix[h][a][b] = 0.0;
 
129
 
 
130
  }
 
131
  dpd_file2_mat_wrt(&FAE);
 
132
  dpd_file2_mat_close(&FAE);
 
133
  dpd_file2_close(&FAE);
 
134
 
 
135
  /* Purge Wmnij matrix elements */
 
136
  dpd_file4_init(&W, CC_HBAR, 0, 2, 2,"Wmnij");
 
137
  for(h=0; h < nirreps; h++) {
 
138
    dpd_file4_mat_irrep_init(&W, h);
 
139
    dpd_file4_mat_irrep_rd(&W, h);
 
140
    for(mn=0; mn < W.params->rowtot[h]; mn++) {
 
141
      m = W.params->roworb[h][mn][0];
 
142
      n = W.params->roworb[h][mn][1];
 
143
      msym = W.params->psym[m];
 
144
      nsym = W.params->qsym[n];
 
145
      M = m - occ_off[msym];
 
146
      N = n - occ_off[nsym];
 
147
      for(ij=0; ij < W.params->coltot[h]; ij++) {
 
148
        i = W.params->colorb[h][ij][0];
 
149
        j = W.params->colorb[h][ij][1];
 
150
        isym = W.params->rsym[i];
 
151
        jsym = W.params->ssym[j];
 
152
        I = i - occ_off[isym];
 
153
        J = j - occ_off[jsym];
 
154
        if ((I >= (occpi[isym] - openpi[isym])) ||
 
155
            (J >= (occpi[jsym] - openpi[jsym])) ||
 
156
            (M >= (occpi[msym] - openpi[msym])) ||
 
157
            (N >= (occpi[nsym] - openpi[nsym])) )
 
158
          W.matrix[h][mn][ij] = 0.0;
 
159
      }
 
160
    }
 
161
    dpd_file4_mat_irrep_wrt(&W, h);
 
162
    dpd_file4_mat_irrep_close(&W, h);
 
163
  }
 
164
  dpd_file4_close(&W);
 
165
 
 
166
  dpd_file4_init(&W, CC_HBAR, 0, 0, 0,"WMnIj");
 
167
  for(h=0; h < nirreps; h++) {
 
168
    dpd_file4_mat_irrep_init(&W, h);
 
169
    dpd_file4_mat_irrep_rd(&W, h);
 
170
    for(mn=0; mn < W.params->rowtot[h]; mn++) {
 
171
      n = W.params->roworb[h][mn][1];
 
172
      nsym = W.params->qsym[n];
 
173
      N = n - occ_off[nsym];
 
174
      for(ij=0; ij < W.params->coltot[h]; ij++) {
 
175
        j = W.params->colorb[h][ij][1];
 
176
        jsym = W.params->ssym[j];
 
177
        J = j - occ_off[jsym];
 
178
        if ((J >= (occpi[jsym] - openpi[jsym])) ||
 
179
            (N >= (occpi[nsym] - openpi[nsym])) )
 
180
          W.matrix[h][mn][ij] = 0.0;
 
181
      }
 
182
    }
 
183
    dpd_file4_mat_irrep_wrt(&W, h);
 
184
    dpd_file4_mat_irrep_close(&W, h);
 
185
  }
 
186
  dpd_file4_close(&W);
 
187
 
 
188
  /* Purge Wmbej matrix elements */
 
189
  dpd_file4_init(&W, CC_HBAR, 0, 10, 10,"WMBEJ");
 
190
  for(h=0; h < nirreps; h++) {
 
191
    dpd_file4_mat_irrep_init(&W, h);
 
192
    dpd_file4_mat_irrep_rd(&W, h);
 
193
    for(me=0; me < W.params->rowtot[h]; me++) {
 
194
      e = W.params->roworb[h][me][1];
 
195
      esym = W.params->qsym[e];
 
196
      E = e - vir_off[esym];
 
197
      for(jb=0; jb < W.params->coltot[h]; jb++) {
 
198
        b = W.params->colorb[h][jb][1];
 
199
        bsym = W.params->ssym[b];
 
200
        B = b - vir_off[bsym];
 
201
        if ((E >= (virtpi[esym] - openpi[esym])) ||
 
202
            (B >= (virtpi[bsym] - openpi[bsym])) )
 
203
          W.matrix[h][me][jb] = 0.0;
 
204
      }
 
205
    }
 
206
    dpd_file4_mat_irrep_wrt(&W, h);
 
207
    dpd_file4_mat_irrep_close(&W, h);
 
208
  }
 
209
  dpd_file4_close(&W);
 
210
 
 
211
  dpd_file4_init(&W, CC_HBAR, 0, 10, 10,"Wmbej");
 
212
  for(h=0; h < nirreps; h++) {
 
213
    dpd_file4_mat_irrep_init(&W, h);
 
214
    dpd_file4_mat_irrep_rd(&W, h);
 
215
    for(me=0; me < W.params->rowtot[h]; me++) {
 
216
      m = W.params->roworb[h][me][0];
 
217
      msym = W.params->psym[m];
 
218
      M = m - occ_off[msym];
 
219
      for(jb=0; jb < W.params->coltot[h]; jb++) {
 
220
        j = W.params->colorb[h][jb][0];
 
221
        jsym = W.params->rsym[j];
 
222
        J = j - occ_off[jsym];
 
223
        if ((M >= (occpi[msym] - openpi[msym])) ||
 
224
            (J >= (occpi[jsym] - openpi[jsym])) )
 
225
          W.matrix[h][me][jb] = 0.0;
 
226
      }
 
227
    }
 
228
    dpd_file4_mat_irrep_wrt(&W, h);
 
229
    dpd_file4_mat_irrep_close(&W, h);
 
230
  }
 
231
  dpd_file4_close(&W);
 
232
 
 
233
  dpd_file4_init(&W, CC_HBAR, 0, 10, 10,"WMbEj");
 
234
  for(h=0; h < nirreps; h++) {
 
235
    dpd_file4_mat_irrep_init(&W, h);
 
236
    dpd_file4_mat_irrep_rd(&W, h);
 
237
    for(me=0; me < W.params->rowtot[h]; me++) {
 
238
      e = W.params->roworb[h][me][1];
 
239
      esym = W.params->qsym[e];
 
240
      E = e - vir_off[esym];
 
241
      for(jb=0; jb < W.params->coltot[h]; jb++) {
 
242
        j = W.params->colorb[h][jb][0];
 
243
        jsym = W.params->rsym[j];
 
244
        J = j - occ_off[jsym];
 
245
        if ((E >= (virtpi[esym] - openpi[esym])) ||
 
246
            (J >= (occpi[jsym] - openpi[jsym])) )
 
247
          W.matrix[h][me][jb] = 0.0;
 
248
      }
 
249
    }
 
250
    dpd_file4_mat_irrep_wrt(&W, h);
 
251
    dpd_file4_mat_irrep_close(&W, h);
 
252
  }
 
253
  dpd_file4_close(&W);
 
254
 
 
255
  dpd_file4_init(&W, CC_HBAR, 0, 10, 10,"WmBeJ");
 
256
  for(h=0; h < nirreps; h++) {
 
257
    dpd_file4_mat_irrep_init(&W, h);
 
258
    dpd_file4_mat_irrep_rd(&W, h);
 
259
    for(me=0; me < W.params->rowtot[h]; me++) {
 
260
      m = W.params->roworb[h][me][0];
 
261
      msym = W.params->psym[m];
 
262
      M = m - occ_off[msym];
 
263
      for(jb=0; jb < W.params->coltot[h]; jb++) {
 
264
        b = W.params->colorb[h][jb][1];
 
265
        bsym = W.params->ssym[b];
 
266
        B = b - vir_off[bsym];
 
267
        if ((M >= (occpi[msym] - openpi[msym])) ||
 
268
            (B >= (virtpi[bsym] - openpi[bsym])) )
 
269
          W.matrix[h][me][jb] = 0.0;
 
270
      }
 
271
    }
 
272
    dpd_file4_mat_irrep_wrt(&W, h);
 
273
    dpd_file4_mat_irrep_close(&W, h);
 
274
  }
 
275
  dpd_file4_close(&W);
 
276
 
 
277
  dpd_file4_init(&W, CC_HBAR, 0, 10, 10,"WmBEj");
 
278
  for(h=0; h < nirreps; h++) {
 
279
    dpd_file4_mat_irrep_init(&W, h);
 
280
    dpd_file4_mat_irrep_rd(&W, h);
 
281
    for(me=0; me < W.params->rowtot[h]; me++) {
 
282
      m = W.params->roworb[h][me][0];
 
283
      e = W.params->roworb[h][me][1];
 
284
      msym = W.params->psym[m];
 
285
      esym = W.params->qsym[e];
 
286
      M = m - occ_off[msym];
 
287
      E = e - vir_off[esym];
 
288
      for(jb=0; jb < W.params->coltot[h]; jb++) {
 
289
        j = W.params->colorb[h][jb][0];
 
290
        b = W.params->colorb[h][jb][1];
 
291
        jsym = W.params->rsym[j];
 
292
        bsym = W.params->ssym[b];
 
293
        J = j - occ_off[jsym];
 
294
        B = b - vir_off[bsym];
 
295
        if ((M >= (occpi[msym] - openpi[msym])) ||
 
296
            (E >= (virtpi[esym] - openpi[esym])) ||
 
297
            (J >= (occpi[jsym] - openpi[jsym])) ||
 
298
            (B >= (virtpi[bsym] - openpi[bsym])) )
 
299
          W.matrix[h][me][jb] = 0.0;
 
300
      }
 
301
    }
 
302
    dpd_file4_mat_irrep_wrt(&W, h);
 
303
    dpd_file4_mat_irrep_close(&W, h);
 
304
  }
 
305
  dpd_file4_close(&W);
 
306
 
 
307
  /* WMbeJ is already OK */
 
308
 
 
309
  /* Purge Wamef matrix elements */
 
310
  dpd_file4_init(&W, CC_HBAR, 0, 11, 7,"WAMEF");
 
311
  for(h=0; h < nirreps; h++) {
 
312
    dpd_file4_mat_irrep_init(&W, h);
 
313
    dpd_file4_mat_irrep_rd(&W, h);
 
314
    for(ma=0; ma < W.params->rowtot[h]; ma++) {
 
315
      a = W.params->roworb[h][ma][0];
 
316
      asym = W.params->psym[a];
 
317
      A = a - vir_off[asym];
 
318
      for(ef=0; ef< W.params->coltot[h]; ef++) {
 
319
        e = W.params->colorb[h][ef][0];
 
320
        f = W.params->colorb[h][ef][1];
 
321
        esym = W.params->rsym[e];
 
322
        fsym = W.params->ssym[f];
 
323
        E = e - vir_off[esym];
 
324
        F = f - vir_off[fsym];
 
325
        if ((A >= (virtpi[asym] - openpi[asym])) ||
 
326
            (E >= (virtpi[esym] - openpi[esym])) ||
 
327
            (F >= (virtpi[fsym] - openpi[fsym])) )
 
328
          W.matrix[h][ma][ef] = 0.0;
 
329
      }
 
330
    }
 
331
    dpd_file4_mat_irrep_wrt(&W, h);
 
332
    dpd_file4_mat_irrep_close(&W, h);
 
333
  }
 
334
  dpd_file4_close(&W);
 
335
 
 
336
  dpd_file4_init(&W, CC_HBAR, 0, 11, 7,"Wamef");
 
337
  for(h=0; h < nirreps; h++) {
 
338
    dpd_file4_mat_irrep_init(&W, h);
 
339
    dpd_file4_mat_irrep_rd(&W, h);
 
340
    for(ma=0; ma < W.params->rowtot[h]; ma++) {
 
341
      m = W.params->roworb[h][ma][1];
 
342
      msym = W.params->qsym[m];
 
343
      M = m - occ_off[msym];
 
344
      for(ef=0; ef< W.params->coltot[h]; ef++) {
 
345
        if (M >=  (occpi[msym] - openpi[msym]))
 
346
          W.matrix[h][ma][ef] = 0.0;
 
347
      }
 
348
    }
 
349
    dpd_file4_mat_irrep_wrt(&W, h);
 
350
    dpd_file4_mat_irrep_close(&W, h);
 
351
  }
 
352
  dpd_file4_close(&W);
 
353
 
 
354
  dpd_file4_init(&W, CC_HBAR, 0, 11, 5,"WAmEf");
 
355
  for(h=0; h < nirreps; h++) {
 
356
    dpd_file4_mat_irrep_init(&W, h);
 
357
    dpd_file4_mat_irrep_rd(&W, h);
 
358
    for(ma=0; ma < W.params->rowtot[h]; ma++) {
 
359
      a = W.params->roworb[h][ma][0];
 
360
      m = W.params->roworb[h][ma][1];
 
361
      asym = W.params->psym[a];
 
362
      msym = W.params->qsym[m];
 
363
      M = m - occ_off[msym];
 
364
      A = a - vir_off[asym];
 
365
      for(ef=0; ef< W.params->coltot[h]; ef++) {
 
366
        e = W.params->colorb[h][ef][0];
 
367
        esym = W.params->rsym[e];
 
368
        E = e - vir_off[esym];
 
369
        if ((A >= (virtpi[asym] - openpi[asym])) ||
 
370
            (M >=  (occpi[msym] - openpi[msym])) ||
 
371
            (E >= (virtpi[esym] - openpi[esym])) )
 
372
          W.matrix[h][ma][ef] = 0.0;
 
373
      }
 
374
    }
 
375
    dpd_file4_mat_irrep_wrt(&W, h);
 
376
    dpd_file4_mat_irrep_close(&W, h);
 
377
  }
 
378
  dpd_file4_close(&W);
 
379
 
 
380
  dpd_file4_init(&W, CC_HBAR, 0, 11, 5,"WaMeF");
 
381
  for(h=0; h < nirreps; h++) {
 
382
    dpd_file4_mat_irrep_init(&W, h);
 
383
    dpd_file4_mat_irrep_rd(&W, h);
 
384
    for(ma=0; ma < W.params->rowtot[h]; ma++) {
 
385
      for(ef=0; ef< W.params->coltot[h]; ef++) {
 
386
        f = W.params->colorb[h][ef][1];
 
387
        fsym = W.params->ssym[f];
 
388
        F = f - vir_off[fsym];
 
389
        if (F >= (virtpi[fsym] - openpi[fsym]))
 
390
          W.matrix[h][ma][ef] = 0.0;
 
391
      }
 
392
    }
 
393
    dpd_file4_mat_irrep_wrt(&W, h);
 
394
    dpd_file4_mat_irrep_close(&W, h);
 
395
  }
 
396
  dpd_file4_close(&W);
 
397
 
 
398
 
 
399
  /* Purge Wmnie matrix elements */
 
400
  /* moving to separate function
 
401
  dpd_file4_init(&W, CC_HBAR, 0, 2, 11,"WMNIE");
 
402
  for(h=0; h < W.params->nirreps; h++) {
 
403
    dpd_file4_mat_irrep_init(&W, h);
 
404
    dpd_file4_mat_irrep_rd(&W, h);
 
405
    for(mn=0; mn<W.params->rowtot[h]; mn++) {
 
406
      for(ei=0; ei<W.params->coltot[h]; ei++) {
 
407
        e = W.params->colorb[h][ei][0];
 
408
        esym = W.params->rsym[e];
 
409
        E = e - vir_off[esym];
 
410
        if (E >= (virtpi[esym] - openpi[esym]))
 
411
          W.matrix[h][mn][ei] = 0.0;
 
412
      }
 
413
    }
 
414
    dpd_file4_mat_irrep_wrt(&W, h);
 
415
    dpd_file4_mat_irrep_close(&W, h);
 
416
  }
 
417
  dpd_file4_close(&W);
 
418
 
 
419
  dpd_file4_init(&W, CC_HBAR, 0, 2, 11,"Wmnie");
 
420
  for(h=0; h < nirreps; h++) {
 
421
    dpd_file4_mat_irrep_init(&W, h);
 
422
    dpd_file4_mat_irrep_rd(&W, h);
 
423
    for(mn=0; mn<W.params->rowtot[h]; mn++) {
 
424
      m = W.params->roworb[h][mn][0];
 
425
      n = W.params->roworb[h][mn][1];
 
426
      msym = W.params->psym[m];
 
427
      nsym = W.params->qsym[n];
 
428
      M = m - occ_off[msym];
 
429
      N = n - occ_off[nsym];
 
430
      for(ei=0; ei<W.params->coltot[h]; ei++) {
 
431
        i = W.params->colorb[h][ei][1];
 
432
        isym = W.params->ssym[i];
 
433
        I = i - occ_off[isym];
 
434
        if ((M >= (occpi[msym] - openpi[msym])) ||
 
435
            (N >= (occpi[nsym] - openpi[nsym])) ||
 
436
            (I >= (occpi[isym] - openpi[isym])) )
 
437
          W.matrix[h][mn][ei] = 0.0;
 
438
      }
 
439
    }
 
440
    dpd_file4_mat_irrep_wrt(&W, h);
 
441
    dpd_file4_mat_irrep_close(&W, h);
 
442
  }
 
443
  dpd_file4_close(&W);
 
444
 
 
445
  dpd_file4_init(&W, CC_HBAR, 0, 0, 11,"WMnIe");
 
446
  for(h=0; h < nirreps; h++) {
 
447
    dpd_file4_mat_irrep_init(&W, h);
 
448
    dpd_file4_mat_irrep_rd(&W, h);
 
449
    for(mn=0; mn<W.params->rowtot[h]; mn++) {
 
450
      n = W.params->roworb[h][mn][1];
 
451
      nsym = W.params->qsym[n];
 
452
      N = n - occ_off[nsym];
 
453
      for(ei=0; ei<W.params->coltot[h]; ei++) {
 
454
        if (N >= (occpi[nsym] - openpi[nsym]))
 
455
          W.matrix[h][mn][ei] = 0.0;
 
456
      }
 
457
    }
 
458
    dpd_file4_mat_irrep_wrt(&W, h);
 
459
    dpd_file4_mat_irrep_close(&W, h);
 
460
  }
 
461
 
 
462
  dpd_file4_init(&W, CC_HBAR, 0, 0, 11,"WmNiE");
 
463
  for(h=0; h < nirreps; h++) {
 
464
    dpd_file4_mat_irrep_init(&W, h);
 
465
    dpd_file4_mat_irrep_rd(&W, h);
 
466
    for(mn=0; mn<W.params->rowtot[h]; mn++) {
 
467
      m = W.params->roworb[h][mn][0];
 
468
      msym = W.params->psym[m];
 
469
      M = m - occ_off[msym];
 
470
      for(ei=0; ei<W.params->coltot[h]; ei++) {
 
471
        e = W.params->colorb[h][ei][0];
 
472
        i = W.params->colorb[h][ei][1];
 
473
        esym = W.params->rsym[e];
 
474
        isym = W.params->ssym[i];
 
475
        E = e - vir_off[esym];
 
476
        I = i - occ_off[isym];
 
477
        if ((M >= (occpi[msym] - openpi[msym])) ||
 
478
            (E >= (virtpi[esym] - openpi[esym])) ||
 
479
            (I >= (occpi[isym] - openpi[isym])) )
 
480
          W.matrix[h][mn][ei] = 0.0;
 
481
      }
 
482
    }
 
483
    dpd_file4_mat_irrep_wrt(&W, h);
 
484
    dpd_file4_mat_irrep_close(&W, h);
 
485
  }
 
486
  dpd_file4_close(&W);
 
487
  */
 
488
 
 
489
 
 
490
  /* Purge WMBIJ matrix elements */
 
491
  dpd_file4_init(&W, CC_HBAR, 0, 10, 2,"WMBIJ");
 
492
  for(h=0; h < nirreps; h++) {
 
493
    dpd_file4_mat_irrep_init(&W, h);
 
494
    dpd_file4_mat_irrep_rd(&W, h);
 
495
    for(mb=0; mb<W.params->rowtot[h]; mb++) {
 
496
      b = W.params->roworb[h][mb][1];
 
497
      bsym = W.params->qsym[b];
 
498
      B = b - vir_off[bsym];
 
499
      for(ij=0; ij<W.params->coltot[h]; ij++) {
 
500
        if (B >= (virtpi[bsym] - openpi[bsym]))
 
501
          W.matrix[h][mb][ij] = 0.0;
 
502
      }
 
503
    }
 
504
    dpd_file4_mat_irrep_wrt(&W, h);
 
505
    dpd_file4_mat_irrep_close(&W, h);
 
506
  }
 
507
  dpd_file4_close(&W);
 
508
 
 
509
  dpd_file4_init(&W, CC_HBAR, 0, 10, 2,"Wmbij");
 
510
  for(h=0; h < nirreps; h++) {
 
511
    dpd_file4_mat_irrep_init(&W, h);
 
512
    dpd_file4_mat_irrep_rd(&W, h);
 
513
    for(mb=0; mb<W.params->rowtot[h]; mb++) {
 
514
      m = W.params->roworb[h][mb][0];
 
515
      msym = W.params->psym[m];
 
516
      M = m - occ_off[msym];
 
517
      for(ij=0; ij<W.params->coltot[h]; ij++) {
 
518
        i = W.params->colorb[h][ij][0];
 
519
        j = W.params->colorb[h][ij][1];
 
520
        isym = W.params->rsym[i];
 
521
        jsym = W.params->ssym[j];
 
522
        I = i - occ_off[isym];
 
523
        J = j - occ_off[jsym];
 
524
        if ((M >= (occpi[msym] - openpi[msym])) ||
 
525
            (I >= (occpi[isym] - openpi[isym])) ||
 
526
            (J >= (occpi[jsym] - openpi[jsym])) )
 
527
          W.matrix[h][mb][ij] = 0.0;
 
528
      }
 
529
    }
 
530
    dpd_file4_mat_irrep_wrt(&W, h);
 
531
    dpd_file4_mat_irrep_close(&W, h);
 
532
  }
 
533
  dpd_file4_close(&W);
 
534
 
 
535
  dpd_file4_init(&W, CC_HBAR, 0, 10, 0,"WMbIj");
 
536
  for(h=0; h < nirreps; h++) {
 
537
    dpd_file4_mat_irrep_init(&W, h);
 
538
    dpd_file4_mat_irrep_rd(&W, h);
 
539
    for(mb=0; mb<W.params->rowtot[h]; mb++) {
 
540
      for(ij=0; ij<W.params->coltot[h]; ij++) {
 
541
        j = W.params->colorb[h][ij][1];
 
542
        jsym = W.params->ssym[j];
 
543
        J = j - occ_off[jsym];
 
544
        if (J >= (occpi[jsym] - openpi[jsym]))
 
545
          W.matrix[h][mb][ij] = 0.0;
 
546
      }
 
547
    }
 
548
    dpd_file4_mat_irrep_wrt(&W, h);
 
549
    dpd_file4_mat_irrep_close(&W, h);
 
550
  }
 
551
  dpd_file4_close(&W);
 
552
 
 
553
  dpd_file4_init(&W, CC_HBAR, 0, 10, 0,"WmBiJ");
 
554
  for(h=0; h < nirreps; h++) {
 
555
    dpd_file4_mat_irrep_init(&W, h);
 
556
    dpd_file4_mat_irrep_rd(&W, h);
 
557
    for(mb=0; mb<W.params->rowtot[h]; mb++) {
 
558
      m = W.params->roworb[h][mb][0];
 
559
      b = W.params->roworb[h][mb][1];
 
560
      msym = W.params->psym[m];
 
561
      bsym = W.params->qsym[b];
 
562
      M = m - occ_off[msym];
 
563
      B = b - vir_off[bsym];
 
564
      for(ij=0; ij<W.params->coltot[h]; ij++) {
 
565
        i = W.params->colorb[h][ij][0];
 
566
        isym = W.params->rsym[i];
 
567
        I = i - occ_off[isym];
 
568
        if ((M >= (occpi[msym] - openpi[msym])) ||
 
569
            (B >= (virtpi[bsym] - openpi[bsym])) ||
 
570
            (I >= (occpi[isym] - openpi[isym])) )
 
571
          W.matrix[h][mb][ij] = 0.0;
 
572
      }
 
573
    }
 
574
    dpd_file4_mat_irrep_wrt(&W, h);
 
575
    dpd_file4_mat_irrep_close(&W, h);
 
576
  }
 
577
  dpd_file4_close(&W);
 
578
 
 
579
 
 
580
 
 
581
 
 
582
 
 
583
  /* Purge Wabei matrix elements */
 
584
  dpd_file4_init(&W, CC_HBAR, 0, 11, 7,"WEIAB");
 
585
  for(h=0; h < nirreps; h++) {
 
586
    dpd_file4_mat_irrep_init(&W, h);
 
587
    dpd_file4_mat_irrep_rd(&W, h);
 
588
    for(ei=0; ei<W.params->rowtot[h]; ei++) {
 
589
      e = W.params->roworb[h][ei][0];
 
590
      esym = W.params->psym[e];
 
591
      E = e - vir_off[esym];
 
592
      for(ab=0; ab<W.params->coltot[h]; ab++) {
 
593
        a = W.params->colorb[h][ab][0];
 
594
        b = W.params->colorb[h][ab][1];
 
595
        asym = W.params->rsym[a];
 
596
        bsym = W.params->ssym[b];
 
597
        A = a - vir_off[asym];
 
598
        B = b - vir_off[bsym];
 
599
        if ((E >= (virtpi[esym] - openpi[esym])) ||
 
600
            (A >= (virtpi[asym] - openpi[asym])) ||
 
601
            (B >= (virtpi[bsym] - openpi[bsym])) )
 
602
          W.matrix[h][ei][ab] = 0.0;
 
603
      }
 
604
    }
 
605
    dpd_file4_mat_irrep_wrt(&W, h);
 
606
    dpd_file4_mat_irrep_close(&W, h);
 
607
  }
 
608
  dpd_file4_close(&W);
 
609
 
 
610
  dpd_file4_init(&W, CC_HBAR, 0, 11, 7,"Weiab");
 
611
  for(h=0; h < nirreps; h++) {
 
612
    dpd_file4_mat_irrep_init(&W, h);
 
613
    dpd_file4_mat_irrep_rd(&W, h);
 
614
    for(ei=0; ei<W.params->rowtot[h]; ei++) {
 
615
      i = W.params->roworb[h][ei][1];
 
616
      isym = W.params->qsym[i];
 
617
      I = i - occ_off[isym];
 
618
      for(ab=0; ab<W.params->coltot[h]; ab++) {
 
619
        if (I >= (occpi[isym] - openpi[isym]))
 
620
          W.matrix[h][ei][ab] = 0.0;
 
621
      }
 
622
    }
 
623
    dpd_file4_mat_irrep_wrt(&W, h);
 
624
    dpd_file4_mat_irrep_close(&W, h);
 
625
  }
 
626
  dpd_file4_close(&W);
 
627
 
 
628
  dpd_file4_init(&W, CC_HBAR, 0, 11, 5,"WEiAb");
 
629
  for(h=0; h < nirreps; h++) {
 
630
    dpd_file4_mat_irrep_init(&W, h);
 
631
    dpd_file4_mat_irrep_rd(&W, h);
 
632
    for(ei=0; ei<W.params->rowtot[h]; ei++) {
 
633
      e = W.params->roworb[h][ei][0];
 
634
      i = W.params->roworb[h][ei][1];
 
635
      esym = W.params->psym[e];
 
636
      isym = W.params->qsym[i];
 
637
      E = e - vir_off[esym];
 
638
      I = i - occ_off[isym];
 
639
      for(ab=0; ab<W.params->coltot[h]; ab++) {
 
640
        a = W.params->colorb[h][ab][0];
 
641
        asym = W.params->rsym[a];
 
642
        bsym = W.params->ssym[b];
 
643
        A = a - vir_off[asym];
 
644
        if ((E >= (virtpi[esym] - openpi[esym])) ||
 
645
            (I >= (occpi[isym] - openpi[isym])) ||
 
646
            (A >= (virtpi[asym] - openpi[asym])) )
 
647
          W.matrix[h][ei][ab] = 0.0;
 
648
      }
 
649
    }
 
650
    dpd_file4_mat_irrep_wrt(&W, h);
 
651
    dpd_file4_mat_irrep_close(&W, h);
 
652
  }
 
653
  dpd_file4_close(&W);
 
654
 
 
655
  dpd_file4_init(&W, CC_HBAR, 0, 11, 5,"WeIaB");
 
656
  for(h=0; h < nirreps; h++) {
 
657
    dpd_file4_mat_irrep_init(&W, h);
 
658
    dpd_file4_mat_irrep_rd(&W, h);
 
659
    for(ei=0; ei<W.params->rowtot[h]; ei++) {
 
660
      for(ab=0; ab<W.params->coltot[h]; ab++) {
 
661
        b = W.params->colorb[h][ab][1];
 
662
        bsym = W.params->ssym[b];
 
663
        B = b - vir_off[bsym];
 
664
        if (B >= (virtpi[bsym] - openpi[bsym]))
 
665
          W.matrix[h][ei][ab] = 0.0;
 
666
      }
 
667
    }
 
668
    dpd_file4_mat_irrep_wrt(&W, h);
 
669
    dpd_file4_mat_irrep_close(&W, h);
 
670
  }
 
671
  dpd_file4_close(&W);
 
672
 
 
673
  return;
 
674
}
 
675
 
 
676
/* Purge Wmnie matrix elements */
 
677
void purge_Wmnie(void) {
 
678
  dpdfile4 W;
 
679
  int *occpi, *virtpi;
 
680
  int h, a, b, e, f, i, j, m, n;
 
681
  int    A, B, E, F, I, J, M, N;
 
682
  int mn, ei, ma, ef, me, jb, mb, ij, ab;
 
683
  int asym, bsym, esym, fsym, isym, jsym, msym, nsym;
 
684
  int *occ_off, *vir_off;
 
685
  int *occ_sym, *vir_sym;
 
686
  int *openpi, nirreps;
 
687
 
 
688
  nirreps = moinfo.nirreps;
 
689
  occpi = moinfo.occpi; virtpi = moinfo.virtpi;
 
690
  occ_off = moinfo.occ_off; vir_off = moinfo.vir_off;
 
691
  occ_sym = moinfo.occ_sym; vir_sym = moinfo.vir_sym;
 
692
  openpi = moinfo.openpi;
 
693
 
 
694
  dpd_file4_init(&W, CC_HBAR, 0, 0, 11,"WMnIe (Mn,eI)");
 
695
  for(h=0; h < nirreps; h++) {
 
696
    dpd_file4_mat_irrep_init(&W, h);
 
697
    dpd_file4_mat_irrep_rd(&W, h);
 
698
    for(mn=0; mn<W.params->rowtot[h]; mn++) {
 
699
      n = W.params->roworb[h][mn][1];
 
700
      nsym = W.params->qsym[n];
 
701
      N = n - occ_off[nsym];
 
702
      for(ei=0; ei<W.params->coltot[h]; ei++) {
 
703
        if (N >= (occpi[nsym] - openpi[nsym]))
 
704
          W.matrix[h][mn][ei] = 0.0;
 
705
      }
 
706
    }
 
707
    dpd_file4_mat_irrep_wrt(&W, h);
 
708
    dpd_file4_mat_irrep_close(&W, h);
 
709
  }
 
710
 
 
711
  dpd_file4_init(&W, CC_HBAR, 0, 2, 11, "WMNIE (M>N,EI)");
 
712
  for(h=0; h < W.params->nirreps; h++) {
 
713
    dpd_file4_mat_irrep_init(&W, h);
 
714
    dpd_file4_mat_irrep_rd(&W, h);
 
715
    for(mn=0; mn<W.params->rowtot[h]; mn++) {
 
716
      for(ei=0; ei<W.params->coltot[h]; ei++) {
 
717
        e = W.params->colorb[h][ei][0];
 
718
        esym = W.params->rsym[e];
 
719
        E = e - vir_off[esym];
 
720
        if (E >= (virtpi[esym] - openpi[esym]))
 
721
          W.matrix[h][mn][ei] = 0.0;
 
722
      }
 
723
    }
 
724
    dpd_file4_mat_irrep_wrt(&W, h);
 
725
    dpd_file4_mat_irrep_close(&W, h);
 
726
  }
 
727
  dpd_file4_close(&W);
 
728
 
 
729
  dpd_file4_init(&W, CC_HBAR, 0, 2, 11,"Wmnie (m>n,ei)");
 
730
  for(h=0; h < nirreps; h++) {
 
731
    dpd_file4_mat_irrep_init(&W, h);
 
732
    dpd_file4_mat_irrep_rd(&W, h);
 
733
    for(mn=0; mn<W.params->rowtot[h]; mn++) {
 
734
      m = W.params->roworb[h][mn][0];
 
735
      n = W.params->roworb[h][mn][1];
 
736
      msym = W.params->psym[m];
 
737
      nsym = W.params->qsym[n];
 
738
      M = m - occ_off[msym];
 
739
      N = n - occ_off[nsym];
 
740
      for(ei=0; ei<W.params->coltot[h]; ei++) {
 
741
        i = W.params->colorb[h][ei][1];
 
742
        isym = W.params->ssym[i];
 
743
        I = i - occ_off[isym];
 
744
        if ((M >= (occpi[msym] - openpi[msym])) ||
 
745
          (N >= (occpi[nsym] - openpi[nsym])) ||
 
746
          (I >= (occpi[isym] - openpi[isym])) )
 
747
          W.matrix[h][mn][ei] = 0.0;
 
748
      }
 
749
    }
 
750
    dpd_file4_mat_irrep_wrt(&W, h);
 
751
    dpd_file4_mat_irrep_close(&W, h);
 
752
  }
 
753
  dpd_file4_close(&W);
 
754
 
 
755
  dpd_file4_init(&W, CC_HBAR, 0, 0, 11,"WmNiE (mN,Ei)");
 
756
  for(h=0; h < nirreps; h++) {
 
757
    dpd_file4_mat_irrep_init(&W, h);
 
758
    dpd_file4_mat_irrep_rd(&W, h);
 
759
    for(mn=0; mn<W.params->rowtot[h]; mn++) {
 
760
      m = W.params->roworb[h][mn][0];
 
761
      msym = W.params->psym[m];
 
762
      M = m - occ_off[msym];
 
763
      for(ei=0; ei<W.params->coltot[h]; ei++) {
 
764
        e = W.params->colorb[h][ei][0];
 
765
        i = W.params->colorb[h][ei][1];
 
766
        esym = W.params->rsym[e];
 
767
        isym = W.params->ssym[i];
 
768
        E = e - vir_off[esym];
 
769
        I = i - occ_off[isym];
 
770
        if ((M >= (occpi[msym] - openpi[msym])) ||
 
771
            (E >= (virtpi[esym] - openpi[esym])) ||
 
772
            (I >= (occpi[isym] - openpi[isym])) )
 
773
          W.matrix[h][mn][ei] = 0.0;
 
774
      }
 
775
    }
 
776
    dpd_file4_mat_irrep_wrt(&W, h);
 
777
    dpd_file4_mat_irrep_close(&W, h);
 
778
  }
 
779
  dpd_file4_close(&W);
 
780
  return;
 
781
}
 
782
 
 
783
}} // namespace psi::cchbar