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

« back to all changes in this revision

Viewing changes to src/bin/cints/DFT/calc_close_basis_u.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 calc_close_basis_u.cc
 
2
    \ingroup CINTS
 
3
    \brief Enter brief description of file here 
 
4
*/
 
5
#include <cmath>
 
6
#include <cstdio>
 
7
#include <cstdlib>
 
8
#include <cstring>
 
9
#include <libipv1/ip_lib.h>
 
10
#include <libciomr/libciomr.h>
 
11
#include <libqt/qt.h>
 
12
 
 
13
#include"defines.h"
 
14
#define EXTERN
 
15
#define NIM(a,b) a < b ? a : b
 
16
#include"global.h"
 
17
#include <stdexcept>
 
18
#include"small_fns.h"
 
19
#include"bas_comp_functions.h"
 
20
#define TOL 1E-50
 
21
 
 
22
namespace psi { namespace CINTS {
 
23
 
 
24
  void calc_close_basis_u(int atom_num, int chunk_num){
 
25
    int i,j,k,l,m;
 
26
    int chunk_center;
 
27
    int shell_center;
 
28
    int shell_type;
 
29
    int am2shell;
 
30
    int max_am;
 
31
    int num_ao;
 
32
    int aocc,bocc;
 
33
    int num_shells;
 
34
    
 
35
    double chunk_rad_in;
 
36
    double chunk_rad_out;
 
37
    double chunk_rad;
 
38
    double bragg;
 
39
    double dist;
 
40
    double r,rr;
 
41
    double bastmp;
 
42
    
 
43
    struct coordinates atom_point_geom;
 
44
    struct coordinates shell_geom;
 
45
    
 
46
    struct atomic_grid_s *atom_grid;
 
47
    struct leb_chunk_s *chunk;
 
48
    struct close_shell_info_s *close;
 
49
    
 
50
    num_shells = BasisSet.num_shells;
 
51
    aocc = MOInfo.alpha_occ;
 
52
    bocc = MOInfo.beta_occ;
 
53
    max_am = BasisSet.max_am;
 
54
    
 
55
    atom_grid = &(DFT_options.grid.atomic_grid[atom_num]);
 
56
    bragg = atom_grid->Bragg_radii;
 
57
    atom_point_geom = atom_grid->atom_center;
 
58
    chunk_center = atom_grid->atom_num;
 
59
    
 
60
    chunk = &(atom_grid->leb_chunk[chunk_num]);   
 
61
    chunk_rad_in = chunk->spheres[0].r*bragg;
 
62
    chunk_rad_out = chunk->spheres[chunk->size-1].r*bragg;
 
63
    
 
64
    //bzero(DFT_options.close_shell_info.close_shells_per_am ,sizeof(int)*max_am);
 
65
    memset((void *)DFT_options.close_shell_info.close_shells_per_am, '\0', sizeof(int)*max_am);
 
66
    
 
67
    DFT_options.close_shell_info.num_close_aos = 0;
 
68
    
 
69
    j = 0;
 
70
    l = 0;
 
71
    for(i=0;i<num_shells;i++){
 
72
      
 
73
      am2shell = BasisSet.am2shell[i];
 
74
      shell_center = BasisSet.shells[am2shell].center - 1;
 
75
      shell_geom = Molecule.centers[shell_center];
 
76
      shell_type = BasisSet.shells[am2shell].am;
 
77
      
 
78
      /* Compute the Distance between the chunk's center
 
79
         and the shell's center */
 
80
      
 
81
      dist = distance_calc(atom_point_geom,shell_geom);
 
82
      
 
83
      
 
84
      if(dist >= chunk_rad_in){
 
85
        if(dist <= chunk_rad_out){
 
86
          /* Doesn't matter because the atom is in the chunk */
 
87
          /* so its basis functions will atomatically be accepted */
 
88
          bastmp = 1.0;
 
89
        }
 
90
        else{
 
91
          /* dist is greater than the outer chunk, so
 
92
             use the distance between the atom and the outer
 
93
             sphere of the chunk */ 
 
94
          
 
95
          r = dist-chunk_rad_out;
 
96
          rr = r*r;
 
97
          bastmp = calc_radial_bas(am2shell,rr,r);
 
98
        }
 
99
        /* dist is less than the inner shell */
 
100
      }
 
101
      else{
 
102
        r = chunk_rad_in-dist;
 
103
        rr = r*r;
 
104
        bastmp = calc_radial_bas(am2shell,rr,r);
 
105
      }
 
106
      
 
107
      /*fprintf(outfile,"\natom x = %10.10lf y = %10.10lf z = %10.10lf"
 
108
        ,atom_point_geom.x,atom_point_geom.y,atom_point_geom.z);
 
109
        fprintf(outfile,"\nshell x = %10.10lf y = %10.10lf z = %10.10lf"
 
110
        ,shell_geom.x,shell_geom.y,shell_geom.z);
 
111
        fprintf(outfile,"\nshell_center = %d chunk_center = %d dist = %10.10lf",shell_center,chunk_center,dist);
 
112
        fprintf(outfile,"\ndist = %10.10lf",dist);
 
113
        fprintf(outfile,"\nchunk_rad_in = %10.10lf chunk_rad_out = %10.10lf",chunk_rad_in,chunk_rad_out);
 
114
        fprintf(outfile, "\nr = %e rr = %e",r,rr);
 
115
        fprintf(outfile, "\nbastmp = %e",bastmp);*/
 
116
      /* ---------------------------------
 
117
         Determine whether the basis
 
118
         the function is close or not
 
119
         --------------------------------*/
 
120
      
 
121
      if(fabs(bastmp) > TOL){
 
122
        DFT_options.close_shell_info.shells_close_to_chunk[j] = am2shell;
 
123
        for(k=0;k<ioff[shell_type];k++){
 
124
          for(m=0;m<aocc;m++){
 
125
            DFT_options.close_shell_info.close_COCC_a[l][m] 
 
126
              = Cocca[BasisSet.shells[am2shell].fao-1+k][m];
 
127
          }
 
128
          for(m=0;m<bocc;m++){
 
129
            DFT_options.close_shell_info.close_COCC_b[l][m] 
 
130
              = Coccb[BasisSet.shells[am2shell].fao-1+k][m];
 
131
          }
 
132
          DFT_options.close_shell_info.aos_close_to_chunk[l] = 
 
133
            BasisSet.shells[am2shell].fao-1+k;
 
134
          l++;
 
135
        }
 
136
        j++;
 
137
        DFT_options.close_shell_info.close_shells_per_am[shell_type-1]++;                   
 
138
      }
 
139
      DFT_options.close_shell_info.num_close_shells = j;
 
140
      DFT_options.close_shell_info.num_close_aos = l;
 
141
    }
 
142
    /*print_close_shell_info(DFT_options.close_shell_info);*/
 
143
    
 
144
  }
 
145
};
 
146
 
 
147
 
 
148
 
 
149
 
 
150
 
 
151
 
 
152
 
 
153
 
 
154
 
 
155
 
 
156
 
 
157
 
 
158
 
 
159
 
 
160
 
 
161
};