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

« back to all changes in this revision

Viewing changes to src/bin/cints/Tools/shell_block_matrix.cc

  • 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
/*! \file shell_block_matrix.cc
 
2
    \ingroup CINTS
 
3
    \brief Enter brief description of file here 
 
4
*/
 
5
#include<cstdlib>
 
6
#include<cstdio>
 
7
#include<libciomr/libciomr.h>
 
8
#include<libint/libint.h>
 
9
 
 
10
#include"defines.h"
 
11
#define EXTERN
 
12
#include"global.h"
 
13
#include <stdexcept>
 
14
 
 
15
namespace psi { namespace CINTS {
 
16
 
 
17
double ****init_shell_block_matrix()
 
18
{
 
19
  int si, sj;
 
20
  int ni, nj;
 
21
  double ****data;
 
22
 
 
23
  data = (double****) malloc(BasisSet.num_shells*sizeof(double***));
 
24
  for(si=0;si<BasisSet.num_shells;si++) {
 
25
    data[si] = (double***) malloc(BasisSet.num_shells*sizeof(double**));
 
26
    ni = ioff[BasisSet.shells[si].am];
 
27
    for(sj=0;sj<BasisSet.num_shells;sj++) {
 
28
      nj = ioff[BasisSet.shells[sj].am];
 
29
      data[si][sj] = block_matrix(ni,nj);
 
30
    }
 
31
  }
 
32
 
 
33
  return data;
 
34
}
 
35
 
 
36
void free_shell_block_matrix(double**** data)
 
37
{
 
38
  int si, sj;
 
39
 
 
40
  for(si=0;si<BasisSet.num_shells;si++) {
 
41
    for(sj=0;sj<BasisSet.num_shells;sj++) {
 
42
      free_block(data[si][sj]);
 
43
    }
 
44
    free(data[si]);
 
45
  }
 
46
  free(data);
 
47
 
 
48
  return;
 
49
}
 
50
  
 
51
 
 
52
void shell_block_to_block(double**** shell_block, double** block)
 
53
{
 
54
  int si, sj;
 
55
  int ni, nj;
 
56
  int i, j, ioffset, joffset;
 
57
  double **sb;
 
58
 
 
59
  for(si=0;si<BasisSet.num_shells;si++) {
 
60
    ni = ioff[BasisSet.shells[si].am];
 
61
    ioffset = BasisSet.shells[si].fao-1;
 
62
    for(sj=0;sj<BasisSet.num_shells;sj++) {
 
63
      nj = ioff[BasisSet.shells[sj].am];
 
64
      joffset = BasisSet.shells[sj].fao-1;
 
65
      sb = shell_block[si][sj];
 
66
      for(i=0;i<ni;i++)
 
67
        for(j=0;j<nj;j++)
 
68
          block[i+ioffset][j+joffset] = sb[i][j];
 
69
    }
 
70
  }
 
71
 
 
72
  return;
 
73
}
 
74
 
 
75
 
 
76
void GplusGt(double**** G, double**** Gsym)
 
77
{
 
78
  int si, sj;
 
79
  int ni, nj;
 
80
  int i, j;
 
81
  double **sb, **sb_t;
 
82
 
 
83
  for(si=0;si<BasisSet.num_shells;si++) {
 
84
    ni = ioff[BasisSet.shells[si].am];
 
85
    for(sj=0;sj<BasisSet.num_shells;sj++) {
 
86
      nj = ioff[BasisSet.shells[sj].am];
 
87
      sb = G[si][sj];
 
88
      /*--- Symmetrize off-diagonal blocks ---*/
 
89
      if (1) {
 
90
        sb_t = G[sj][si];
 
91
        for(i=0;i<ni;i++)
 
92
          for(j=0;j<nj;j++)
 
93
            Gsym[si][sj][i][j] = sb[i][j] + sb_t[j][i];
 
94
      }
 
95
      /*--- Symmetrize the diagonal blocks ---*/
 
96
      else {
 
97
        for(i=0;i<ni;i++) {
 
98
          for(j=0;j<i;j++)
 
99
            Gsym[si][si][i][j] = sb[i][j] + sb[j][i];
 
100
          Gsym[si][si][i][i] = sb[i][i];
 
101
        }
 
102
      }
 
103
    }
 
104
  }
 
105
  return;
 
106
}
 
107
 
 
108
};};