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

« back to all changes in this revision

Viewing changes to src/bin/cints/DFT/calc_close_basis.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2006-09-10 14:01:33 UTC
  • Revision ID: james.westby@ubuntu.com-20060910140133-ib2j86trekykfsfv
Tags: upstream-3.2.3
ImportĀ upstreamĀ versionĀ 3.2.3

Show diffs side-by-side

added added

removed removed

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