~ubuntu-branches/ubuntu/precise/psicode/precise

« back to all changes in this revision

Viewing changes to src/bin/cclambda/L1FL2.c

  • 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
 
#include <stdio.h>
2
 
#include <libdpd/dpd.h>
3
 
#define EXTERN
4
 
#include "globals.h"
5
 
 
6
 
/* L2FL2(): Computes the contributions of the Fme HBAR matrix elements
7
 
** to the Lambda doubles equations.  These contributions are given in
8
 
** spin orbitals as:
9
 
**
10
 
** L_ij^ab <-- P(ij) P(ab) L_i^a Fjb
11
 
**
12
 
** where Fjb = fjb + t_n^f <jn||bf>
13
 
**
14
 
** TDC, July 2002
15
 
*/
16
 
 
17
 
void L1FL2(int L_irr)
18
 
{
19
 
  int h, nirreps;
20
 
  int row,col;
21
 
  int i,j,a,b,I,J,A,B,Isym,Jsym,Asym,Bsym;
22
 
  dpdfile2 LIA, Lia, FJB, Fjb, L, F;
23
 
  dpdbuf4 newL2;
24
 
 
25
 
  nirreps = moinfo.nirreps;
26
 
 
27
 
  if(params.ref == 0) { /** RHF **/
28
 
 
29
 
    dpd_file2_init(&L, CC_LAMBDA, L_irr, 0, 1, "LIA");
30
 
    dpd_file2_mat_init(&L);
31
 
    dpd_file2_mat_rd(&L);
32
 
    dpd_file2_init(&F, CC_OEI, 0, 0, 1, "FME");
33
 
    dpd_file2_mat_init(&F);
34
 
    dpd_file2_mat_rd(&F);
35
 
 
36
 
    dpd_buf4_init(&newL2, CC_LAMBDA, L_irr, 0, 5, 0, 5, 0, "New LIjAb");
37
 
 
38
 
    for(h=0; h < nirreps; h++) {
39
 
 
40
 
      dpd_buf4_mat_irrep_init(&newL2, h);
41
 
      dpd_buf4_mat_irrep_rd(&newL2, h);
42
 
 
43
 
      for(row=0; row < newL2.params->rowtot[h]; row++) {
44
 
        i = newL2.params->roworb[h][row][0];
45
 
        j = newL2.params->roworb[h][row][1];
46
 
          
47
 
        for(col=0; col < newL2.params->coltot[h^L_irr]; col++) {
48
 
          a = newL2.params->colorb[h^L_irr][col][0];
49
 
          b = newL2.params->colorb[h^L_irr][col][1];
50
 
 
51
 
          I = L.params->rowidx[i]; Isym = L.params->psym[i];
52
 
          J = F.params->rowidx[j]; Jsym = F.params->psym[j];
53
 
          A = L.params->colidx[a]; Asym = L.params->qsym[a];
54
 
          B = F.params->colidx[b]; Bsym = F.params->qsym[b];
55
 
          if(((Isym^Asym) == L_irr) && (Jsym == Bsym))
56
 
            newL2.matrix[h][row][col] += (L.matrix[Isym][I][A] * F.matrix[Jsym][J][B]);
57
 
 
58
 
          if((Isym == Asym) && ((Jsym^Bsym) == L_irr))
59
 
            newL2.matrix[h][row][col] += (L.matrix[Jsym][J][B] * F.matrix[Isym][I][A]);
60
 
        }
61
 
      }
62
 
 
63
 
      dpd_buf4_mat_irrep_wrt(&newL2, h);
64
 
      dpd_buf4_mat_irrep_close(&newL2, h);
65
 
      
66
 
    }
67
 
 
68
 
    dpd_buf4_close(&newL2);
69
 
 
70
 
    dpd_file2_mat_close(&F);
71
 
    dpd_file2_close(&F);
72
 
    dpd_file2_mat_close(&L);
73
 
    dpd_file2_close(&L);
74
 
 
75
 
  }
76
 
  else if(params.ref == 1) { /** ROHF **/
77
 
 
78
 
    dpd_file2_init(&LIA, CC_LAMBDA, L_irr, 0, 1, "LIA");
79
 
    dpd_file2_mat_init(&LIA);
80
 
    dpd_file2_mat_rd(&LIA);
81
 
    dpd_file2_init(&Lia, CC_LAMBDA, L_irr, 0, 1, "Lia");
82
 
    dpd_file2_mat_init(&Lia);
83
 
    dpd_file2_mat_rd(&Lia);
84
 
    dpd_file2_init(&FJB, CC_OEI, 0, 0, 1, "FME");
85
 
    dpd_file2_mat_init(&FJB);
86
 
    dpd_file2_mat_rd(&FJB);
87
 
    dpd_file2_init(&Fjb, CC_OEI, 0, 0, 1, "Fme");
88
 
    dpd_file2_mat_init(&Fjb);
89
 
    dpd_file2_mat_rd(&Fjb);
90
 
  }
91
 
  else if(params.ref == 2) { /** UHF **/
92
 
 
93
 
    dpd_file2_init(&LIA, CC_LAMBDA, L_irr, 0, 1, "LIA");
94
 
    dpd_file2_mat_init(&LIA);
95
 
    dpd_file2_mat_rd(&LIA);
96
 
    dpd_file2_init(&Lia, CC_LAMBDA, L_irr, 2, 3, "Lia");
97
 
    dpd_file2_mat_init(&Lia);
98
 
    dpd_file2_mat_rd(&Lia);
99
 
    dpd_file2_init(&FJB, CC_OEI, 0, 0, 1, "FME");
100
 
    dpd_file2_mat_init(&FJB);
101
 
    dpd_file2_mat_rd(&FJB);
102
 
    dpd_file2_init(&Fjb, CC_OEI, 0, 2, 3, "Fme");
103
 
    dpd_file2_mat_init(&Fjb);
104
 
    dpd_file2_mat_rd(&Fjb);
105
 
  
106
 
  }
107
 
 
108
 
  if(params.ref == 1) /** RHF/ROHF **/
109
 
    dpd_buf4_init(&newL2, CC_LAMBDA, L_irr, 2, 7, 2, 7, 0, "New LIJAB");
110
 
  else if(params.ref == 2) /** UHF **/
111
 
    dpd_buf4_init(&newL2, CC_LAMBDA, L_irr, 2, 7, 2, 7, 0, "New LIJAB");
112
 
 
113
 
  if(params.ref == 1 || params.ref == 2) {
114
 
    /* loop over row irreps of LIJAB */
115
 
    for(h=0; h < nirreps; h++) {
116
 
 
117
 
      dpd_buf4_mat_irrep_init(&newL2, h);
118
 
      dpd_buf4_mat_irrep_rd(&newL2, h);
119
 
 
120
 
      /* loop over rows of irrep of LIJAB */
121
 
      for(row=0; row < newL2.params->rowtot[h]; row++) {
122
 
        i = newL2.params->roworb[h][row][0];
123
 
        j = newL2.params->roworb[h][row][1];
124
 
          
125
 
        /* loop over cols of irrep of LIJAB */
126
 
        for(col=0; col < newL2.params->coltot[h^L_irr]; col++) {
127
 
          a = newL2.params->colorb[h^L_irr][col][0];
128
 
          b = newL2.params->colorb[h^L_irr][col][1];
129
 
 
130
 
          I = LIA.params->rowidx[i]; Isym = LIA.params->psym[i];
131
 
          J = FJB.params->rowidx[j]; Jsym = FJB.params->psym[j];
132
 
          A = LIA.params->colidx[a]; Asym = LIA.params->qsym[a];
133
 
          B = FJB.params->colidx[b]; Bsym = FJB.params->qsym[b];
134
 
 
135
 
          if( ((Isym^Asym) == L_irr) && (Jsym == Bsym) )
136
 
            newL2.matrix[h][row][col] += (LIA.matrix[Isym][I][A] *
137
 
                                          FJB.matrix[Jsym][J][B]);
138
 
 
139
 
          J = LIA.params->rowidx[j]; Jsym = LIA.params->psym[j];
140
 
          I = FJB.params->rowidx[i]; Isym = FJB.params->psym[i];
141
 
 
142
 
          if( (Isym == Asym) && ((Jsym^Bsym) == L_irr) )
143
 
            newL2.matrix[h][row][col] += (LIA.matrix[Jsym][J][B] *
144
 
                                          FJB.matrix[Isym][I][A]);
145
 
 
146
 
          I = LIA.params->rowidx[i]; Isym = LIA.params->psym[i];
147
 
          J = FJB.params->rowidx[j]; Jsym = FJB.params->psym[j];
148
 
          B = LIA.params->colidx[b]; Bsym = LIA.params->qsym[b];
149
 
          A = FJB.params->colidx[a]; Asym = FJB.params->qsym[a];
150
 
 
151
 
          if( ((Jsym^Asym) == L_irr) && (Isym == Bsym))
152
 
            newL2.matrix[h][row][col] -= (LIA.matrix[Jsym][J][A] *
153
 
                                          FJB.matrix[Isym][I][B]);
154
 
 
155
 
          J = LIA.params->rowidx[j]; Jsym = LIA.params->psym[j];
156
 
          I = FJB.params->rowidx[i]; Isym = FJB.params->psym[i];
157
 
 
158
 
          if( (Jsym == Asym) && ((Isym^Bsym) == L_irr) )
159
 
            newL2.matrix[h][row][col] -= (LIA.matrix[Isym][I][B] *
160
 
                                          FJB.matrix[Jsym][J][A]);
161
 
        }
162
 
      }
163
 
 
164
 
      dpd_buf4_mat_irrep_wrt(&newL2, h);
165
 
      dpd_buf4_mat_irrep_close(&newL2, h);
166
 
      
167
 
    }
168
 
    dpd_buf4_close(&newL2);
169
 
  }
170
 
 
171
 
  if(params.ref == 1) /** RHF/ROHF **/
172
 
    dpd_buf4_init(&newL2, CC_LAMBDA, L_irr, 2, 7, 2, 7, 0, "New Lijab");
173
 
  else if(params.ref == 2) /** UHF **/
174
 
    dpd_buf4_init(&newL2, CC_LAMBDA, L_irr, 12, 17, 12, 17, 0, "New Lijab");
175
 
 
176
 
  if(params.ref == 1 || params.ref == 2) {
177
 
    for(h=0; h < nirreps; h++) {
178
 
 
179
 
      dpd_buf4_mat_irrep_init(&newL2, h);
180
 
      dpd_buf4_mat_irrep_rd(&newL2, h);
181
 
 
182
 
      for(row=0; row < newL2.params->rowtot[h]; row++) {
183
 
        i = newL2.params->roworb[h][row][0];
184
 
        j = newL2.params->roworb[h][row][1];
185
 
          
186
 
        for(col=0; col < newL2.params->coltot[h^L_irr]; col++) {
187
 
          a = newL2.params->colorb[h^L_irr][col][0];
188
 
          b = newL2.params->colorb[h^L_irr][col][1];
189
 
 
190
 
          I = Lia.params->rowidx[i]; Isym = Lia.params->psym[i];
191
 
          J = Fjb.params->rowidx[j]; Jsym = Fjb.params->psym[j];
192
 
          A = Lia.params->colidx[a]; Asym = Lia.params->qsym[a];
193
 
          B = Fjb.params->colidx[b]; Bsym = Fjb.params->qsym[b];
194
 
 
195
 
          if(((Isym^Asym) == L_irr) && (Jsym == Bsym))
196
 
            newL2.matrix[h][row][col] += (Lia.matrix[Isym][I][A] *
197
 
                                          Fjb.matrix[Jsym][J][B]);
198
 
 
199
 
          J = Lia.params->rowidx[j]; Jsym = Lia.params->psym[j];
200
 
          I = Fjb.params->rowidx[i]; Isym = Fjb.params->psym[i];
201
 
 
202
 
          if((Isym == Asym) && ((Jsym^Bsym) == L_irr))
203
 
            newL2.matrix[h][row][col] += (Lia.matrix[Jsym][J][B] *
204
 
                                          Fjb.matrix[Isym][I][A]);
205
 
 
206
 
          I = Lia.params->rowidx[i]; Isym = Lia.params->psym[i];
207
 
          J = Fjb.params->rowidx[j]; Jsym = Fjb.params->psym[j];
208
 
          B = Lia.params->colidx[b]; Bsym = Lia.params->qsym[b];
209
 
          A = Fjb.params->colidx[a]; Asym = Fjb.params->qsym[a];
210
 
 
211
 
          if(((Jsym^Asym) == L_irr) && (Isym == Bsym))
212
 
            newL2.matrix[h][row][col] -= (Lia.matrix[Jsym][J][A] *
213
 
                                          Fjb.matrix[Isym][I][B]);
214
 
 
215
 
          J = Lia.params->rowidx[j]; Jsym = Lia.params->psym[j];
216
 
          I = Fjb.params->rowidx[i]; Isym = Fjb.params->psym[i];
217
 
 
218
 
          if((Jsym == Asym) && ((Isym^Bsym) == L_irr))
219
 
            newL2.matrix[h][row][col] -= (Lia.matrix[Isym][I][B] *
220
 
                                          Fjb.matrix[Jsym][J][A]);
221
 
        }
222
 
      }
223
 
 
224
 
      dpd_buf4_mat_irrep_wrt(&newL2, h);
225
 
      dpd_buf4_mat_irrep_close(&newL2, h);
226
 
      
227
 
    }
228
 
    dpd_buf4_close(&newL2);
229
 
  }
230
 
 
231
 
  if(params.ref == 1) /** RHF/ROHF **/
232
 
    dpd_buf4_init(&newL2, CC_LAMBDA, L_irr, 0, 5, 0, 5, 0, "New LIjAb");
233
 
  else if(params.ref == 2) /** UHF **/
234
 
    dpd_buf4_init(&newL2, CC_LAMBDA, L_irr, 22, 28, 22, 28, 0, "New LIjAb");
235
 
 
236
 
  if(params.ref == 1 || params.ref == 2) {
237
 
    for(h=0; h < nirreps; h++) {
238
 
 
239
 
      dpd_buf4_mat_irrep_init(&newL2, h);
240
 
      dpd_buf4_mat_irrep_rd(&newL2, h);
241
 
 
242
 
      for(row=0; row < newL2.params->rowtot[h]; row++) {
243
 
        i = newL2.params->roworb[h][row][0];
244
 
        j = newL2.params->roworb[h][row][1];
245
 
          
246
 
        for(col=0; col < newL2.params->coltot[h^L_irr]; col++) {
247
 
          a = newL2.params->colorb[h^L_irr][col][0];
248
 
          b = newL2.params->colorb[h^L_irr][col][1];
249
 
 
250
 
          I = LIA.params->rowidx[i]; Isym = LIA.params->psym[i];
251
 
          J = Fjb.params->rowidx[j]; Jsym = Fjb.params->psym[j];
252
 
          A = LIA.params->colidx[a]; Asym = LIA.params->qsym[a];
253
 
          B = Fjb.params->colidx[b]; Bsym = Fjb.params->qsym[b];
254
 
 
255
 
          if(((Isym^Asym) == L_irr) && (Jsym == Bsym))
256
 
            newL2.matrix[h][row][col] += (LIA.matrix[Isym][I][A] *
257
 
                                          Fjb.matrix[Jsym][J][B]);
258
 
 
259
 
          J = Lia.params->rowidx[j]; Jsym = Lia.params->psym[j];
260
 
          I = FJB.params->rowidx[i]; Isym = FJB.params->psym[i];
261
 
          B = Lia.params->colidx[b]; Bsym = Lia.params->qsym[b];
262
 
          A = FJB.params->colidx[a]; Asym = FJB.params->qsym[a];
263
 
 
264
 
          if((Isym == Asym) && ((Jsym^Bsym) == L_irr))
265
 
            newL2.matrix[h][row][col] += (Lia.matrix[Jsym][J][B] *
266
 
                                          FJB.matrix[Isym][I][A]);
267
 
        }
268
 
      }
269
 
 
270
 
      dpd_buf4_mat_irrep_wrt(&newL2, h);
271
 
      dpd_buf4_mat_irrep_close(&newL2, h);
272
 
      
273
 
    }
274
 
  }
275
 
 
276
 
  if(params.ref == 1 || params.ref == 2) {
277
 
    dpd_buf4_close(&newL2);
278
 
 
279
 
    dpd_file2_mat_close(&FJB);
280
 
    dpd_file2_close(&FJB);
281
 
    dpd_file2_mat_close(&Fjb);
282
 
    dpd_file2_close(&Fjb);
283
 
    dpd_file2_mat_close(&LIA);
284
 
    dpd_file2_close(&LIA);
285
 
    dpd_file2_mat_close(&Lia);
286
 
    dpd_file2_close(&Lia);
287
 
  }
288
 
}