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

« back to all changes in this revision

Viewing changes to src/bin/ccresponse/pertbar.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 <string.h>
3
 
#include <libdpd/dpd.h>
4
 
#define EXTERN
5
 
#include "globals.h"
6
 
 
7
 
/* pertbar(): Constructs the components of the similarity-transformed
8
 
** one-electron property operator. 
9
 
**
10
 
** NB: For antisymmetric quantities, we must be careful in
11
 
** contractions involving the bare MO integrals.  This only affects
12
 
** the leading term of XXBAR_IA (which, I admit, is poorly named and
13
 
** probably should really be called XXBAR_AI), where I copy the XXIA
14
 
** integrals into place with a -1 sign.
15
 
**
16
 
** TDC, 10/05
17
 
*/
18
 
 
19
 
void pertbar(char *pert, int irrep_x, int irrep_y, int irrep_z, int anti)
20
 
{
21
 
  int irrep, i;
22
 
  dpdfile2 fbar1, f, t1, z;
23
 
  dpdbuf4 t2, fbar2;
24
 
  char lbl[32], prefix1[32], prefix2[32], prefix3[32];
25
 
 
26
 
  for(i=0; i < 3; i++) {
27
 
    if(i==0) {
28
 
      irrep = irrep_x;
29
 
      sprintf(prefix1, "%s_%1s", pert, "X");
30
 
      sprintf(prefix2, "%sBAR_%1s", pert, "X");
31
 
      sprintf(prefix3, "z_%1s", "X");
32
 
    }
33
 
    else if(i==1) {
34
 
      irrep = irrep_y;
35
 
      sprintf(prefix1, "%s_%1s", pert, "Y");
36
 
      sprintf(prefix2, "%sBAR_%1s", pert, "Y");
37
 
      sprintf(prefix3, "z_%1s", "Y");
38
 
    }
39
 
    else if(i==2) {
40
 
      irrep = irrep_z;
41
 
      sprintf(prefix1, "%s_%1s", pert, "Z");
42
 
      sprintf(prefix2, "%sBAR_%1s", pert, "Z");
43
 
      sprintf(prefix3, "z_%1s", "Z");
44
 
    }
45
 
 
46
 
    /** XXBAR_ME **/
47
 
    sprintf(lbl, "%s_IA", prefix1);
48
 
    dpd_file2_init(&f, CC_OEI, irrep, 0, 1, lbl);
49
 
    sprintf(lbl, "%s_ME", prefix2);
50
 
    dpd_file2_copy(&f, CC_OEI, lbl);
51
 
    dpd_file2_close(&f);
52
 
 
53
 
    /** XXBAR_MI **/
54
 
    sprintf(lbl, "%s_IJ", prefix1);
55
 
    dpd_file2_init(&f, CC_OEI, irrep, 0, 0, lbl);
56
 
    sprintf(lbl, "%s_MI", prefix2);
57
 
    dpd_file2_copy(&f, CC_OEI, lbl);
58
 
    dpd_file2_close(&f);
59
 
 
60
 
    sprintf(lbl, "%s_MI", prefix2);
61
 
    dpd_file2_init(&fbar1, CC_OEI, irrep, 0, 0, lbl);
62
 
    sprintf(lbl, "%s_IA", prefix1);
63
 
    dpd_file2_init(&f, CC_OEI, irrep, 0, 1, lbl);
64
 
    dpd_file2_init(&t1, CC_OEI, 0, 0, 1, "tIA");
65
 
    dpd_contract222(&f, &t1, &fbar1, 0, 0, 1, 1);
66
 
    dpd_file2_close(&t1);
67
 
    dpd_file2_close(&f);
68
 
    dpd_file2_close(&fbar1);
69
 
 
70
 
    /** XXBAR_AE **/
71
 
    sprintf(lbl, "%s_AB", prefix1);
72
 
    dpd_file2_init(&f, CC_OEI, irrep, 1, 1, lbl);
73
 
    sprintf(lbl, "%s_AE", prefix2);
74
 
    dpd_file2_copy(&f, CC_OEI, lbl);
75
 
    dpd_file2_close(&f);
76
 
 
77
 
    sprintf(lbl, "%s_AE", prefix2);
78
 
    dpd_file2_init(&fbar1, CC_OEI, irrep, 1, 1, lbl);
79
 
    sprintf(lbl, "%s_IA", prefix1);
80
 
    dpd_file2_init(&f, CC_OEI, irrep, 0, 1, lbl);
81
 
    dpd_file2_init(&t1, CC_OEI, 0, 0, 1, "tIA");
82
 
    dpd_contract222(&t1, &f, &fbar1, 1, 1, -1, 1);
83
 
    dpd_file2_close(&t1);
84
 
    dpd_file2_close(&f);
85
 
    dpd_file2_close(&fbar1);
86
 
 
87
 
    /** XXBAR_IA **/
88
 
    sprintf(lbl, "%s_IA", prefix1);
89
 
    dpd_file2_init(&f, CC_OEI, irrep, 0, 1, lbl);
90
 
    sprintf(lbl, "%s_IA", prefix2);
91
 
    dpd_file2_copy(&f, CC_OEI, lbl);
92
 
    dpd_file2_close(&f);
93
 
 
94
 
    sprintf(lbl, "%s_IA", prefix2);
95
 
    dpd_file2_init(&fbar1, CC_OEI, irrep, 0, 1, lbl);
96
 
    if(anti) dpd_file2_scm(&fbar1, -1);
97
 
 
98
 
    sprintf(lbl, "%s_AB", prefix1);
99
 
    dpd_file2_init(&f, CC_OEI, irrep, 1, 1, lbl);
100
 
    dpd_file2_init(&t1, CC_OEI, 0, 0, 1, "tIA");
101
 
    dpd_contract222(&t1, &f, &fbar1, 0, 0, 1, 1);
102
 
    dpd_file2_close(&t1);
103
 
    dpd_file2_close(&f);
104
 
 
105
 
    sprintf(lbl, "%s_IJ", prefix1);
106
 
    dpd_file2_init(&f, CC_OEI, irrep, 0, 0, lbl);
107
 
    dpd_file2_init(&t1, CC_OEI, 0, 0, 1, "tIA");
108
 
    dpd_contract222(&f, &t1, &fbar1, 1, 1, -1, 1);
109
 
    dpd_file2_close(&t1);
110
 
    dpd_file2_close(&f);
111
 
 
112
 
    sprintf(lbl, "%s_IA", prefix1);
113
 
    dpd_file2_init(&f, CC_OEI, irrep, 0, 1, lbl);
114
 
    dpd_buf4_init(&t2, CC_TAMPS, 0, 10, 10, 10, 10, 0, "2 tIAjb - tIBja");
115
 
    dpd_contract422(&t2, &f, &fbar1, 0, 0, 1, 1);
116
 
    dpd_buf4_close(&t2);
117
 
    dpd_file2_close(&f);
118
 
 
119
 
    sprintf(lbl, "%s_MI", prefix3);
120
 
    dpd_file2_init(&z, CC_TMP0, irrep, 0, 0, lbl);
121
 
    dpd_file2_init(&t1, CC_OEI, 0, 0, 1, "tIA");
122
 
    sprintf(lbl, "%s_IA", prefix1);
123
 
    dpd_file2_init(&f, CC_OEI, irrep, 0, 1, lbl);
124
 
    dpd_contract222(&f, &t1, &z, 0, 0, 1, 0);
125
 
    dpd_file2_close(&f);
126
 
    dpd_contract222(&z, &t1, &fbar1, 1, 1, -1, 1);
127
 
    dpd_file2_close(&t1);
128
 
    dpd_file2_close(&z);
129
 
 
130
 
    dpd_file2_close(&fbar1);
131
 
 
132
 
    /** LBAR_MbIj **/
133
 
    sprintf(lbl, "%s_MbIj", prefix2);
134
 
    dpd_buf4_init(&fbar2, CC_LR, irrep, 10, 0, 10, 0, 0, lbl);
135
 
    sprintf(lbl, "%s_IA", prefix1);
136
 
    dpd_file2_init(&f, CC_OEI, irrep, 0, 1, lbl);
137
 
    dpd_buf4_init(&t2, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb");
138
 
    dpd_contract244(&f, &t2, &fbar2, 1, 2, 0, 1, 0);
139
 
    dpd_buf4_close(&t2);
140
 
    dpd_file2_close(&f);
141
 
    dpd_buf4_close(&fbar2);
142
 
 
143
 
    /** LBAR_IjAb **/
144
 
    sprintf(lbl, "%s_IjAb", prefix2);
145
 
    dpd_buf4_init(&fbar2, CC_LR, irrep, 0, 5, 0, 5, 0, lbl);
146
 
 
147
 
    sprintf(lbl, "%s_AB", prefix1);
148
 
    dpd_file2_init(&f, CC_OEI, irrep, 1, 1, lbl);
149
 
    dpd_buf4_init(&t2, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb");
150
 
    dpd_contract424(&t2, &f, &fbar2, 3, 1, 0, 1, 0);
151
 
    dpd_contract244(&f, &t2, &fbar2, 1, 2, 1, 1, 1);
152
 
    dpd_buf4_close(&t2);
153
 
    dpd_file2_close(&f);
154
 
 
155
 
    sprintf(lbl, "%s_IJ", prefix1);
156
 
    dpd_file2_init(&f, CC_OEI, irrep, 0, 0, lbl);
157
 
    dpd_buf4_init(&t2, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb");
158
 
    dpd_contract424(&t2, &f, &fbar2, 1, 0, 1, -1, 1);
159
 
    dpd_contract244(&f, &t2, &fbar2, 0, 0, 0, -1, 1);
160
 
    dpd_buf4_close(&t2);
161
 
    dpd_file2_close(&f);
162
 
 
163
 
    sprintf(lbl, "%s_AE", prefix3);
164
 
    dpd_file2_init(&z, CC_TMP0, irrep, 1, 1, lbl);
165
 
    dpd_file2_init(&t1, CC_OEI, 0, 0, 1, "tIA");
166
 
    sprintf(lbl, "%s_IA", prefix1);
167
 
    dpd_file2_init(&f, CC_OEI, irrep, 0, 1, lbl);
168
 
    dpd_contract222(&t1, &f, &z, 1, 1, -1, 0);
169
 
    dpd_file2_close(&f);
170
 
    dpd_file2_close(&t1);
171
 
    dpd_buf4_init(&t2, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb");
172
 
    dpd_contract424(&t2, &z, &fbar2, 3, 1, 0, 1, 1);
173
 
    dpd_contract244(&z, &t2, &fbar2, 1, 2, 1, 1, 1);
174
 
    dpd_buf4_close(&t2);
175
 
    dpd_file2_close(&z);
176
 
 
177
 
    sprintf(lbl, "%s_MI", prefix3);
178
 
    dpd_file2_init(&z, CC_TMP0, irrep, 0, 0, lbl); /* generated above */
179
 
    dpd_buf4_init(&t2, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb");
180
 
    dpd_contract424(&t2, &z, &fbar2, 1, 0, 1, -1, 1);
181
 
    dpd_contract244(&z, &t2, &fbar2, 0, 0, 0, -1, 1);
182
 
    dpd_buf4_close(&t2);
183
 
    dpd_file2_close(&z);
184
 
 
185
 
    dpd_buf4_close(&fbar2);
186
 
  }
187
 
}