28 #include <util/misc/math.h>
29 #include <chemistry/qc/libint2/static.h>
30 #include <chemistry/qc/libint2/libint2_utils.h>
32 #ifndef _chemistry_qc_libint2_g12quartetdata_h
33 #define _chemistry_qc_libint2_g12quartetdata_h
42 inline void G12Libint2::g12_quartet_data_(prim_data *Data,
double scale,
double gamma,
double g2_4,
bool eri_only)
50 double P[3], Q[3], PQ[3], W[3];
51 double small_T = 1E-15;
53 int p1 = quartet_info_.p1;
54 int p2 = quartet_info_.p2;
55 int p3 = quartet_info_.p3;
56 int p4 = quartet_info_.p4;
58 double a1 = int_shell1_->exponent(quartet_info_.p1);
59 double a2 = int_shell2_->exponent(quartet_info_.p2);
60 double a3 = int_shell3_->exponent(quartet_info_.p3);
61 double a4 = int_shell4_->exponent(quartet_info_.p4);
65 if (!quartet_info_.p13p24) {
66 pair12 = quartet_info_.shell_pair12->prim_pair(*quartet_info_.op1,*quartet_info_.op2);
67 pair34 = quartet_info_.shell_pair34->prim_pair(*quartet_info_.op3,*quartet_info_.op4);
70 pair12 = quartet_info_.shell_pair34->prim_pair(*quartet_info_.op3,*quartet_info_.op4);
71 pair34 = quartet_info_.shell_pair12->prim_pair(*quartet_info_.op1,*quartet_info_.op2);
77 #if LIBINT2_DEFINED(g12,zeta_A)
80 #if LIBINT2_DEFINED(g12,zeta_B)
83 #if LIBINT2_DEFINED(g12,zeta_C)
86 #if LIBINT2_DEFINED(g12,zeta_D)
89 #if LIBINT2_DEFINED(g12,zeta_A_2)
90 Data->zeta_A_2[0] = a1*a1;
92 #if LIBINT2_DEFINED(g12,zeta_B_2)
93 Data->zeta_B_2[0] = a2*a2;
95 #if LIBINT2_DEFINED(g12,zeta_C_2)
96 Data->zeta_C_2[0] = a3*a3;
98 #if LIBINT2_DEFINED(g12,zeta_D_2)
99 Data->zeta_D_2[0] = a4*a4;
101 #if LIBINT2_DEFINED(g12,gamma)
102 Data->gamma[0] = gamma;
104 #if LIBINT2_DEFINED(g12,R12_2_G12_scale_to_G12T1G12)
105 Data->R12_2_G12_scale_to_G12T1G12[0] = g2_4;
111 double zeta = pair12->gamma;
112 double eta = pair34->gamma;
113 double ooz = 1.0/zeta;
114 double ooe = 1.0/eta;
115 double ooze = 1.0/(zeta+eta);
116 Data->roz[0] = eta*ooze;
117 double rho = zeta*Data->roz[0];
118 double rhog = rho + gamma;
119 double oorhog = 1.0/rhog;
120 double rho2 = rho*rho;
129 Data->oo2ze[0] = 0.5*ooze;
130 Data->roe[0] = zeta*ooze;
131 Data->oo2z[0] = 0.5 * ooz;
132 Data->oo2e[0] = 0.5 * ooe;
133 W[0] = (zeta*P[0] + eta*Q[0])*ooze;
134 W[1] = (zeta*P[1] + eta*Q[1])*ooze;
135 W[2] = (zeta*P[2] + eta*Q[2])*ooze;
138 Data->PA_x[0] = P[0] - quartet_info_.A[0];
139 Data->PA_y[0] = P[1] - quartet_info_.A[1];
140 Data->PA_z[0] = P[2] - quartet_info_.A[2];
142 Data->QC_x[0] = Q[0] - quartet_info_.C[0];
143 Data->QC_y[0] = Q[1] - quartet_info_.C[1];
144 Data->QC_z[0] = Q[2] - quartet_info_.C[2];
146 Data->WP_x[0] = W[0] - P[0];
147 Data->WP_y[0] = W[1] - P[1];
148 Data->WP_z[0] = W[2] - P[2];
150 Data->WQ_x[0] = W[0] - Q[0];
151 Data->WQ_y[0] = W[1] - Q[1];
152 Data->WQ_z[0] = W[2] - Q[2];
155 #if LIBINT2_DEFINED(g12,AC_x)
156 Data->AC_x[0] = quartet_info_.A[0] - quartet_info_.C[0];
158 #if LIBINT2_DEFINED(g12,AC_y)
159 Data->AC_y[0] = quartet_info_.A[1] - quartet_info_.C[1];
161 #if LIBINT2_DEFINED(g12,AC_z)
162 Data->AC_z[0] = quartet_info_.A[2] - quartet_info_.C[2];
165 #if LIBINT2_DEFINED(g12,BD_x)
166 Data->BD_x[0] = quartet_info_.B[0] - quartet_info_.D[0];
168 #if LIBINT2_DEFINED(g12,BD_y)
169 Data->BD_y[0] = quartet_info_.B[1] - quartet_info_.D[1];
171 #if LIBINT2_DEFINED(g12,BD_z)
172 Data->BD_z[0] = quartet_info_.B[2] - quartet_info_.D[2];
178 double PQ2 = PQ[0]*PQ[0];
182 const double pfac_norm = int_shell1_->coefficient_unnorm(quartet_info_.gc1,p1)*
183 int_shell2_->coefficient_unnorm(quartet_info_.gc2,p2)*
184 int_shell3_->coefficient_unnorm(quartet_info_.gc3,p3)*
185 int_shell4_->coefficient_unnorm(quartet_info_.gc4,p4);
186 const double pfac_normovlp = pfac_norm * pair12->ovlp * pair34->ovlp * scale;
190 double pfac = 2.0*sqrt(rho*M_1_PI)*pfac_normovlp;
192 assign_FjT(Data,quartet_info_.am,oo2np1,pfac);
195 double *fjttable = Fm_Eval_->values(quartet_info_.am,T);
196 assign_FjT(Data,quartet_info_.am,fjttable,pfac);
202 double T = rho2 * oorhog * PQ2;
207 double rorg = rho * oorhog;
208 double sqrt_rorg = sqrt(rorg);
209 Data->LIBINT_T_SS_K0G12_SS_0[0] = rorg * sqrt_rorg * exp(-gamma*rorg*PQ2) * pfac_normovlp;
210 Data->LIBINT_T_SS_K2G12_SS_0[0] = (1.5 + T) * Data->LIBINT_T_SS_K0G12_SS_0[0] * oorhog;
215 double pfac = 2.0 * sqrt(rhog*M_1_PI) * Data->LIBINT_T_SS_K0G12_SS_0[0];
222 F = Fm_Eval_->values(quartet_info_.am,T);
225 double ss_m1_ss[4*LIBINT2_MAX_AM_R12kG12+1];
226 double g_i[4*LIBINT2_MAX_AM_R12kG12+1];
227 double r_i[4*LIBINT2_MAX_AM_R12kG12+1];
228 double oorhog_i[4*LIBINT2_MAX_AM_R12kG12+1];
232 for(
int i=1; i<=quartet_info_.am; i++) {
233 g_i[i] = g_i[i-1] * gamma;
234 r_i[i] = r_i[i-1] * rho;
235 oorhog_i[i] = oorhog_i[i-1] * oorhog;
237 for(
int m=0; m<=quartet_info_.am; m++) {
239 for(
int k=0; k<=m; k++) {
240 ssss += ExpMath_.bc[m][k] * r_i[k] * g_i[m-k] * F[k];
242 ss_m1_ss[m] = ssss * oorhog_i[m];
245 assign_ss_r12m1g12_ss(Data,quartet_info_.am,ss_m1_ss,pfac);
252 double u0 = 0.5/(zeta*eta + gamma*(zeta+eta));
255 double t00 = a2*(eta + gamma);
256 double t01 = gamma*a4;
257 double t02 = gamma*eta;
259 for(
int w=0;w<3; w++) {
260 T[w] = -2.0 * u0 * (t00*(quartet_info_.A[w]-quartet_info_.B[w]) +
261 t01*(quartet_info_.C[w]-quartet_info_.D[w]) +
262 t02*(quartet_info_.A[w]-quartet_info_.C[w]));
264 Data->R12kG12_pfac0_0_x[0] = T[0];
265 Data->R12kG12_pfac0_0_y[0] = T[1];
266 Data->R12kG12_pfac0_0_z[0] = T[2];
269 double t00 = a4*(zeta + gamma);
270 double t01 = gamma*a2;
271 double t02 = gamma*zeta;
273 for(
int w=0;w<3; w++) {
274 T[w] = -2.0 * u0 * (t00*(quartet_info_.C[w]-quartet_info_.D[w]) +
275 t01*(quartet_info_.A[w]-quartet_info_.B[w]) +
276 t02*(quartet_info_.C[w]-quartet_info_.A[w]));
278 Data->R12kG12_pfac0_1_x[0] = T[0];
279 Data->R12kG12_pfac0_1_y[0] = T[1];
280 Data->R12kG12_pfac0_1_z[0] = T[2];
283 Data->R12kG12_pfac1_0[0] = u0 * (eta + gamma);
284 Data->R12kG12_pfac1_1[0] = u0 * (zeta + gamma);
287 Data->R12kG12_pfac2[0] = u0 * gamma;
290 Data->R12kG12_pfac3_0[0] = eta*u0;
291 Data->R12kG12_pfac3_1[0] = zeta*u0;
295 for(
int w=0;w<3; w++) {
296 T[w] = quartet_info_.A[w]-quartet_info_.C[w];
298 Data->R12kG12_pfac4_0_x[0] = T[0];
299 Data->R12kG12_pfac4_0_y[0] = T[1];
300 Data->R12kG12_pfac4_0_z[0] = T[2];
301 Data->R12kG12_pfac4_1_x[0] = -T[0];
302 Data->R12kG12_pfac4_1_y[0] = -T[1];
303 Data->R12kG12_pfac4_1_z[0] = -T[2];