4
#include <libipv1/ip_lib.h>
5
#include <libciomr/libciomr.h>
10
#define NIM(a,b) a < b ? a : b
13
#include"bas_comp_functions.h"
15
void calc_close_basis(int atom_num, int chunk_num){
34
struct coordinates atom_point_geom;
35
struct coordinates shell_geom;
37
struct atomic_grid_s *atom_grid;
38
struct leb_chunk_s *chunk;
39
struct close_shell_info_s *close;
41
num_shells = BasisSet.num_shells;
43
max_am = BasisSet.max_am;
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;
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;
54
bzero(DFT_options.close_shell_info.close_shells_per_am
57
DFT_options.close_shell_info.num_close_aos = 0;
61
for(i=0;i<num_shells;i++){
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;
68
/* Compute the Distance between the chunk's center
69
and the shell's center */
71
dist = distance_calc(atom_point_geom,shell_geom);
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 */
81
/* dist is greater than the outer chunk, so
82
use the distance between the atom and the outer
83
sphere of the chunk */
85
r = dist-chunk_rad_out;
87
bastmp = calc_radial_bas(am2shell,rr,r);
89
/* dist is less than the inner shell */
92
r = chunk_rad_in-dist;
94
bastmp = calc_radial_bas(am2shell,rr,r);
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
--------------------------------*/
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];
118
DFT_options.close_shell_info.aos_close_to_chunk[l] =
119
BasisSet.shells[am2shell].fao-1+k;
123
DFT_options.close_shell_info.close_shells_per_am[shell_type-1]++;
125
DFT_options.close_shell_info.num_close_shells = j;
126
DFT_options.close_shell_info.num_close_aos = l;
128
/*print_close_shell_info(DFT_options.close_shell_info);*/