5
This code contains some functions used for
6
the calculation of the weighting functions
9
Ref. Becke, J. Chem. Phys., Vol. 88, pg. 2547, 1988.
11
----------------------------------------------*/
16
#include <libipv1/ip_lib.h>
17
#include <libciomr/libciomr.h>
18
#include <libint/libint.h>
26
/* Declare functions in this code */
28
namespace psi { namespace CINTS {
29
double u_calc(int i, int j, struct coordinates geom);
30
double v_calc(int i, int j, double uij);
31
double f_u(double vij);
34
double weight_calc(int atomn,struct coordinates geom,int k_order){
37
double utemp,vtemp,ftemp;
43
natoms = Molecule.num_atoms;
44
/*natoms = Symmetry.num_unique_atoms;*/
46
ptemp = init_array(natoms);
47
s_mat = block_matrix(natoms,natoms);
49
/* calculate all possible s's*/
50
for(i=0;i<natoms;i++){
51
for(j=0;j<natoms;j++){
53
utemp = u_calc(i,j,geom);
54
vtemp = v_calc(i,j,utemp);
56
for(k=1;k<k_order;k++){
59
s_mat[i][j] = s_u(ftemp);
64
/* calculate all of the cell functions into an array */
66
for(i=0;i<natoms;i++){
68
for(j=0;j<natoms;j++){
70
ptemp[i] *= s_mat[i][j];
75
weight=ptemp[atomn]/sum;
83
double u_calc(int i, int j, struct coordinates geom){
88
/* calculate the distance of the grid point from
91
ri = distance_calc(Molecule.centers[i],geom);
92
rj = distance_calc(Molecule.centers[j],geom);
93
rij = distance_calc(Molecule.centers[i],Molecule.centers[j]);
98
double f_u(double vij){
100
return 1.5*vij-0.5*(vij*vij*vij);
103
double s_u(double f){
108
double v_calc(int atomi, int atomj,double uij){
113
double tmp1,tmp2,tmp3;
115
rattmp = DFT_options.grid.atomic_grid[atomi].Bragg_radii/
116
DFT_options.grid.atomic_grid[atomj].Bragg_radii;
117
utmp = (rattmp-1)/(rattmp+1);
118
aij=utmp/((utmp*utmp)-1);
119
if(aij>0.5) aij = 0.5;
120
if(aij<-0.5) aij = -0.5;