~ubuntu-branches/ubuntu/karmic/psicode/karmic

« back to all changes in this revision

Viewing changes to src/bin/mp2/Zvector.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 <libdpd/dpd.h>
2
 
#include <libqt/qt.h>
3
 
#include <libciomr/libciomr.h>
4
 
#include <math.h>
5
 
#define EXTERN
6
 
#include "globals.h"
7
 
 
8
 
void rhf_Zvector(void);
9
 
void uhf_Zvector(void);
10
 
void rhf_sf_Zvector(void);
11
 
void uhf_sf_Zvector(void);
12
 
 
13
 
void Zvector(void)
14
 
{
15
 
  if(params.gradient) {
16
 
    if(params.ref == 0) rhf_sf_Zvector();
17
 
    else if(params.ref == 2) uhf_sf_Zvector();
18
 
  }
19
 
  else {
20
 
    if(params.ref == 0) rhf_Zvector();
21
 
    else if(params.ref == 2) uhf_Zvector();
22
 
  }
23
 
}
24
 
 
25
 
void rhf_Zvector(void)
26
 
{
27
 
  dpdfile2 L;
28
 
  dpdfile2 D;
29
 
  dpdbuf4 A;
30
 
  double **Z;
31
 
  int h, nirreps;
32
 
  int a, i, num_ai, count;
33
 
  int I, B;
34
 
 
35
 
  nirreps = mo.nirreps;
36
 
 
37
 
  dpd_file2_init(&L, CC_OEI, 0, 1, 0, "LAI");
38
 
  dpd_file2_print(&L,outfile);
39
 
  dpd_file2_mat_init(&L);
40
 
  dpd_file2_mat_rd(&L);
41
 
  num_ai = 0;
42
 
  for(h=0; h < nirreps; h++)
43
 
    num_ai += L.params->rowtot[h]*L.params->coltot[h];
44
 
 
45
 
  Z = block_matrix(1,num_ai);
46
 
  for(h=0,count=0; h < nirreps; h++)
47
 
    for(a=0; a < L.params->rowtot[h]; a++)
48
 
      for(i=0; i < L.params->coltot[h]; i++) 
49
 
        Z[0][count++] = -L.matrix[h][a][i];
50
 
 
51
 
  dpd_file2_mat_close(&L);
52
 
  dpd_file2_close(&L);
53
 
 
54
 
  dpd_buf4_init(&A, CC_MISC, 0, 11, 11, 11, 11, 0, "A(AI,BJ)");
55
 
  dpd_buf4_mat_irrep_init(&A, 0);
56
 
  dpd_buf4_mat_irrep_rd(&A, 0);
57
 
 
58
 
  pople(A.matrix[0], Z[0], num_ai, 1, 1e-12, outfile, 0);
59
 
 
60
 
  dpd_buf4_mat_irrep_close(&A, 0);
61
 
  dpd_buf4_close(&A);
62
 
 
63
 
  dpd_file2_init(&D, CC_OEI, 0, 1, 0, "DAI");
64
 
  dpd_file2_mat_init(&D);
65
 
  for(h=0,count=0; h < nirreps; h++)
66
 
    for(a=0; a < D.params->rowtot[h]; a++)
67
 
      for(i=0; i < D.params->coltot[h]; i++) 
68
 
        D.matrix[h][a][i] = Z[0][count++];
69
 
 
70
 
  dpd_file2_mat_wrt(&D);
71
 
  dpd_file2_mat_close(&D);
72
 
  dpd_file2_close(&D);
73
 
 
74
 
  free_block(Z);
75
 
}
76
 
 
77
 
void uhf_Zvector(void)
78
 
{
79
 
 
80
 
}
81
 
 
82
 
void rhf_sf_Zvector(void)
83
 
{
84
 
  dpdbuf4 A;
85
 
  dpdfile2 X1, D;
86
 
  double **Z;
87
 
  int num_ai, h, nirreps, a, i, count;
88
 
 
89
 
  nirreps = mo.nirreps;
90
 
 
91
 
  /* Place all the elements of the orbital rotation gradient, X into a
92
 
     linear array, Z */
93
 
  dpd_file2_init(&X1, CC_MISC, 0, 1, 0, "X(A,I)");
94
 
  dpd_file2_mat_init(&X1);
95
 
  dpd_file2_mat_rd(&X1);
96
 
  num_ai = 0;
97
 
  for(h=0; h < nirreps; h++)
98
 
    num_ai += X1.params->rowtot[h]*X1.params->coltot[h];
99
 
 
100
 
  Z = block_matrix(1,num_ai);
101
 
  for(h=0,count=0; h < nirreps; h++)
102
 
    for(a=0; a < X1.params->rowtot[h]; a++)
103
 
      for(i=0; i < X1.params->coltot[h]; i++) 
104
 
        Z[0][count++] = -X1.matrix[h][a][i];
105
 
 
106
 
  dpd_file2_mat_close(&X1);
107
 
  dpd_file2_close(&X1);
108
 
 
109
 
  /* Now, grab only irrep 0 of the orbital Hessian */
110
 
  dpd_buf4_init(&A, CC_MISC, 0, 11, 11, 11, 11, 0, "A(EM,AI)");
111
 
  dpd_buf4_mat_irrep_init(&A, 0);
112
 
  dpd_buf4_mat_irrep_rd(&A, 0);
113
 
 
114
 
  /* Trying out Matt's Pople code --- way to go, Matt! */
115
 
  pople(A.matrix[0], Z[0], num_ai, 1, 1e-12, outfile, 0);
116
 
 
117
 
  dpd_buf4_mat_irrep_close(&A, 0);
118
 
  dpd_buf4_close(&A);
119
 
 
120
 
  /* Build the orbital component of Dai --- we'll build these as separate
121
 
     spin cases for future simplicity (e.g., UHF-based codes)*/
122
 
 
123
 
  dpd_file2_init(&D, CC_OEI, 0, 1, 0, "D(orb)(A,I)");
124
 
  dpd_file2_mat_init(&D);
125
 
  for(h=0,count=0; h < nirreps; h++)
126
 
    for(a=0; a < D.params->rowtot[h]; a++)
127
 
      for(i=0; i < D.params->coltot[h]; i++) 
128
 
        D.matrix[h][a][i] = Z[0][count++];
129
 
  dpd_file2_mat_wrt(&D);
130
 
  dpd_file2_mat_close(&D);
131
 
  dpd_file2_close(&D);
132
 
 
133
 
  dpd_file2_init(&D, CC_OEI, 0, 1, 0, "D(orb)(a,i)");
134
 
  dpd_file2_mat_init(&D);
135
 
  for(h=0,count=0; h < nirreps; h++)
136
 
    for(a=0; a < D.params->rowtot[h]; a++) 
137
 
      for(i=0; i < D.params->coltot[h]; i++) 
138
 
        D.matrix[h][a][i] = Z[0][count++];
139
 
  dpd_file2_mat_wrt(&D);
140
 
  dpd_file2_mat_close(&D);
141
 
  dpd_file2_close(&D);
142
 
 
143
 
  free_block(Z);
144
 
}
145
 
 
146
 
void uhf_sf_Zvector(void)
147
 
{
148
 
 
149
 
}