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_g12ncquartetdata_h
33 #define _chemistry_qc_libint2_g12ncquartetdata_h
45 inline void G12NCLibint2::g12nc_quartet_data_(prim_data *Data,
double scale, OperType otype,
46 const ContractedGeminal* gbra,
const ContractedGeminal* gket)
54 double P[3], Q[3], PQ[3], W[3];
55 const double small_T = 1E-15;
57 const int p1 = quartet_info_.p1;
58 const int p2 = quartet_info_.p2;
59 const int p3 = quartet_info_.p3;
60 const int p4 = quartet_info_.p4;
62 const double a1 = int_shell1_->
exponent(quartet_info_.p1);
63 const double a2 = int_shell2_->
exponent(quartet_info_.p2);
64 const double a3 = int_shell3_->
exponent(quartet_info_.p3);
65 const double a4 = int_shell4_->
exponent(quartet_info_.p4);
69 if (!quartet_info_.p13p24) {
70 pair12 = quartet_info_.shell_pair12->prim_pair(*quartet_info_.op1,*quartet_info_.op2);
71 pair34 = quartet_info_.shell_pair34->prim_pair(*quartet_info_.op3,*quartet_info_.op4);
74 pair12 = quartet_info_.shell_pair34->prim_pair(*quartet_info_.op3,*quartet_info_.op4);
75 pair34 = quartet_info_.shell_pair12->prim_pair(*quartet_info_.op1,*quartet_info_.op2);
81 const double zeta = pair12->gamma;
82 const double eta = pair34->gamma;
83 const double ooz = 1.0/zeta;
84 const double ooe = 1.0/eta;
85 const double ooze = 1.0/(zeta+eta);
86 #if LIBINT2_DEFINED(eri,roz)
87 Data->roz[0] = eta*ooze;
88 double rho = zeta*Data->roz[0];
90 double rho = zeta * eta * ooze;
97 const double pfac_normovlp = pfac_norm * pair12->ovlp * pair34->ovlp * scale;
109 const double PQ2 = PQ[0]*PQ[0] + PQ[1]*PQ[1] + PQ[2]*PQ[2];
110 const double T = rho*PQ2;
113 if (otype == coulomb) {
114 double pfac = 2.0*sqrt(rho*M_1_PI)*pfac_normovlp;
116 assign_FjT(Data,quartet_info_.am,oo2np1,pfac);
119 Fm_Eval_->eval(Fm_table_,T,quartet_info_.am);
120 assign_FjT(Data,quartet_info_.am,Fm_table_,pfac);
126 double ss_oper_ss[4*LIBINT2_MAX_AM_eri+1];
127 std::fill(ss_oper_ss, ss_oper_ss + quartet_info_.am + 1, 0.0);
130 if (otype == f12 || otype == f12_coulomb) {
132 MPQC_ASSERT(gbra != 0);
133 const size_t ngbra = gbra->size();
134 for(
size_t ig=0; ig<ngbra; ++ig) {
135 const PrimitiveGeminal& gbra_i = gbra->operator[](ig);
136 const double gamma = gbra_i.first;
137 const double gcoef = gbra_i.second;
138 const double rhog = rho + gamma;
139 const double oorhog = 1.0/rhog;
141 const double gorg = gamma * oorhog;
142 const double rorg = rho * oorhog;
143 const double sqrt_rorg = sqrt(rorg);
145 const double SS_K0G12_SS = rorg * sqrt_rorg * exp(-gorg*T) * pfac_normovlp;
147 if (otype == f12_coulomb) {
148 const double rorgT = rorg * T;
149 double pfac = 2.0 * sqrt(rhog*M_1_PI) * SS_K0G12_SS;
156 Fm_Eval_->eval(Fm_table_,rorgT,quartet_info_.am);
160 double g_i[4*LIBINT2_MAX_AM_eri+1];
161 double r_i[4*LIBINT2_MAX_AM_eri+1];
162 double oorhog_i[4*LIBINT2_MAX_AM_eri+1];
166 for(
int i=1; i<=quartet_info_.am; i++) {
167 g_i[i] = g_i[i-1] * gamma;
168 r_i[i] = r_i[i-1] * rho;
169 oorhog_i[i] = oorhog_i[i-1] * oorhog;
171 for(
int m=0; m<=quartet_info_.am; m++) {
173 for(
int k=0; k<=m; k++) {
174 ssss += ExpMath_.bc[m][k] * r_i[k] * g_i[m-k] * F[k];
176 ss_oper_ss[m] += gcoef * pfac * ssss * oorhog_i[m];
183 double ss_oper_ss_m = SS_K0G12_SS * gcoef;
184 ss_oper_ss[0] += ss_oper_ss_m;
185 for(
int m=1; m<=quartet_info_.am; ++m) {
186 ss_oper_ss_m *= gorg;
187 ss_oper_ss[m] += ss_oper_ss_m;
196 if (otype == f12_2 || otype == f12_T1_f12) {
198 MPQC_ASSERT(gbra != 0);
199 MPQC_ASSERT(gket != 0);
200 const size_t ngbra = gbra->size();
201 const size_t ngket = gket->size();
202 for(
size_t igbra=0; igbra<ngbra; ++igbra) {
203 const PrimitiveGeminal& gbra_i = gbra->operator[](igbra);
204 const double gamma_bra = gbra_i.first;
205 const double gcoef_bra = gbra_i.second;
206 for(
size_t igket=0; igket<ngket; ++igket) {
207 const PrimitiveGeminal& gket_i = gket->operator[](igket);
208 const double gamma_ket = gket_i.first;
209 const double gcoef_ket = gket_i.second;
211 const double gamma = gamma_bra + gamma_ket;
212 const double gcoef = gcoef_bra * gcoef_ket;
214 const double rhog = rho + gamma;
215 const double oorhog = 1.0/rhog;
217 const double gorg = gamma * oorhog;
218 const double rorg = rho * oorhog;
219 const double sqrt_rorg = sqrt(rorg);
221 const double SS_K0G12_SS = rorg * sqrt_rorg * exp(-gorg*T) * pfac_normovlp;
222 const double rorgT = rorg * T;
224 const double SS_K2G12_SS_0 = (1.5 + rorgT) * (SS_K0G12_SS * oorhog);
225 const double SS_K2G12_SS_m1 = rorg * (SS_K0G12_SS * oorhog);
227 if (otype == f12_2) {
229 double ss_oper_ss_m = SS_K0G12_SS * gcoef;
230 ss_oper_ss[0] += ss_oper_ss_m;
231 for(
int m=1; m<=quartet_info_.am; ++m) {
232 ss_oper_ss_m *= gorg;
233 ss_oper_ss[m] += ss_oper_ss_m;
238 if (otype == f12_T1_f12) {
240 double SS_K2G12_SS_gorg_m = SS_K2G12_SS_0 * (gcoef * 4.0 * gamma_bra * gamma_ket);
241 double SS_K2G12_SS_gorg_m1 = SS_K2G12_SS_m1 * (gcoef * 4.0 * gamma_bra * gamma_ket);
242 ss_oper_ss[0] += SS_K2G12_SS_gorg_m;
243 for(
int m=1; m<=quartet_info_.am; ++m) {
244 SS_K2G12_SS_gorg_m *= gorg;
245 ss_oper_ss[m] += SS_K2G12_SS_gorg_m - m * SS_K2G12_SS_gorg_m1;
246 SS_K2G12_SS_gorg_m1 *= gorg;
256 assign_FjT(Data,quartet_info_.am,ss_oper_ss,1.0);
261 if (quartet_info_.am != 0) {
262 #if LIBINT2_DEFINED(eri,oo2ze)
263 Data->oo2ze[0] = 0.5 * ooze;
265 #if LIBINT2_DEFINED(eri,roe)
266 Data->roe[0] = zeta * ooze;
268 #if LIBINT2_DEFINED(eri,oo2z)
269 Data->oo2z[0] = 0.5 * ooz;
271 #if LIBINT2_DEFINED(eri,oo2e)
272 Data->oo2e[0] = 0.5 * ooe;
274 W[0] = (zeta * P[0] + eta * Q[0]) * ooze;
275 W[1] = (zeta * P[1] + eta * Q[1]) * ooze;
276 W[2] = (zeta * P[2] + eta * Q[2]) * ooze;
279 #if LIBINT2_DEFINED(eri,PA_x)
280 Data->PA_x[0] = P[0] - quartet_info_.A[0];
282 #if LIBINT2_DEFINED(eri,PA_y)
283 Data->PA_y[0] = P[1] - quartet_info_.A[1];
285 #if LIBINT2_DEFINED(eri,PA_z)
286 Data->PA_z[0] = P[2] - quartet_info_.A[2];
289 #if LIBINT2_DEFINED(eri,QC_x)
290 Data->QC_x[0] = Q[0] - quartet_info_.C[0];
292 #if LIBINT2_DEFINED(eri,QC_y)
293 Data->QC_y[0] = Q[1] - quartet_info_.C[1];
295 #if LIBINT2_DEFINED(eri,QC_z)
296 Data->QC_z[0] = Q[2] - quartet_info_.C[2];
299 #if LIBINT2_DEFINED(eri,WP_x)
300 Data->WP_x[0] = W[0] - P[0];
302 #if LIBINT2_DEFINED(eri,WP_y)
303 Data->WP_y[0] = W[1] - P[1];
305 #if LIBINT2_DEFINED(eri,WP_z)
306 Data->WP_z[0] = W[2] - P[2];
309 #if LIBINT2_DEFINED(eri,WQ_x)
310 Data->WQ_x[0] = W[0] - Q[0];
312 #if LIBINT2_DEFINED(eri,WQ_y)
313 Data->WQ_y[0] = W[1] - Q[1];
315 #if LIBINT2_DEFINED(eri,WQ_z)
316 Data->WQ_z[0] = W[2] - Q[2];
320 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_0_0_x)
321 Data->TwoPRepITR_pfac0_0_0_x[0] = - (a2*(quartet_info_.A[0]-quartet_info_.B[0]) + a4*(quartet_info_.C[0]-quartet_info_.D[0]))/zeta;
323 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_0_0_y)
324 Data->TwoPRepITR_pfac0_0_0_y[0] = - (a2*(quartet_info_.A[1]-quartet_info_.B[1]) + a4*(quartet_info_.C[1]-quartet_info_.D[1]))/zeta;
326 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_0_0_z)
327 Data->TwoPRepITR_pfac0_0_0_z[0] = - (a2*(quartet_info_.A[2]-quartet_info_.B[2]) + a4*(quartet_info_.C[2]-quartet_info_.D[2]))/zeta;
329 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_1_0_x)
330 Data->TwoPRepITR_pfac0_1_0_x[0] = - (a2*(quartet_info_.A[0]-quartet_info_.B[0]) + a4*(quartet_info_.C[0]-quartet_info_.D[0]))/eta;
332 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_1_0_y)
333 Data->TwoPRepITR_pfac0_1_0_y[0] = - (a2*(quartet_info_.A[1]-quartet_info_.B[1]) + a4*(quartet_info_.C[1]-quartet_info_.D[1]))/eta;
335 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_1_0_z)
336 Data->TwoPRepITR_pfac0_1_0_z[0] = - (a2*(quartet_info_.A[2]-quartet_info_.B[2]) + a4*(quartet_info_.C[2]-quartet_info_.D[2]))/eta;
338 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_0_1_x)
339 Data->TwoPRepITR_pfac0_0_1_x[0] = (a1*(quartet_info_.A[0]-quartet_info_.B[0]) + a3*(quartet_info_.C[0]-quartet_info_.D[0]))/zeta;
341 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_0_1_y)
342 Data->TwoPRepITR_pfac0_0_1_y[0] = (a1*(quartet_info_.A[1]-quartet_info_.B[1]) + a3*(quartet_info_.C[1]-quartet_info_.D[1]))/zeta;
344 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_0_1_z)
345 Data->TwoPRepITR_pfac0_0_1_z[0] = (a1*(quartet_info_.A[2]-quartet_info_.B[2]) + a3*(quartet_info_.C[2]-quartet_info_.D[2]))/zeta;
347 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_1_1_x)
348 Data->TwoPRepITR_pfac0_1_1_x[0] = (a1*(quartet_info_.A[0]-quartet_info_.B[0]) + a3*(quartet_info_.C[0]-quartet_info_.D[0]))/eta;
350 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_1_1_y)
351 Data->TwoPRepITR_pfac0_1_1_y[0] = (a1*(quartet_info_.A[1]-quartet_info_.B[1]) + a3*(quartet_info_.C[1]-quartet_info_.D[1]))/eta;
353 #if LIBINT2_DEFINED(eri,TwoPRepITR_pfac0_1_1_z)
354 Data->TwoPRepITR_pfac0_1_1_z[0] = (a1*(quartet_info_.A[2]-quartet_info_.B[2]) + a3*(quartet_info_.C[2]-quartet_info_.D[2]))/eta;
356 #if LIBINT2_DEFINED(eri,eoz)
357 Data->eoz[0] = eta * ooz;
359 #if LIBINT2_DEFINED(eri,zoe)
360 Data->zoe[0] = zeta * ooe;