00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _chemistry_qc_libint2_geng12quartetdata_h
00029 #define _chemistry_qc_libint2_geng12quartetdata_h
00030
00031 #include <util/misc/math.h>
00032 #include <chemistry/qc/libint2/static.h>
00033 #include <chemistry/qc/libint2/libint2_utils.h>
00034
00035 #define GENG12_CHECK_INTEGRABILITY 1
00036
00037 namespace sc {
00038
00039
00040
00041
00042
00043
00044
00045
00046 inline void GenG12Libint2::geng12_quartet_data_(prim_data *Data, double scale, double alpha_bra, double alpha_ket, double gamma_bra, double gamma_ket, bool eri_only)
00047 {
00048 #define STATIC_OO2NP1
00049 #include "static.h"
00050
00051 const double alpha = alpha_bra + alpha_ket;
00052 const double gamma = gamma_bra + gamma_ket;
00053 #if 0
00054 if (alpha != 0.0)
00055 ExEnv::out0() << indent << "Not projected out!" << std::endl;
00056 #endif
00057
00058
00059
00060
00061 double P[3], Q[3], PQ[3], W[3];
00062 const double small_T = 1E-15;
00063
00064 const int p1 = quartet_info_.p1;
00065 const int p2 = quartet_info_.p2;
00066 const int p3 = quartet_info_.p3;
00067 const int p4 = quartet_info_.p4;
00068
00069
00070 double a1_shift, a2_shift, a3_shift, a4_shift;
00071 if (quartet_info_.p13p24) {
00072 if (quartet_info_.p12) { a1_shift = alpha_bra; a2_shift = alpha_ket; }
00073 else { a1_shift = alpha_ket; a2_shift = alpha_bra; }
00074 if (quartet_info_.p34) { a3_shift = alpha_bra; a4_shift = alpha_ket; }
00075 else { a3_shift = alpha_ket; a4_shift = alpha_bra; }
00076 }
00077 else {
00078 if (quartet_info_.p12) { a1_shift = alpha_ket; a2_shift = alpha_bra; }
00079 else { a1_shift = alpha_bra; a2_shift = alpha_ket; }
00080 if (quartet_info_.p34) { a3_shift = alpha_ket; a4_shift = alpha_bra; }
00081 else { a3_shift = alpha_bra; a4_shift = alpha_ket; }
00082 }
00083
00084 const double a1 = int_shell1_->exponent(quartet_info_.p1) + a1_shift;
00085 const double a2 = int_shell2_->exponent(quartet_info_.p2) + a2_shift;
00086 const double a3 = int_shell3_->exponent(quartet_info_.p3) + a3_shift;
00087 const double a4 = int_shell4_->exponent(quartet_info_.p4) + a4_shift;
00088
00089
00090
00091
00092 const double zeta = a1+a2;
00093 const double eta = a3+a4;
00094 const double zpe = zeta+eta;
00095
00096
00097 #if GENG12_CHECK_INTEGRABILITY
00098 {
00099 const double zte = zeta*eta;
00100 if ( zte <= 0.0 ||
00101 zte + zpe*gamma <= 0.0 )
00102 ExEnv::out0() << indent << "Integral not defined!" << std::endl;
00103 }
00104 #endif
00105
00106 const double ooz = 1.0/zeta;
00107 const double ooe = 1.0/eta;
00108 const double ooze = 1.0/zpe;
00109 Data->roz[0] = eta*ooze;
00110 const double rho = zeta*Data->roz[0];
00111 const double rhog = rho + gamma;
00112 const double oorhog = 1.0/rhog;
00113 const double rho2 = rho*rho;
00114
00115 for(unsigned int w=0; w<3; ++w) {
00116 P[w] = ooz * (a1 * quartet_info_.A[w] + a2 * quartet_info_.B[w]);
00117 }
00118 for(unsigned int w=0; w<3; ++w) {
00119 Q[w] = ooe * (a3 * quartet_info_.C[w] + a4 * quartet_info_.D[w]);
00120 }
00121
00122 Data->oo2ze[0] = 0.5*ooze;
00123 Data->roe[0] = zeta*ooze;
00124 Data->oo2z[0] = 0.5 * ooz;
00125 Data->oo2e[0] = 0.5 * ooe;
00126 W[0] = (zeta*P[0] + eta*Q[0])*ooze;
00127 W[1] = (zeta*P[1] + eta*Q[1])*ooze;
00128 W[2] = (zeta*P[2] + eta*Q[2])*ooze;
00129
00130
00131 Data->PA_x[0] = P[0] - quartet_info_.A[0];
00132 Data->PA_y[0] = P[1] - quartet_info_.A[1];
00133 Data->PA_z[0] = P[2] - quartet_info_.A[2];
00134
00135 Data->QC_x[0] = Q[0] - quartet_info_.C[0];
00136 Data->QC_y[0] = Q[1] - quartet_info_.C[1];
00137 Data->QC_z[0] = Q[2] - quartet_info_.C[2];
00138
00139 Data->WP_x[0] = W[0] - P[0];
00140 Data->WP_y[0] = W[1] - P[1];
00141 Data->WP_z[0] = W[2] - P[2];
00142
00143 Data->WQ_x[0] = W[0] - Q[0];
00144 Data->WQ_y[0] = W[1] - Q[1];
00145 Data->WQ_z[0] = W[2] - Q[2];
00146
00147 PQ[0] = P[0] - Q[0];
00148 PQ[1] = P[1] - Q[1];
00149 PQ[2] = P[2] - Q[2];
00150 double PQ2 = PQ[0]*PQ[0];
00151 PQ2 += PQ[1]*PQ[1];
00152 PQ2 += PQ[2]*PQ[2];
00153
00154 const prim_pair_t* pair12;
00155 const prim_pair_t* pair34;
00156 if (!quartet_info_.p13p24) {
00157 pair12 = quartet_info_.shell_pair12->prim_pair(*quartet_info_.op1,*quartet_info_.op2);
00158 pair34 = quartet_info_.shell_pair34->prim_pair(*quartet_info_.op3,*quartet_info_.op4);
00159 }
00160 else {
00161 pair12 = quartet_info_.shell_pair34->prim_pair(*quartet_info_.op3,*quartet_info_.op4);
00162 pair34 = quartet_info_.shell_pair12->prim_pair(*quartet_info_.op1,*quartet_info_.op2);
00163 }
00164
00165 const double pfac_norm = int_shell1_->coefficient_unnorm(quartet_info_.gc1,p1)*
00166 int_shell2_->coefficient_unnorm(quartet_info_.gc2,p2)*
00167 int_shell3_->coefficient_unnorm(quartet_info_.gc3,p3)*
00168 int_shell4_->coefficient_unnorm(quartet_info_.gc4,p4);
00169 double ovlp12, ovlp34;
00170 if (alpha == 0.0) {
00171 ovlp12 = pair12->ovlp;
00172 ovlp34 = pair34->ovlp;
00173 }
00174 else {
00175 double AB[3]; for(unsigned int w=0; w<3; ++w) AB[w] = quartet_info_.A[w] - quartet_info_.B[w];
00176 double CD[3]; for(unsigned int w=0; w<3; ++w) CD[w] = quartet_info_.C[w] - quartet_info_.D[w];
00177 double AB2 = 0.0; for(unsigned int w=0; w<3; ++w) AB2 += AB[w] * AB[w];
00178 double CD2 = 0.0; for(unsigned int w=0; w<3; ++w) CD2 += CD[w] * CD[w];
00179 const double t12 = M_PI*ooz;
00180 const double t34 = M_PI*ooe;
00181 ovlp12 = t12 * sqrt(t12) * exp(-a1*a2*AB2*ooz);
00182 ovlp34 = t34 * sqrt(t34) * exp(-a3*a4*CD2*ooe);
00183 }
00184 const double pfac_normovlp = pfac_norm * ovlp12 * ovlp34 * scale;
00185
00186 if (eri_only) {
00187 double T = rho*PQ2;
00188 double pfac = 2.0*sqrt(rho*M_1_PI)*pfac_normovlp;
00189 if(T < small_T){
00190 assign_FjT(Data,quartet_info_.am,oo2np1,pfac);
00191 }
00192 else {
00193 double *fjttable = Fm_Eval_->values(quartet_info_.am,T);
00194 assign_FjT(Data,quartet_info_.am,fjttable,pfac);
00195 }
00196 return;
00197 }
00198
00199
00200 double T = rho2 * oorhog * PQ2;
00201
00202
00203
00204
00205 double rorg = rho * oorhog;
00206 double sqrt_rorg = sqrt(rorg);
00207 Data->LIBINT_T_SS_K0G12_SS_0[0] = rorg * sqrt_rorg * exp(-gamma*rorg*PQ2) * pfac_normovlp;
00208 Data->LIBINT_T_SS_K2G12_SS_0[0] = (1.5 + T) * Data->LIBINT_T_SS_K0G12_SS_0[0] * oorhog;
00209
00210
00211
00212
00213 double pfac = 2.0 * sqrt(rhog*M_1_PI) * Data->LIBINT_T_SS_K0G12_SS_0[0];
00214
00215 const double *F;
00216 if(T < small_T){
00217 F = oo2np1;
00218 }
00219 else {
00220 F = Fm_Eval_->values(quartet_info_.am,T);
00221 }
00222
00223 double ss_m1_ss[4*LIBINT2_MAX_AM_GENG12+1];
00224 double g_i[4*LIBINT2_MAX_AM_GENG12+1];
00225 double r_i[4*LIBINT2_MAX_AM_GENG12+1];
00226 double oorhog_i[4*LIBINT2_MAX_AM_GENG12+1];
00227 g_i[0] = 1.0;
00228 r_i[0] = 1.0;
00229 oorhog_i[0] = 1.0;
00230 for(int i=1; i<=quartet_info_.am; i++) {
00231 g_i[i] = g_i[i-1] * gamma;
00232 r_i[i] = r_i[i-1] * rho;
00233 oorhog_i[i] = oorhog_i[i-1] * oorhog;
00234 }
00235 for(int m=0; m<=quartet_info_.am; m++) {
00236 double ssss = 0.0;
00237 for(int k=0; k<=m; k++) {
00238 ssss += ExpMath_.bc[m][k] * r_i[k] * g_i[m-k] * F[k];
00239 }
00240 ss_m1_ss[m] = ssss * oorhog_i[m];
00241 }
00242
00243 assign_ss_r12m1g12_ss(Data,quartet_info_.am,ss_m1_ss,pfac);
00244
00245
00246
00247
00248
00249 {
00250 double u0 = 0.5/(zeta*eta + gamma*(zeta+eta));
00251
00252 {
00253 double t00 = a2*(eta + gamma);
00254 double t01 = gamma*a4;
00255 double t02 = gamma*eta;
00256 double T[3];
00257 for(int w=0;w<3; w++) {
00258 T[w] = -2.0 * u0 * (t00*(quartet_info_.A[w]-quartet_info_.B[w]) +
00259 t01*(quartet_info_.C[w]-quartet_info_.D[w]) +
00260 t02*(quartet_info_.A[w]-quartet_info_.C[w]));
00261 }
00262 Data->R12kG12_pfac0_0_x[0] = T[0];
00263 Data->R12kG12_pfac0_0_y[0] = T[1];
00264 Data->R12kG12_pfac0_0_z[0] = T[2];
00265 }
00266 {
00267 double t00 = a4*(zeta + gamma);
00268 double t01 = gamma*a2;
00269 double t02 = gamma*zeta;
00270 double T[3];
00271 for(int w=0;w<3; w++) {
00272 T[w] = -2.0 * u0 * (t00*(quartet_info_.C[w]-quartet_info_.D[w]) +
00273 t01*(quartet_info_.A[w]-quartet_info_.B[w]) +
00274 t02*(quartet_info_.C[w]-quartet_info_.A[w]));
00275 }
00276 Data->R12kG12_pfac0_1_x[0] = T[0];
00277 Data->R12kG12_pfac0_1_y[0] = T[1];
00278 Data->R12kG12_pfac0_1_z[0] = T[2];
00279 }
00280 {
00281 Data->R12kG12_pfac1_0[0] = u0 * (eta + gamma);
00282 Data->R12kG12_pfac1_1[0] = u0 * (zeta + gamma);
00283 }
00284 {
00285 Data->R12kG12_pfac2[0] = u0 * gamma;
00286 }
00287 {
00288 Data->R12kG12_pfac3_0[0] = eta*u0;
00289 Data->R12kG12_pfac3_1[0] = zeta*u0;
00290 }
00291 {
00292 double T[3];
00293 for(int w=0;w<3; w++) {
00294 T[w] = quartet_info_.A[w]-quartet_info_.C[w];
00295 }
00296 Data->R12kG12_pfac4_0_x[0] = T[0];
00297 Data->R12kG12_pfac4_0_y[0] = T[1];
00298 Data->R12kG12_pfac4_0_z[0] = T[2];
00299 Data->R12kG12_pfac4_1_x[0] = -T[0];
00300 Data->R12kG12_pfac4_1_y[0] = -T[1];
00301 Data->R12kG12_pfac4_1_z[0] = -T[2];
00302 }
00303 }
00304
00305 return;
00306 }
00307
00308 }
00309
00310 #endif
00311
00312
00313
00314
00315