~ubuntu-branches/ubuntu/quantal/psicode/quantal

« back to all changes in this revision

Viewing changes to src/bin/ccenergy/t1.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2006-09-10 14:01:33 UTC
  • Revision ID: james.westby@ubuntu.com-20060910140133-ib2j86trekykfsfv
Tags: upstream-3.2.3
ImportĀ upstreamĀ versionĀ 3.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <stdlib.h>
 
3
#include <libdpd/dpd.h>
 
4
#include <libqt/qt.h>
 
5
#define EXTERN
 
6
#include "globals.h"
 
7
 
 
8
void local_filter_T1(dpdfile2 *T1);
 
9
 
 
10
void t1_build(void)
 
11
{
 
12
  dpdfile2 newtIA, newtia, tIA, tia, fIA, fia;
 
13
  dpdfile2 FAE, Fae, FMI, Fmi, FME, Fme;
 
14
  dpdfile2 dIA, dia;
 
15
  dpdbuf4 tIJAB, tijab, tIjAb, tiJaB;
 
16
  dpdbuf4 C, C_anti, D, F_anti, F, E_anti, E, Z;
 
17
 
 
18
  if(params.ref == 0) { /** RHF **/
 
19
    dpd_file2_init(&fIA, CC_OEI, 0, 0, 1, "fIA");
 
20
    dpd_file2_copy(&fIA, CC_OEI, "New tIA");
 
21
    dpd_file2_close(&fIA);
 
22
 
 
23
    dpd_file2_init(&newtIA, CC_OEI, 0, 0, 1, "New tIA");
 
24
 
 
25
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
26
 
 
27
    dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
 
28
    dpd_contract222(&tIA, &FAE, &newtIA, 0, 0, 1, 1);
 
29
    dpd_file2_close(&FAE);
 
30
 
 
31
    dpd_file2_init(&FMI, CC_OEI, 0, 0, 0, "FMI");
 
32
    dpd_contract222(&FMI, &tIA, &newtIA, 1, 1, -1, 1);
 
33
    dpd_file2_close(&FMI);
 
34
 
 
35
    dpd_file2_close(&tIA); 
 
36
 
 
37
    dpd_file2_init(&FME, CC_OEI, 0, 0, 1, "FME");
 
38
 
 
39
    dpd_buf4_init(&tIjAb, CC_TAMPS, 0, 10, 10, 10, 10, 0, "2 tIAjb - tIBja");
 
40
    dpd_contract422(&tIjAb, &FME, &newtIA, 0, 0, 1, 1);
 
41
    dpd_buf4_close(&tIjAb);
 
42
 
 
43
    dpd_file2_close(&FME);  
 
44
 
 
45
    dpd_buf4_init(&C_anti, CC_CINTS, 0, 10, 10, 10, 10, 0, "C <ia||jb>");
 
46
    dpd_buf4_init(&D, CC_DINTS, 0, 0, 5, 0, 5, 0, "D <ij|ab>");
 
47
 
 
48
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
49
 
 
50
    dpd_dot14(&tIA, &C_anti, &newtIA, 0, 1, -1, 1);
 
51
    dpd_dot13(&tIA, &D, &newtIA, 0, 0, 1, 1);
 
52
 
 
53
    dpd_file2_close(&tIA);  
 
54
 
 
55
    dpd_buf4_close(&C_anti);  
 
56
    dpd_buf4_close(&D);
 
57
 
 
58
    dpd_buf4_init(&Z, CC_TMP0, 0, 10, 0, 10, 0, 0, "Z(ma,mi)");
 
59
    dpd_buf4_init(&F, CC_FINTS, 0, 10, 5, 10, 5, 0, "F 2<ia|bc> - <ia|cb>");
 
60
    dpd_buf4_init(&tIjAb, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb");
 
61
    dpd_contract444(&F, &tIjAb, &Z, 0, 0, 1.0, 0.0);
 
62
    dpd_buf4_close(&tIjAb);
 
63
    dpd_buf4_close(&F);
 
64
    dpd_trace42_13(&Z, &newtIA, 1, 1.0, 1.0);
 
65
    dpd_buf4_close(&Z);
 
66
 
 
67
    dpd_buf4_init(&E, CC_EINTS, 0, 11, 0, 11, 0, 0, "E 2<ai|jk> - <ai|kj>");
 
68
    dpd_buf4_init(&tIjAb, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb");
 
69
    dpd_contract442(&E, &tIjAb, &newtIA, 1, 3, -1, 1);
 
70
    dpd_buf4_close(&E);  
 
71
    dpd_buf4_close(&tIjAb);
 
72
 
 
73
    dpd_file2_copy(&newtIA, CC_OEI, "New tIA Increment");
 
74
    dpd_file2_close(&newtIA);
 
75
 
 
76
    dpd_file2_init(&newtIA, CC_OEI, 0, 0, 1, "New tIA Increment");
 
77
    if(params.local && local.filter_singles) {
 
78
      local_filter_T1(&newtIA);
 
79
    }
 
80
    else {
 
81
      dpd_file2_init(&dIA, CC_OEI, 0, 0, 1, "dIA");
 
82
      dpd_file2_dirprd(&dIA, &newtIA);
 
83
      dpd_file2_close(&dIA);
 
84
    }
 
85
    dpd_file2_close(&newtIA);
 
86
 
 
87
    /* Add the new increment to the old tIA to get the New tIA */
 
88
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
89
    dpd_file2_copy(&tIA, CC_OEI, "New tIA");
 
90
    dpd_file2_close(&tIA);
 
91
    dpd_file2_init(&newtIA, CC_OEI, 0, 0, 1, "New tIA");
 
92
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "New tIA Increment");
 
93
    dpd_file2_axpy(&tIA, &newtIA, 1, 0);
 
94
    dpd_file2_close(&tIA);
 
95
    dpd_file2_close(&newtIA);
 
96
  }
 
97
  else if(params.ref == 1) { /** ROHF **/
 
98
 
 
99
    dpd_file2_init(&fIA, CC_OEI, 0, 0, 1, "fIA");
 
100
    dpd_file2_copy(&fIA, CC_OEI, "New tIA");
 
101
    dpd_file2_close(&fIA);
 
102
 
 
103
    dpd_file2_init(&fia, CC_OEI, 0, 0, 1, "fia");
 
104
    dpd_file2_copy(&fia, CC_OEI, "New tia");
 
105
    dpd_file2_close(&fia);
 
106
 
 
107
    dpd_file2_init(&newtIA, CC_OEI, 0, 0, 1, "New tIA");
 
108
    dpd_file2_init(&newtia, CC_OEI, 0, 0, 1, "New tia");
 
109
 
 
110
 
 
111
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
112
    dpd_file2_init(&tia, CC_OEI, 0, 0, 1, "tia");
 
113
 
 
114
    dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
 
115
    dpd_file2_init(&Fae, CC_OEI, 0, 1, 1, "Fae");
 
116
 
 
117
    dpd_contract222(&tIA, &FAE, &newtIA, 0, 0, 1, 1);
 
118
    dpd_contract222(&tia, &Fae, &newtia, 0, 0, 1, 1);
 
119
 
 
120
    dpd_file2_close(&FAE);  dpd_file2_close(&Fae);
 
121
 
 
122
    dpd_file2_close(&tIA); dpd_file2_close(&tia);
 
123
 
 
124
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
125
    dpd_file2_init(&tia, CC_OEI, 0, 0, 1, "tia");
 
126
 
 
127
    dpd_file2_init(&FMI, CC_OEI, 0, 0, 0, "FMI");
 
128
    dpd_file2_init(&Fmi, CC_OEI, 0, 0, 0, "Fmi");
 
129
 
 
130
    dpd_contract222(&FMI, &tIA, &newtIA, 1, 1, -1, 1);
 
131
    dpd_contract222(&Fmi, &tia, &newtia, 1, 1, -1, 1);
 
132
 
 
133
    dpd_file2_close(&FMI);  dpd_file2_close(&Fmi);
 
134
    dpd_file2_close(&tIA);  dpd_file2_close(&tia);
 
135
 
 
136
    dpd_file2_init(&FME, CC_OEI, 0, 0, 1, "FME");
 
137
    dpd_file2_init(&Fme, CC_OEI, 0, 0, 1, "Fme");
 
138
 
 
139
    dpd_buf4_init(&tIJAB, CC_TAMPS, 0, 0, 5, 2, 7, 0, "tIJAB");
 
140
    dpd_buf4_init(&tijab, CC_TAMPS, 0, 0, 5, 2, 7, 0, "tijab");
 
141
 
 
142
    dpd_dot13(&FME, &tIJAB, &newtIA, 0, 0, 1, 1);
 
143
    dpd_dot13(&Fme, &tijab, &newtia, 0, 0, 1, 1);
 
144
  
 
145
    dpd_buf4_close(&tIJAB);  
 
146
    dpd_buf4_close(&tijab);
 
147
 
 
148
    dpd_buf4_init(&tIjAb, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb");
 
149
 
 
150
    dpd_dot24(&Fme, &tIjAb, &newtIA, 0, 0, 1, 1);
 
151
    dpd_dot13(&FME, &tIjAb, &newtia, 0, 0, 1, 1);
 
152
  
 
153
    dpd_buf4_close(&tIjAb);
 
154
  
 
155
    dpd_file2_close(&FME);  
 
156
    dpd_file2_close(&Fme);
 
157
 
 
158
    dpd_buf4_init(&C_anti, CC_CINTS, 0, 10, 10, 10, 10, 0,
 
159
                  "C <ia||jb>");
 
160
    dpd_buf4_init(&D, CC_DINTS, 0, 0, 5, 0, 5, 0, "D <ij|ab>");
 
161
 
 
162
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
163
    dpd_file2_init(&tia, CC_OEI, 0, 0, 1, "tia");
 
164
 
 
165
    dpd_dot14(&tIA, &C_anti, &newtIA, 0, 1, -1, 1);
 
166
    dpd_dot13(&tia, &D, &newtIA, 0, 0, 1, 1);
 
167
 
 
168
    dpd_dot14(&tia, &C_anti, &newtia, 0, 1, -1, 1);
 
169
    dpd_dot13(&tIA, &D, &newtia, 0, 0, 1, 1);
 
170
 
 
171
    dpd_file2_close(&tIA);  
 
172
    dpd_file2_close(&tia);
 
173
 
 
174
    dpd_buf4_close(&C_anti);  
 
175
    dpd_buf4_close(&D);
 
176
 
 
177
    dpd_buf4_init(&F_anti, CC_FINTS, 0, 10, 7, 10, 5, 1, "F <ia|bc>");
 
178
    dpd_buf4_init(&tIJAB, CC_TAMPS, 0, 0, 7, 2, 7, 0, "tIJAB");
 
179
    dpd_buf4_init(&tijab, CC_TAMPS, 0, 0, 7, 2, 7, 0, "tijab");
 
180
 
 
181
    dpd_contract442(&tIJAB, &F_anti, &newtIA, 1, 1, 1, 1);
 
182
    dpd_contract442(&tijab, &F_anti, &newtia, 1, 1, 1, 1);
 
183
 
 
184
    dpd_buf4_close(&tIJAB);
 
185
    dpd_buf4_close(&tijab);
 
186
    dpd_buf4_close(&F_anti);
 
187
 
 
188
    dpd_buf4_init(&F, CC_FINTS, 0, 10, 5, 10, 5, 0, "F <ia|bc>");
 
189
    dpd_buf4_init(&tIjAb, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb");
 
190
    dpd_buf4_init(&tiJaB, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tiJaB");
 
191
 
 
192
    dpd_contract442(&tiJaB, &F, &newtIA, 1, 1, 1, 1);
 
193
    dpd_contract442(&tIjAb, &F, &newtia, 1, 1, 1, 1);
 
194
  
 
195
    dpd_buf4_close(&F);  
 
196
    dpd_buf4_close(&tIjAb);  
 
197
    dpd_buf4_close(&tiJaB);
 
198
 
 
199
    dpd_buf4_init(&E_anti, CC_EINTS, 0, 11, 2, 11, 0, 1, "E <ai|jk>");
 
200
    dpd_buf4_init(&tIJAB, CC_TAMPS, 0, 2, 5, 2, 7, 0, "tIJAB");
 
201
    dpd_buf4_init(&tijab, CC_TAMPS, 0, 2, 5, 2, 7, 0, "tijab");
 
202
 
 
203
    dpd_contract442(&E_anti, &tIJAB, &newtIA, 1, 3, -1, 1);
 
204
    dpd_contract442(&E_anti, &tijab, &newtia, 1, 3, -1, 1);
 
205
 
 
206
    dpd_buf4_close(&E_anti);  
 
207
    dpd_buf4_close(&tIJAB);  
 
208
    dpd_buf4_close(&tijab);
 
209
  
 
210
    dpd_buf4_init(&E, CC_EINTS, 0, 11, 0, 11, 0, 0, "E <ai|jk>");
 
211
    dpd_buf4_init(&tIjAb, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb");
 
212
    dpd_buf4_init(&tiJaB, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tiJaB");
 
213
 
 
214
    dpd_contract442(&E, &tiJaB, &newtIA, 1, 3, -1, 1);
 
215
    dpd_contract442(&E, &tIjAb, &newtia, 1, 3, -1, 1);
 
216
 
 
217
    dpd_buf4_close(&E);  
 
218
    dpd_buf4_close(&tIjAb);  
 
219
    dpd_buf4_close(&tiJaB);
 
220
 
 
221
    dpd_file2_init(&dIA, CC_OEI, 0, 0, 1, "dIA");
 
222
    dpd_file2_dirprd(&dIA, &newtIA);
 
223
    dpd_file2_close(&dIA);
 
224
 
 
225
    dpd_file2_init(&dia, CC_OEI, 0, 0, 1, "dia");
 
226
    dpd_file2_dirprd(&dia, &newtia);
 
227
    dpd_file2_close(&dia);
 
228
 
 
229
    dpd_file2_close(&newtIA);  dpd_file2_close(&newtia);
 
230
  }
 
231
  else if(params.ref == 2) { /*** UHF ***/
 
232
 
 
233
    dpd_file2_init(&fIA, CC_OEI, 0, 0, 1, "fIA");
 
234
    dpd_file2_copy(&fIA, CC_OEI, "New tIA");
 
235
    dpd_file2_close(&fIA);
 
236
 
 
237
    dpd_file2_init(&fia, CC_OEI, 0, 2, 3, "fia");
 
238
    dpd_file2_copy(&fia, CC_OEI, "New tia");
 
239
    dpd_file2_close(&fia);
 
240
 
 
241
    dpd_file2_init(&newtIA, CC_OEI, 0, 0, 1, "New tIA");
 
242
    dpd_file2_init(&newtia, CC_OEI, 0, 2, 3, "New tia");
 
243
 
 
244
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
245
    dpd_file2_init(&tia, CC_OEI, 0, 2, 3, "tia");
 
246
 
 
247
    dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
 
248
    dpd_contract222(&tIA, &FAE, &newtIA, 0, 0, 1, 1);
 
249
    dpd_file2_close(&FAE);  
 
250
 
 
251
    dpd_file2_init(&Fae, CC_OEI, 0, 3, 3, "Fae");
 
252
    dpd_contract222(&tia, &Fae, &newtia, 0, 0, 1, 1);
 
253
    dpd_file2_close(&Fae);
 
254
 
 
255
    dpd_file2_init(&FMI, CC_OEI, 0, 0, 0, "FMI");
 
256
    dpd_contract222(&FMI, &tIA, &newtIA, 1, 1, -1, 1);
 
257
    dpd_file2_close(&FMI);  
 
258
 
 
259
    dpd_file2_init(&Fmi, CC_OEI, 0, 2, 2, "Fmi");
 
260
    dpd_contract222(&Fmi, &tia, &newtia, 1, 1, -1, 1);
 
261
    dpd_file2_close(&Fmi);
 
262
 
 
263
    dpd_file2_close(&tIA);  
 
264
    dpd_file2_close(&tia);
 
265
 
 
266
    dpd_file2_init(&FME, CC_OEI, 0, 0, 1, "FME");
 
267
    dpd_file2_init(&Fme, CC_OEI, 0, 2, 3, "Fme");
 
268
 
 
269
 
 
270
    dpd_buf4_init(&tIJAB, CC_TAMPS, 0, 0, 5, 2, 7, 0, "tIJAB");
 
271
    dpd_dot13(&FME, &tIJAB, &newtIA, 0, 0, 1, 1);
 
272
    dpd_buf4_close(&tIJAB);  
 
273
 
 
274
    dpd_buf4_init(&tijab, CC_TAMPS, 0, 10, 15, 12, 17, 0, "tijab");
 
275
    dpd_dot13(&Fme, &tijab, &newtia, 0, 0, 1, 1);
 
276
    dpd_buf4_close(&tijab);
 
277
 
 
278
    dpd_buf4_init(&tIjAb, CC_TAMPS, 0, 22, 28, 22, 28, 0, "tIjAb");
 
279
    dpd_dot24(&Fme, &tIjAb, &newtIA, 0, 0, 1, 1);
 
280
    dpd_dot13(&FME, &tIjAb, &newtia, 0, 0, 1, 1);
 
281
    dpd_buf4_close(&tIjAb);
 
282
  
 
283
    dpd_file2_close(&FME);  
 
284
    dpd_file2_close(&Fme);
 
285
 
 
286
 
 
287
 
 
288
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
289
    dpd_file2_init(&tia, CC_OEI, 0, 2, 3, "tia");
 
290
 
 
291
    dpd_buf4_init(&C, CC_CINTS, 0, 20, 20, 20, 20, 0, "C <IA||JB>");
 
292
    dpd_dot14(&tIA, &C, &newtIA, 0, 1, -1, 1);
 
293
    dpd_buf4_close(&C);
 
294
 
 
295
    dpd_buf4_init(&C, CC_CINTS, 0, 30, 30, 30, 30, 0, "C <ia||jb>");
 
296
    dpd_dot14(&tia, &C, &newtia, 0, 1, -1, 1);
 
297
    dpd_buf4_close(&C);
 
298
 
 
299
    dpd_buf4_init(&D, CC_DINTS, 0, 23, 29, 23, 29, 0, "D <iJ|aB>");
 
300
    dpd_dot13(&tia, &D, &newtIA, 0, 0, 1, 1);
 
301
    dpd_buf4_close(&D);
 
302
 
 
303
    dpd_buf4_init(&D, CC_DINTS, 0, 22, 28, 22, 28, 0, "D <Ij|Ab>");
 
304
    dpd_dot13(&tIA, &D, &newtia, 0, 0, 1, 1);
 
305
    dpd_buf4_close(&D);
 
306
 
 
307
    dpd_file2_close(&tIA);  
 
308
    dpd_file2_close(&tia);
 
309
 
 
310
 
 
311
    dpd_buf4_init(&F, CC_FINTS, 0, 20, 7, 20, 5, 1, "F <IA|BC>");
 
312
    dpd_buf4_init(&tIJAB, CC_TAMPS, 0, 0, 7, 2, 7, 0, "tIJAB");
 
313
    dpd_contract442(&tIJAB, &F, &newtIA, 1, 1, 1, 1);
 
314
    dpd_buf4_close(&tIJAB);
 
315
    dpd_buf4_close(&F);
 
316
 
 
317
    dpd_buf4_init(&F, CC_FINTS, 0, 30, 17, 30, 15, 1, "F <ia|bc>");
 
318
    dpd_buf4_init(&tijab, CC_TAMPS, 0, 10, 17, 12, 17, 0, "tijab");
 
319
    dpd_contract442(&tijab, &F, &newtia, 1, 1, 1, 1);
 
320
    dpd_buf4_close(&tijab);
 
321
    dpd_buf4_close(&F);
 
322
 
 
323
    dpd_buf4_init(&F, CC_FINTS, 0, 28, 26, 28, 26, 0, "F <Ab|Ci>");
 
324
    dpd_buf4_init(&tIjAb, CC_TAMPS, 0, 22, 28, 22, 28, 0, "tIjAb");
 
325
    dpd_contract442(&tIjAb, &F, &newtIA, 0, 2, 1, 1);
 
326
    dpd_buf4_close(&tIjAb);
 
327
    dpd_buf4_close(&F);  
 
328
  
 
329
    dpd_buf4_init(&F, CC_FINTS, 0, 24, 28, 24, 28, 0, "F <Ia|Bc>");
 
330
    dpd_buf4_init(&tIjAb, CC_TAMPS, 0, 22, 28, 22, 28, 0, "tIjAb");
 
331
    dpd_contract442(&tIjAb, &F, &newtia, 1, 1, 1, 1);
 
332
    dpd_buf4_close(&tIjAb);  
 
333
    dpd_buf4_close(&F);  
 
334
 
 
335
 
 
336
 
 
337
    dpd_buf4_init(&E, CC_EINTS, 0, 21, 2, 21, 0, 1, "E <AI|JK>");
 
338
    dpd_buf4_init(&tIJAB, CC_TAMPS, 0, 2, 5, 2, 7, 0, "tIJAB");
 
339
    dpd_contract442(&E, &tIJAB, &newtIA, 1, 3, -1, 1);
 
340
    dpd_buf4_close(&E);  
 
341
 
 
342
    dpd_buf4_init(&E, CC_EINTS, 0, 31, 12, 31, 10, 1, "E <ai|jk>");
 
343
    dpd_buf4_init(&tijab, CC_TAMPS, 0, 12, 15, 12, 17, 0, "tijab");
 
344
    dpd_contract442(&E, &tijab, &newtia, 1, 3, -1, 1);
 
345
    dpd_buf4_close(&E);  
 
346
 
 
347
    dpd_buf4_init(&E, CC_EINTS, 0, 22, 24, 22, 24, 0, "E <Ij|Ka>");
 
348
    dpd_buf4_init(&tIjAb, CC_TAMPS, 0, 22, 28, 22, 28, 0, "tIjAb");
 
349
    dpd_contract442(&E, &tIjAb, &newtIA, 2, 2, -1, 1);
 
350
    dpd_buf4_close(&E);  
 
351
    dpd_buf4_close(&tIjAb);  
 
352
 
 
353
    dpd_buf4_init(&E, CC_EINTS, 0, 23, 27, 23, 27, 0, "E <iJ|kA>");
 
354
    dpd_buf4_init(&tIjAb, CC_TAMPS, 0, 23, 29, 23, 29, 0, "tiJaB");
 
355
    dpd_contract442(&E, &tIjAb, &newtia, 2, 2, -1, 1);
 
356
    dpd_buf4_close(&E);  
 
357
    dpd_buf4_close(&tIjAb);  
 
358
 
 
359
 
 
360
    dpd_file2_init(&dIA, CC_OEI, 0, 0, 1, "dIA");
 
361
    dpd_file2_dirprd(&dIA, &newtIA);
 
362
    dpd_file2_close(&dIA);
 
363
 
 
364
    dpd_file2_init(&dia, CC_OEI, 0, 2, 3, "dia");
 
365
    dpd_file2_dirprd(&dia, &newtia);
 
366
    dpd_file2_close(&dia);
 
367
 
 
368
    dpd_file2_close(&newtIA);  
 
369
    dpd_file2_close(&newtia);
 
370
 
 
371
  }
 
372
}