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

« back to all changes in this revision

Viewing changes to src/bin/cclambda/converged.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 <math.h>
3
 
#include <libipv1/ip_lib.h>
4
 
#include <libdpd/dpd.h>
5
 
#include <libqt/qt.h>
6
 
#define EXTERN
7
 
#include "globals.h"
8
 
 
9
 
int converged(int L_irr)
10
 
{
11
 
  int row,col,h,nirreps;
12
 
  double rms=0.0;
13
 
  dpdfile2 L1, L1old;
14
 
  dpdbuf4 L2, L2old;
15
 
 
16
 
  nirreps = moinfo.nirreps;
17
 
 
18
 
  dpd_file2_init(&L1, CC_LAMBDA, L_irr, 0, 1, "New LIA");
19
 
  dpd_file2_mat_init(&L1);
20
 
  dpd_file2_mat_rd(&L1);
21
 
  dpd_file2_init(&L1old, CC_LAMBDA, L_irr, 0, 1, "LIA");
22
 
  dpd_file2_mat_init(&L1old);
23
 
  dpd_file2_mat_rd(&L1old);
24
 
 
25
 
  for(h=0; h < nirreps; h++)
26
 
    for(row=0; row < L1.params->rowtot[h]; row++)
27
 
      for(col=0; col < L1.params->coltot[h^L_irr]; col++)
28
 
        rms += (L1.matrix[h][row][col] - L1old.matrix[h][row][col]) *
29
 
          (L1.matrix[h][row][col] - L1old.matrix[h][row][col]);
30
 
 
31
 
  dpd_file2_mat_close(&L1);
32
 
  dpd_file2_close(&L1);
33
 
  dpd_file2_mat_close(&L1old);
34
 
  dpd_file2_close(&L1old);
35
 
 
36
 
  if(params.ref == 0) rms *= 2.0;
37
 
 
38
 
  if(params.ref == 1) { /** ROHF **/
39
 
 
40
 
    dpd_file2_init(&L1, CC_LAMBDA, L_irr, 0, 1, "New Lia");
41
 
    dpd_file2_mat_init(&L1);
42
 
    dpd_file2_mat_rd(&L1);
43
 
    dpd_file2_init(&L1old, CC_LAMBDA, L_irr, 0, 1, "Lia");
44
 
    dpd_file2_mat_init(&L1old);
45
 
    dpd_file2_mat_rd(&L1old);
46
 
 
47
 
  }
48
 
  else if(params.ref == 2) { /** UHF **/
49
 
 
50
 
    dpd_file2_init(&L1, CC_LAMBDA, L_irr, 2, 3, "New Lia");
51
 
    dpd_file2_mat_init(&L1);
52
 
    dpd_file2_mat_rd(&L1);
53
 
    dpd_file2_init(&L1old, CC_LAMBDA, L_irr, 2, 3, "Lia");
54
 
    dpd_file2_mat_init(&L1old);
55
 
    dpd_file2_mat_rd(&L1old);
56
 
 
57
 
  }
58
 
 
59
 
  if(params.ref == 1 || params.ref == 2) {
60
 
    for(h=0; h < nirreps; h++)
61
 
      for(row=0; row < L1.params->rowtot[h]; row++)
62
 
        for(col=0; col < L1.params->coltot[h^L_irr]; col++)
63
 
          rms += (L1.matrix[h][row][col] - L1old.matrix[h][row][col]) *
64
 
            (L1.matrix[h][row][col] - L1old.matrix[h][row][col]);
65
 
 
66
 
    dpd_file2_mat_close(&L1);
67
 
    dpd_file2_close(&L1);
68
 
    dpd_file2_mat_close(&L1old);
69
 
    dpd_file2_close(&L1old);
70
 
  }
71
 
 
72
 
  if(params.ref == 1 || params.ref == 2) { 
73
 
    dpd_buf4_init(&L2, CC_LAMBDA, L_irr, 2, 7, 2, 7, 0, "New LIJAB");
74
 
    dpd_buf4_init(&L2old, CC_LAMBDA, L_irr, 2, 7, 2, 7, 0, "LIJAB");
75
 
    for(h=0; h < nirreps; h++) {
76
 
      dpd_buf4_mat_irrep_init(&L2, h);
77
 
      dpd_buf4_mat_irrep_rd(&L2, h);
78
 
      dpd_buf4_mat_irrep_init(&L2old, h);
79
 
      dpd_buf4_mat_irrep_rd(&L2old, h);
80
 
      for(row=0; row < L2.params->rowtot[h]; row++)
81
 
        for(col=0; col < L2.params->coltot[h^L_irr]; col++)
82
 
          rms += (L2.matrix[h][row][col] - L2old.matrix[h][row][col]) *
83
 
            (L2.matrix[h][row][col] - L2old.matrix[h][row][col]);
84
 
      dpd_buf4_mat_irrep_close(&L2, h);
85
 
      dpd_buf4_mat_irrep_close(&L2old, h);
86
 
    }
87
 
    dpd_buf4_close(&L2old);
88
 
    dpd_buf4_close(&L2);
89
 
  }
90
 
 
91
 
  if(params.ref == 1) { /** ROHF **/
92
 
    dpd_buf4_init(&L2, CC_LAMBDA, L_irr, 2, 7, 2, 7, 0, "New Lijab");
93
 
    dpd_buf4_init(&L2old, CC_LAMBDA, L_irr, 2, 7, 2, 7, 0, "Lijab");
94
 
  }
95
 
  else if(params.ref == 2) { /** UHF **/
96
 
    dpd_buf4_init(&L2, CC_LAMBDA, L_irr, 12, 17, 12, 17, 0, "New Lijab");
97
 
    dpd_buf4_init(&L2old, CC_LAMBDA, L_irr, 12, 17, 12, 17, 0, "Lijab");
98
 
  }
99
 
 
100
 
  if(params.ref == 1 || params.ref == 2) {
101
 
    for(h=0; h < nirreps; h++) {
102
 
      dpd_buf4_mat_irrep_init(&L2, h);
103
 
      dpd_buf4_mat_irrep_rd(&L2, h);
104
 
      dpd_buf4_mat_irrep_init(&L2old, h);
105
 
      dpd_buf4_mat_irrep_rd(&L2old, h);
106
 
      for(row=0; row < L2.params->rowtot[h]; row++)
107
 
        for(col=0; col < L2.params->coltot[h^L_irr]; col++)
108
 
          rms += (L2.matrix[h][row][col] - L2old.matrix[h][row][col]) *
109
 
            (L2.matrix[h][row][col] - L2old.matrix[h][row][col]);
110
 
      dpd_buf4_mat_irrep_close(&L2, h);
111
 
      dpd_buf4_mat_irrep_close(&L2old, h);
112
 
    }
113
 
    dpd_buf4_close(&L2old);
114
 
    dpd_buf4_close(&L2);
115
 
  }
116
 
 
117
 
  if(params.ref == 0 || params.ref == 1) { /** RHF/ROHF **/
118
 
    dpd_buf4_init(&L2, CC_LAMBDA, L_irr, 0, 5, 0, 5, 0, "New LIjAb");
119
 
    dpd_buf4_init(&L2old, CC_LAMBDA, L_irr, 0, 5, 0, 5, 0, "LIjAb");
120
 
  }
121
 
  else if(params.ref == 2) { /** UHF **/
122
 
    dpd_buf4_init(&L2, CC_LAMBDA, L_irr, 22, 28, 22, 28, 0, "New LIjAb");
123
 
    dpd_buf4_init(&L2old, CC_LAMBDA, L_irr, 22, 28, 22, 28, 0, "LIjAb");
124
 
  }
125
 
 
126
 
  for(h=0; h < nirreps; h++) {
127
 
    dpd_buf4_mat_irrep_init(&L2, h);
128
 
    dpd_buf4_mat_irrep_rd(&L2, h);
129
 
    dpd_buf4_mat_irrep_init(&L2old, h);
130
 
    dpd_buf4_mat_irrep_rd(&L2old, h);
131
 
    for(row=0; row < L2.params->rowtot[h]; row++)
132
 
      for(col=0; col < L2.params->coltot[h^L_irr]; col++)
133
 
        rms += (L2.matrix[h][row][col] - L2old.matrix[h][row][col]) *
134
 
          (L2.matrix[h][row][col] - L2old.matrix[h][row][col]);
135
 
    dpd_buf4_mat_irrep_close(&L2, h);
136
 
    dpd_buf4_mat_irrep_close(&L2old, h);
137
 
  }
138
 
  dpd_buf4_close(&L2old);
139
 
  dpd_buf4_close(&L2);
140
 
 
141
 
  rms = sqrt(rms);
142
 
  moinfo.conv = rms;
143
 
 
144
 
  if(rms < params.convergence) return 1;
145
 
  else return 0;
146
 
}