3
\brief Enter brief description of file here
9
#include <libciomr/libciomr.h>
19
namespace psi { namespace input {
21
/*--- External function declaration ---*/
22
extern void OI_OSrecurs_float(FLOAT** OIX, FLOAT** OIY, FLOAT** OIZ, FLOAT PA[3], FLOAT PB[3],
23
FLOAT gamma, int lmaxi, int lmaxj);
25
/*------------------------------------------------------
26
This function computes the overlap matrix S12 between
27
the new and old bases (in SO basis)
28
------------------------------------------------------*/
29
FLOAT **overlap_new_old_float()
31
struct coordinates A, B;
32
FLOAT P[3], PA[3], PB[3];
36
int x1, x2, y1, y2, z1, z2;
37
int s1, s2, ao1, ao2, l1, l2, n1, n2, p1, p2,
38
prim1, prim2, fprim1, fprim2, nprim1, nprim2, atom1, atom2, bf1, bf2;
39
FLOAT exp1, exp2, cc1, cc2, norm1;
40
FLOAT ab2, pfac, gam, oog;
42
FLOAT **stemp, **S12_AO, **S12, **OIX, **OIY, **OIZ;
44
FLOAT **usotao_FLOAT, **oldusotao_FLOAT_transp;
46
S12_AO = create_matrix(num_ao, Oldcalc.num_ao);
47
maxsz1 = ioff[max_angmom+1];
48
maxsz2 = ioff[Oldcalc.max_angmom+1];
49
stemp = create_matrix(maxsz1,maxsz2);
51
OIX = create_matrix(max_angmom+1,Oldcalc.max_angmom+1);
52
OIY = create_matrix(max_angmom+1,Oldcalc.max_angmom+1);
53
OIZ = create_matrix(max_angmom+1,Oldcalc.max_angmom+1);
55
/*--- Loop over shells ---*/
56
for(s1=0;s1<num_shells;s1++) {
57
ao1 = first_ao_shell[s1];
58
nprim1 = nprim_in_shell[s1];
59
fprim1 = first_prim_shell[s1];
60
bf1 = first_ao_shell[s1];
61
l1 = shell_ang_mom[s1];
63
atom1 = shell_nucleus[s1];
64
A.x = geometry[atom1][0];
65
A.y = geometry[atom1][1];
66
A.z = geometry[atom1][2];
67
for(s2=0;s2<Oldcalc.num_shells;s2++) {
68
ao2 = Oldcalc.first_ao_shell[s2];
69
nprim2 = Oldcalc.nprim_in_shell[s2];
70
fprim2 = Oldcalc.first_prim_shell[s2];
71
bf2 = Oldcalc.first_ao_shell[s2];
72
l2 = Oldcalc.shell_ang_mom[s2];
74
atom2 = Oldcalc.shell_nucleus[s2];
75
B.x = Oldcalc.geometry[atom2][0];
76
B.y = Oldcalc.geometry[atom2][1];
77
B.z = Oldcalc.geometry[atom2][2];
79
ab2 = (A.x-B.x)*(A.x-B.x);
80
ab2 += (A.y-B.y)*(A.y-B.y);
81
ab2 += (A.z-B.z)*(A.z-B.z);
83
/*--- zero the temporary storage for accumulating contractions ---*/
84
memset(stemp[0],0,sizeof(FLOAT)*maxsz1*maxsz2);
86
/*--- Loop over primitives here ---*/
87
for(p1=0,prim1=fprim1;p1<nprim1;p1++,prim1++) {
88
exp1 = exponents[prim1];
89
cc1 = contr_coeff[prim1];
90
for(p2=0,prim2=fprim2;p2<nprim2;p2++,prim2++) {
91
exp2 = Oldcalc.exponents[prim2];
92
cc2 = Oldcalc.contr_coeff[prim2][l2];
96
P[0] = (exp1*A.x + exp2*B.x)*oog;
97
P[1] = (exp1*A.y + exp2*B.y)*oog;
98
P[2] = (exp1*A.z + exp2*B.z)*oog;
106
pfac = EXP(-exp1*exp2*ab2*oog)*SQRT(M_PI*oog)*M_PI*oog*cc1*cc2;
108
OI_OSrecurs_float(OIX,OIY,OIZ,PA,PB,gam,l1,l2);
110
/*--- create all am components of si ---*/
112
for(ii = 0; ii <= l1; ii++){
114
for(jj = 0; jj <= ii; jj++){
117
/*--- create all am components of sj ---*/
119
for(kk = 0; kk <= l2; kk++){
121
for(ll = 0; ll <= kk; ll++){
125
stemp[ao1][ao2] += pfac*OIX[x1][x2]*OIY[y1][y2]*OIZ[z1][z2];
132
} /*--- end cartesian components for (si,sj) with primitives (i,j) ---*/
134
} /*--- end primitive contraction ---*/
136
/*--- Normalize the contracted integrals and put them into S12 ---*/
137
ptr1 = GTOs.bf_norm[l1];
138
ptr2 = GTOs.bf_norm[l2];
139
for(ii=0; ii<n1; ii++) {
141
for(jj=0; jj<n2; jj++) {
142
S12_AO[bf1+ii][bf2+jj] = stemp[ii][jj]*norm1*ptr2[jj];
147
} /*--- This shell pair is done ---*/
152
delete_matrix(stemp);
154
/*--- transform to SO basis ---*/
155
tmpmat = create_matrix(num_so,Oldcalc.num_ao);
156
usotao_FLOAT = convert_matrix(usotao,num_so,num_ao,0);
157
oldusotao_FLOAT_transp = convert_matrix(Oldcalc.usotao,Oldcalc.num_so,Oldcalc.num_ao,1);
158
matrix_mult(usotao_FLOAT,num_so,num_ao,S12_AO,num_ao,Oldcalc.num_ao,tmpmat);
159
delete_matrix(S12_AO);
160
S12 = create_matrix(num_so,Oldcalc.num_so);
161
matrix_mult(tmpmat,num_so,Oldcalc.num_ao,oldusotao_FLOAT_transp,Oldcalc.num_ao,Oldcalc.num_so,S12);
162
delete_matrix(tmpmat);
167
}} // namespace psi::input