~ubuntu-branches/ubuntu/vivid/psicode/vivid

« back to all changes in this revision

Viewing changes to src/bin/cchbar/F.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2008-06-07 16:49:57 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080607164957-8pifvb133yjlkagn
Tags: 3.3.0-3
* debian/rules (DEB_MAKE_CHECK_TARGET): Do not abort test suite on
  failures.
* debian/rules (DEB_CONFIGURE_EXTRA_FLAGS): Set ${bindir} to /usr/lib/psi.
* debian/rules (install/psi3): Move psi3 file to /usr/bin.
* debian/patches/07_464867_move_executables.dpatch: New patch, add
  /usr/lib/psi to the $PATH, so that the moved executables are found.
  (closes: #464867)
* debian/patches/00list: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <stdio.h>
 
2
#include <stdlib.h>
 
3
#include <string.h>
2
4
#include <libdpd/dpd.h>
 
5
#include <libqt/qt.h>
3
6
#define EXTERN
4
7
#include "globals.h"
5
8
 
22
25
*/
23
26
 
24
27
void F_build(void) {
25
 
  int h,i,e,a;
 
28
  int h,e,a,m;
26
29
  dpdfile2 Faet, FAEt, Fmit, FMIt;
27
30
  dpdfile2 Fae, FAE, FMI, Fmi;
28
31
  dpdfile2 fab, fAB, fij, fIJ;
31
34
  dpdfile2 tIA, tia;
32
35
  dpdbuf4 F_anti, F, E_anti, E, D_anti, D;
33
36
  dpdbuf4 tautIJAB, tautijab, tautIjAb, taut;
34
 
 
35
 
  if(params.ref == 0 ||  params.ref == 1) { /** RHF or ROHF **/
 
37
  int Gma, Gm, Ga, Gf, Ge, ma, M, A, fe, ef, f, nrows, ncols;
 
38
  double *X;
 
39
 
 
40
  if(params.ref == 0) {
 
41
 
 
42
    /** FME **/
 
43
    dpd_file2_init(&fIA, CC_OEI, 0, 0, 1, "fIA");
 
44
    dpd_file2_copy(&fIA, CC_OEI, "FME");
 
45
    dpd_file2_close(&fIA);
 
46
 
 
47
    dpd_file2_init(&FME, CC_OEI, 0, 0, 1, "FME");
 
48
    dpd_buf4_init(&D, CC_DINTS, 0, 0, 5, 0, 5, 0, "D 2<ij|ab> - <ij|ba>");
 
49
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
50
    dpd_dot13(&tIA, &D, &FME, 0, 0, 1.0, 1.0);
 
51
    dpd_file2_close(&tIA);
 
52
    dpd_buf4_close(&D);
 
53
    dpd_file2_close(&FME);
 
54
 
 
55
    /** FAE **/
 
56
    dpd_file2_init(&fAB, CC_OEI, 0, 1, 1, "fAB");
 
57
    dpd_file2_copy(&fAB, CC_OEI, "FAE");
 
58
    dpd_file2_close(&fAB);
 
59
 
 
60
    dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
 
61
 
 
62
    /*
 
63
    dpd_buf4_init(&F, CC_FINTS, 0, 10, 5, 10, 5, 0,"F 2<ia|bc> - <ia|cb>");
 
64
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
65
    dpd_dot13(&tIA, &F, &FAE, 0, 0, 1.0, 1.0);
 
66
    dpd_file2_close(&tIA);
 
67
    dpd_buf4_close(&F);
 
68
    */
 
69
 
 
70
    dpd_file2_mat_init(&FAE);
 
71
    dpd_file2_mat_rd(&FAE);
 
72
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
73
    dpd_file2_mat_init(&tIA);
 
74
    dpd_file2_mat_rd(&tIA);
 
75
    dpd_buf4_init(&F, CC_FINTS, 0, 10, 5, 10, 5, 0,"F <ia|bc>");
 
76
    for(Gma=0; Gma < moinfo.nirreps; Gma++) {
 
77
      dpd_buf4_mat_irrep_row_init(&F, Gma);
 
78
      X = init_array(F.params->coltot[Gma]);
 
79
 
 
80
      for(ma=0; ma < F.params->rowtot[Gma]; ma++) {
 
81
        dpd_buf4_mat_irrep_row_rd(&F, Gma, ma);
 
82
        m = F.params->roworb[Gma][ma][0];
 
83
        a = F.params->roworb[Gma][ma][1];
 
84
        Gm = F.params->psym[m];
 
85
        Ga = Ge = Gm ^ Gma;  /* Fae is totally symmetric */
 
86
        Gf = Gm; /* T1 is totally symmetric */
 
87
        M = m - F.params->poff[Gm];
 
88
        A = a - F.params->qoff[Ga];
 
89
 
 
90
        zero_arr(X, F.params->coltot[Gma]);
 
91
 
 
92
        /* build spin-adapted F-integrals for current ma */
 
93
        for(fe=0; fe < F.params->coltot[Gma]; fe++) {
 
94
          f = F.params->colorb[Gma][fe][0];
 
95
          e = F.params->colorb[Gma][fe][1];
 
96
          ef = F.params->colidx[e][f];
 
97
          X[fe] = 2.0 * F.matrix[Gma][0][fe] - F.matrix[Gma][0][ef];
 
98
        }
 
99
        
 
100
        nrows = moinfo.virtpi[Gf];
 
101
        ncols = moinfo.virtpi[Ge];
 
102
        if(nrows && ncols)
 
103
          C_DGEMV('t',nrows,ncols,1.0,&X[F.col_offset[Gma][Gf]],ncols,
 
104
                  tIA.matrix[Gm][M],1,1.0,
 
105
                  FAE.matrix[Ga][A],1);
 
106
      }
 
107
 
 
108
      free(X);
 
109
      dpd_buf4_mat_irrep_row_close(&F, Gma);
 
110
    }
 
111
    dpd_buf4_close(&F);
 
112
    dpd_file2_mat_close(&tIA);
 
113
    dpd_file2_close(&tIA);
 
114
    dpd_file2_mat_wrt(&FAE);
 
115
    dpd_file2_mat_close(&FAE);
 
116
 
 
117
    dpd_buf4_init(&D, CC_DINTS, 0, 0, 5, 0, 5, 0, "D 2<ij|ab> - <ij|ba>");
 
118
    dpd_buf4_init(&tautIjAb, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tautIjAb");
 
119
    dpd_contract442(&tautIjAb, &D, &FAE, 3, 3, -1, 1);
 
120
    dpd_buf4_close(&D);
 
121
    dpd_buf4_close(&tautIjAb);
 
122
 
 
123
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
124
    dpd_file2_init(&FME, CC_OEI, 0, 0, 1, "FME");
 
125
    dpd_contract222(&tIA, &FME, &FAE, 1, 1, -0.5, 1);
 
126
    dpd_file2_close(&tIA);
 
127
    dpd_file2_close(&FME);
 
128
  
 
129
    dpd_file2_copy(&FAE, CC_OEI, "FAEt");
 
130
    dpd_file2_close(&FAE);
 
131
 
 
132
    dpd_file2_init(&fIJ, CC_OEI, 0, 0, 0, "fIJ");
 
133
    dpd_file2_copy(&fIJ, CC_OEI, "FMI");
 
134
    dpd_file2_close(&fIJ);
 
135
 
 
136
    dpd_file2_init(&FMI, CC_OEI, 0, 0, 0, "FMI");
 
137
 
 
138
    dpd_buf4_init(&E, CC_EINTS, 0, 11, 0, 11, 0, 0, "E 2<ai|jk> - <ai|kj>");
 
139
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
140
    dpd_dot13(&tIA, &E, &FMI, 1, 1, 1.0, 1.0);
 
141
    dpd_file2_close(&tIA);
 
142
    dpd_buf4_close(&E);
 
143
 
 
144
    dpd_buf4_init(&D, CC_DINTS, 0, 0, 5, 0, 5, 0, "D 2<ij|ab> - <ij|ba>");
 
145
    dpd_buf4_init(&tautIjAb, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tautIjAb");
 
146
    dpd_contract442(&D, &tautIjAb, &FMI, 0, 0, 1, 1);
 
147
    dpd_buf4_close(&tautIjAb);
 
148
    dpd_buf4_close(&D);
 
149
 
 
150
    dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
151
    dpd_file2_init(&FME, CC_OEI, 0, 0, 1, "FME");
 
152
    dpd_contract222(&FME, &tIA, &FMI, 0, 0, 0.5, 1);
 
153
    dpd_file2_close(&FME);
 
154
    dpd_file2_close(&tIA);
 
155
 
 
156
    dpd_file2_copy(&FMI, CC_OEI, "FMIt");
 
157
    dpd_file2_close(&FMI);
 
158
 
 
159
    dpd_file2_init(&FAEt, CC_OEI, 0, 1, 1, "FAEt");
 
160
    dpd_file2_mat_init(&FAEt);
 
161
    dpd_file2_mat_rd(&FAEt);
 
162
 
 
163
    for(h=0; h < moinfo.nirreps; h++)
 
164
      for(a=0; a < FAEt.params->rowtot[h]; a++)
 
165
        FAEt.matrix[h][a][a] = 0.0;
 
166
 
 
167
    dpd_file2_mat_wrt(&FAEt);
 
168
    dpd_file2_mat_close(&FAEt);
 
169
    dpd_file2_close(&FAEt);
 
170
 
 
171
    dpd_file2_init(&FMIt, CC_OEI, 0, 0, 0, "FMIt");
 
172
    dpd_file2_mat_init(&FMIt);
 
173
    dpd_file2_mat_rd(&FMIt);
 
174
 
 
175
    for(h=0; h < moinfo.nirreps; h++)
 
176
      for(a=0; a < FMIt.params->rowtot[h]; a++)
 
177
        FMIt.matrix[h][a][a] = 0.0;
 
178
 
 
179
    dpd_file2_mat_wrt(&FMIt);
 
180
    dpd_file2_mat_close(&FMIt);
 
181
    dpd_file2_close(&FMIt);
 
182
 
 
183
  }
 
184
  else if(params.ref == 1) { /** ROHF **/
36
185
 
37
186
    /* FME and Fme */
38
187
    dpd_file2_init(&fIA, CC_OEI, 0, 0, 1, "fIA");
326
475
    dpd_file2_copy(&fab, CC_OEI, "Fae");
327
476
    dpd_file2_close(&fab);
328
477
 
 
478
    if((!strcmp(params.wfn,"CC2")) || (!strcmp(params.wfn,"EOM_CC2"))) {
 
479
      dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
 
480
      dpd_file2_init(&Fae, CC_OEI, 0, 3, 3, "Fae");
 
481
 
 
482
      dpd_file2_mat_init(&FAE);
 
483
      dpd_file2_mat_rd(&FAE);
 
484
      dpd_file2_mat_init(&Fae);
 
485
      dpd_file2_mat_rd(&Fae);
 
486
  
 
487
      for(h=0; h < moinfo.nirreps; h++) {
 
488
        for(e=0; e < FAE.params->coltot[h]; e++)
 
489
          FAE.matrix[h][e][e] = 0;
 
490
        for(e=0; e < Fae.params->coltot[h]; e++)
 
491
          Fae.matrix[h][e][e] = 0;
 
492
      }
 
493
 
 
494
      dpd_file2_mat_wrt(&FAE);
 
495
      dpd_file2_mat_close(&FAE);
 
496
      dpd_file2_mat_wrt(&Fae);
 
497
      dpd_file2_mat_close(&Fae);
 
498
 
 
499
      dpd_file2_close(&FAE);
 
500
      dpd_file2_close(&Fae);
 
501
    }
 
502
 
329
503
    dpd_file2_init(&FAE, CC_OEI, 0, 1, 1, "FAE");
330
504
    dpd_file2_init(&Fae, CC_OEI, 0, 3, 3, "Fae");
331
505
 
415
589
    dpd_file2_copy(&fij, CC_OEI, "Fmi");
416
590
    dpd_file2_close(&fij);
417
591
 
 
592
    if((!strcmp(params.wfn,"CC2")) || (!strcmp(params.wfn,"EOM_CC2"))) {
 
593
      dpd_file2_init(&FMI, CC_OEI, 0, 0, 0, "FMI");
 
594
      dpd_file2_init(&Fmi, CC_OEI, 0, 2, 2, "Fmi");
 
595
 
 
596
      dpd_file2_mat_init(&FMI);
 
597
      dpd_file2_mat_rd(&FMI);
 
598
      dpd_file2_mat_init(&Fmi);
 
599
      dpd_file2_mat_rd(&Fmi);
 
600
 
 
601
      for(h=0; h < moinfo.nirreps; h++) {
 
602
        for(m=0; m < FMI.params->rowtot[h]; m++)
 
603
          FMI.matrix[h][m][m] = 0;
 
604
        for(m=0; m < Fmi.params->rowtot[h]; m++)
 
605
          Fmi.matrix[h][m][m] = 0;
 
606
      }
 
607
 
 
608
      dpd_file2_mat_wrt(&FMI);
 
609
      dpd_file2_mat_close(&FMI);
 
610
      dpd_file2_mat_wrt(&Fmi);
 
611
      dpd_file2_mat_close(&Fmi);
 
612
 
 
613
      dpd_file2_close(&FMI);
 
614
      dpd_file2_close(&Fmi);
 
615
    }
 
616
 
418
617
    dpd_file2_init(&FMI, CC_OEI, 0, 0, 0, "FMI");
419
618
    dpd_file2_init(&Fmi, CC_OEI, 0, 2, 2, "Fmi");
420
619
 
497
696
    dpd_file2_close(&FMI);
498
697
    dpd_file2_close(&Fmi);
499
698
 
500
 
 
501
699
    /* remove diagonal elements from Ft's */
502
700
    dpd_file2_init(&Faet, CC_OEI, 0, 3, 3, "Faet");
503
701
    dpd_file2_mat_init(&Faet);