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

« back to all changes in this revision

Viewing changes to src/bin/ccenergy/FT2.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 <stdlib.h>
3
 
#include <libdpd/dpd.h>
4
 
#include <libpsio/psio.h>
5
 
#include <libqt/qt.h>
6
 
#define EXTERN
7
 
#include "globals.h"
8
 
 
9
 
void FT2(void)
10
 
{
11
 
  dpdfile2 tIA, tia, t1;
12
 
  dpdbuf4 newtIJAB, newtijab, newtIjAb, t2, t2a, t2b;
13
 
  dpdbuf4 F_anti, F;
14
 
  dpdbuf4 Z, X;
15
 
  int Gie, Gij, Gab, nrows, ncols, nlinks, Gi, Ge, Gj, i, I;
16
 
 
17
 
  if(params.ref == 0) { /** RHF **/
18
 
 
19
 
/*     dpd_buf4_init(&newtIjAb, CC_TAMPS, 0, 0, 5, 0, 5, 0, "New tIjAb"); */
20
 
 
21
 
/*     dpd_buf4_init(&Z, CC_TMP0, 0, 0, 5, 0, 5, 0, "Z1(ij,ab)"); */
22
 
/*     dpd_buf4_init(&F, CC_FINTS, 0, 11, 5, 11, 5, 0, "F <ai|bc>"); */
23
 
/*     dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA"); */
24
 
/*     dpd_contract244(&tIA, &F, &Z, 1, 0, 0, 1, 0); */
25
 
/*     dpd_file2_close(&tIA);  */
26
 
/*     dpd_buf4_close(&F); */
27
 
 
28
 
/*     dpd_buf4_sort(&Z, CC_TMP0, qpsr, 0, 5, "Z2(ji,ba)"); */
29
 
/*     dpd_buf4_axpy(&Z, &newtIjAb, 1.0); */
30
 
/*     dpd_buf4_close(&Z); */
31
 
/*     dpd_buf4_init(&Z, CC_TMP0, 0, 0, 5, 0, 5, 0, "Z2(ji,ba)"); */
32
 
/*     dpd_buf4_axpy(&Z, &newtIjAb, 1.0); */
33
 
/*     dpd_buf4_close(&Z); */
34
 
 
35
 
/*     dpd_buf4_close(&newtIjAb); */
36
 
 
37
 
    /* t(ij,ab) <-- t(j,e) * <ie|ab> + t(i,e) * <je|ba> */
38
 
    /* OOC code added 3/23/05, TDC */
39
 
    dpd_buf4_init(&X, CC_TMP0, 0, 0, 5, 0, 5, 0, "X(Ij,Ab)");
40
 
    dpd_buf4_init(&F, CC_FINTS, 0, 10, 5, 10, 5, 0, "F <ia|bc>");
41
 
    dpd_file2_init(&t1, CC_OEI, 0, 0, 1, "tIA");
42
 
    dpd_file2_mat_init(&t1);
43
 
    dpd_file2_mat_rd(&t1);
44
 
    for(Gie=0; Gie < moinfo.nirreps; Gie++) { 
45
 
      Gab = Gie; /* F is totally symmetric */
46
 
      Gij = Gab; /* T2 is totally symmetric */
47
 
      dpd_buf4_mat_irrep_init(&X, Gij);
48
 
      ncols = F.params->coltot[Gie];
49
 
 
50
 
      for(Gi=0; Gi < moinfo.nirreps; Gi++) {
51
 
        Gj = Ge = Gi^Gie; /* T1 is totally symmetric */
52
 
 
53
 
        nlinks = moinfo.virtpi[Ge];
54
 
        nrows = moinfo.occpi[Gj];
55
 
 
56
 
        dpd_buf4_mat_irrep_init_block(&F, Gie, nlinks);
57
 
 
58
 
        for(i=0; i < moinfo.occpi[Gi]; i++) {
59
 
          I = F.params->poff[Gi] + i;
60
 
          dpd_buf4_mat_irrep_rd_block(&F, Gie, F.row_offset[Gie][I], nlinks);
61
 
 
62
 
          if(nrows && ncols && nlinks)
63
 
            C_DGEMM('n','n',nrows,ncols,nlinks,1.0,t1.matrix[Gj][0],nlinks,F.matrix[Gie][0],ncols,
64
 
                    0.0,X.matrix[Gij][X.row_offset[Gij][I]],ncols);
65
 
        }
66
 
 
67
 
        dpd_buf4_mat_irrep_close_block(&F, Gie, nlinks);
68
 
      }
69
 
 
70
 
      dpd_buf4_mat_irrep_wrt(&X, Gij);
71
 
      dpd_buf4_mat_irrep_close(&X, Gij);
72
 
    }
73
 
    dpd_file2_mat_close(&t1);
74
 
    dpd_file2_close(&t1);
75
 
    dpd_buf4_close(&F);
76
 
    dpd_buf4_init(&t2, CC_TAMPS, 0, 0, 5, 0, 5, 0, "New tIjAb");
77
 
    dpd_buf4_axpy(&X, &t2, 1);
78
 
    dpd_buf4_close(&t2);
79
 
    dpd_buf4_sort_axpy(&X, CC_TAMPS, qpsr, 0, 5, "New tIjAb", 1);
80
 
    dpd_buf4_close(&X);
81
 
  }
82
 
  else if(params.ref == 1) { /** ROHF **/
83
 
 
84
 
    dpd_buf4_init(&newtIJAB, CC_TAMPS, 0, 0, 7, 2, 7, 0, "New tIJAB");
85
 
    dpd_buf4_init(&newtijab, CC_TAMPS, 0, 0, 7, 2, 7, 0, "New tijab");
86
 
    dpd_buf4_init(&newtIjAb, CC_TAMPS, 0, 0, 5, 0, 5, 0, "New tIjAb");
87
 
 
88
 
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
89
 
    dpd_file2_init(&tia, CC_OEI, 0, 0, 1, "tia");
90
 
 
91
 
    /*** AA ***/
92
 
 
93
 
    dpd_buf4_init(&F_anti, CC_FINTS, 0, 10, 7, 10, 5, 1, "F <ia|bc>");
94
 
    dpd_buf4_init(&t2, CC_TMP0, 0, 0, 7, 0, 7, 0, "T (IJ,A>B)");
95
 
    dpd_contract424(&F_anti, &tIA, &t2, 1, 1, 1, 1, 0);
96
 
    dpd_buf4_sort(&t2, CC_TMP0, qprs, 0, 7, "T (JI,A>B)");
97
 
    dpd_buf4_close(&t2);
98
 
    dpd_buf4_init(&t2a, CC_TMP0, 0, 0, 7, 0, 7, 0, "T (IJ,A>B)");
99
 
    dpd_buf4_init(&t2b, CC_TMP0, 0, 0, 7, 0, 7, 0, "T (JI,A>B)");
100
 
    dpd_buf4_axpy(&t2b, &t2a, -1);
101
 
    dpd_buf4_axpy(&t2a, &newtIJAB, 1);
102
 
    dpd_buf4_close(&t2b);
103
 
    dpd_buf4_close(&t2a);
104
 
    dpd_buf4_close(&F_anti);
105
 
 
106
 
    /*** BB ***/
107
 
 
108
 
    dpd_buf4_init(&F_anti, CC_FINTS, 0, 10, 7, 10, 5, 1, "F <ia|bc>");
109
 
    dpd_buf4_init(&t2, CC_TMP0, 0, 0, 7, 0, 7, 0, "T (IJ,A>B)");
110
 
    dpd_contract424(&F_anti, &tia, &t2, 1, 1, 1, 1, 0);
111
 
    dpd_buf4_sort(&t2, CC_TMP0, qprs, 0, 7, "T (JI,A>B)");
112
 
    dpd_buf4_close(&t2);
113
 
    dpd_buf4_init(&t2a, CC_TMP0, 0, 0, 7, 0, 7, 0, "T (IJ,A>B)");
114
 
    dpd_buf4_init(&t2b, CC_TMP0, 0, 0, 7, 0, 7, 0, "T (JI,A>B)");
115
 
    dpd_buf4_axpy(&t2b, &t2a, -1);
116
 
    dpd_buf4_axpy(&t2a, &newtijab, 1);
117
 
    dpd_buf4_close(&t2b);
118
 
    dpd_buf4_close(&t2a);
119
 
    dpd_buf4_close(&F_anti);
120
 
 
121
 
    /*** AB ***/
122
 
 
123
 
    dpd_buf4_init(&F, CC_FINTS, 0, 10, 5, 10, 5, 0, "F <ia|bc>");
124
 
    dpd_contract424(&F, &tia, &newtIjAb, 1, 1, 1, 1, 1);
125
 
    dpd_buf4_close(&F);
126
 
    dpd_buf4_init(&F, CC_FINTS, 0, 11, 5, 11, 5, 0, "F <ai|bc>");
127
 
    dpd_contract244(&tIA, &F, &newtIjAb, 1, 0, 0, 1, 1);
128
 
    dpd_buf4_close(&F);
129
 
 
130
 
    dpd_file2_close(&tIA); 
131
 
    dpd_file2_close(&tia);
132
 
 
133
 
    dpd_buf4_close(&newtIJAB);
134
 
    dpd_buf4_close(&newtijab);
135
 
    dpd_buf4_close(&newtIjAb);
136
 
  }
137
 
  else if(params.ref == 2) { /*** UHF ***/
138
 
 
139
 
    dpd_buf4_init(&newtIJAB, CC_TAMPS, 0, 0, 7, 2, 7, 0, "New tIJAB");
140
 
    dpd_buf4_init(&newtijab, CC_TAMPS, 0, 10, 17, 12, 17, 0, "New tijab");
141
 
    dpd_buf4_init(&newtIjAb, CC_TAMPS, 0, 22, 28, 22, 28, 0, "New tIjAb");
142
 
 
143
 
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
144
 
    dpd_file2_init(&tia, CC_OEI, 0, 2, 3, "tia");
145
 
 
146
 
    /*** AA ***/
147
 
 
148
 
    dpd_buf4_init(&F, CC_FINTS, 0, 20, 7, 20, 5, 1, "F <IA|BC>");
149
 
    dpd_buf4_init(&t2, CC_TMP0, 0, 0, 7, 0, 7, 0, "T (IJ,A>B)");
150
 
    dpd_contract424(&F, &tIA, &t2, 1, 1, 1, 1, 0);
151
 
    dpd_buf4_sort(&t2, CC_TMP0, qprs, 0, 7, "T (JI,A>B)");
152
 
    dpd_buf4_close(&t2);
153
 
    dpd_buf4_init(&t2a, CC_TMP0, 0, 0, 7, 0, 7, 0, "T (IJ,A>B)");
154
 
    dpd_buf4_init(&t2b, CC_TMP0, 0, 0, 7, 0, 7, 0, "T (JI,A>B)");
155
 
    dpd_buf4_axpy(&t2b, &t2a, -1);
156
 
    dpd_buf4_axpy(&t2a, &newtIJAB, 1);
157
 
    dpd_buf4_close(&t2b);
158
 
    dpd_buf4_close(&t2a);
159
 
    dpd_buf4_close(&F);
160
 
 
161
 
    /*** BB ***/
162
 
 
163
 
    dpd_buf4_init(&F, CC_FINTS, 0, 30, 17, 30, 15, 1, "F <ia|bc>");
164
 
    dpd_buf4_init(&t2, CC_TMP0, 0, 10, 17, 10, 17, 0, "T (ij,a>b)");
165
 
    dpd_contract424(&F, &tia, &t2, 1, 1, 1, 1, 0);
166
 
    dpd_buf4_sort(&t2, CC_TMP0, qprs, 10, 17, "T (ji,a>b)");
167
 
    dpd_buf4_close(&t2);
168
 
    dpd_buf4_init(&t2a, CC_TMP0, 0, 10, 17, 10, 17, 0, "T (ij,a>b)");
169
 
    dpd_buf4_init(&t2b, CC_TMP0, 0, 10, 17, 10, 17, 0, "T (ji,a>b)");
170
 
    dpd_buf4_axpy(&t2b, &t2a, -1);
171
 
    dpd_buf4_axpy(&t2a, &newtijab, 1);
172
 
    dpd_buf4_close(&t2b);
173
 
    dpd_buf4_close(&t2a);
174
 
    dpd_buf4_close(&F);
175
 
 
176
 
    /*** AB ***/
177
 
 
178
 
    dpd_buf4_init(&F, CC_FINTS, 0, 24, 28, 24, 28, 0, "F <Ia|Bc>");
179
 
    dpd_contract424(&F, &tia, &newtIjAb, 1, 1, 1, 1, 1);
180
 
    dpd_buf4_close(&F);
181
 
    dpd_buf4_init(&F, CC_FINTS, 0, 28, 26, 28, 26, 0, "F <Ab|Ci>");
182
 
    dpd_contract244(&tIA, &F, &newtIjAb, 1, 2, 0, 1, 1);
183
 
    dpd_buf4_close(&F);
184
 
 
185
 
    dpd_file2_close(&tIA); 
186
 
    dpd_file2_close(&tia);
187
 
 
188
 
    dpd_buf4_close(&newtIJAB);
189
 
    dpd_buf4_close(&newtijab);
190
 
    dpd_buf4_close(&newtIjAb);
191
 
 
192
 
  }
193
 
 
194
 
}