1
/*! \file calc_close_basis_u.cc
3
\brief Enter brief description of file here
9
#include <libipv1/ip_lib.h>
10
#include <libciomr/libciomr.h>
15
#define NIM(a,b) a < b ? a : b
19
#include"bas_comp_functions.h"
22
namespace psi { namespace CINTS {
24
void calc_close_basis_u(int atom_num, int chunk_num){
43
struct coordinates atom_point_geom;
44
struct coordinates shell_geom;
46
struct atomic_grid_s *atom_grid;
47
struct leb_chunk_s *chunk;
48
struct close_shell_info_s *close;
50
num_shells = BasisSet.num_shells;
51
aocc = MOInfo.alpha_occ;
52
bocc = MOInfo.beta_occ;
53
max_am = BasisSet.max_am;
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;
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;
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);
67
DFT_options.close_shell_info.num_close_aos = 0;
71
for(i=0;i<num_shells;i++){
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;
78
/* Compute the Distance between the chunk's center
79
and the shell's center */
81
dist = distance_calc(atom_point_geom,shell_geom);
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 */
91
/* dist is greater than the outer chunk, so
92
use the distance between the atom and the outer
93
sphere of the chunk */
95
r = dist-chunk_rad_out;
97
bastmp = calc_radial_bas(am2shell,rr,r);
99
/* dist is less than the inner shell */
102
r = chunk_rad_in-dist;
104
bastmp = calc_radial_bas(am2shell,rr,r);
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
--------------------------------*/
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++){
125
DFT_options.close_shell_info.close_COCC_a[l][m]
126
= Cocca[BasisSet.shells[am2shell].fao-1+k][m];
129
DFT_options.close_shell_info.close_COCC_b[l][m]
130
= Coccb[BasisSet.shells[am2shell].fao-1+k][m];
132
DFT_options.close_shell_info.aos_close_to_chunk[l] =
133
BasisSet.shells[am2shell].fao-1+k;
137
DFT_options.close_shell_info.close_shells_per_am[shell_type-1]++;
139
DFT_options.close_shell_info.num_close_shells = j;
140
DFT_options.close_shell_info.num_close_aos = l;
142
/*print_close_shell_info(DFT_options.close_shell_info);*/