MPQC  3.0.0-alpha
g12_quartet_data.h
1 //
2 // g12_quartet_data.h
3 //
4 // Copyright (C) 2005 Edward Valeev
5 //
6 // Author: Edward Valeev <evaleev@vt.edu>
7 // Maintainer: EV
8 //
9 // This file is part of the SC Toolkit.
10 //
11 // The SC Toolkit is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU Library General Public License as published by
13 // the Free Software Foundation; either version 2, or (at your option)
14 // any later version.
15 //
16 // The SC Toolkit is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU Library General Public License for more details.
20 //
21 // You should have received a copy of the GNU Library General Public License
22 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 //
25 // The U.S. Government is granted a limited license as per AL 91-7.
26 //
27 
28 #include <util/misc/math.h>
29 #include <chemistry/qc/libint2/static.h>
30 #include <chemistry/qc/libint2/libint2_utils.h>
31 
32 #ifndef _chemistry_qc_libint2_g12quartetdata_h
33 #define _chemistry_qc_libint2_g12quartetdata_h
34 
35 namespace sc {
36 
37 /*--------------------------------------------------------------------------------
38  This function computes constants used in OSRR for a given quartet of primitives
39 
40  gamma is the exponent of the Gaussian geminal in the integral
41  --------------------------------------------------------------------------------*/
42 inline void G12Libint2::g12_quartet_data_(prim_data *Data, double scale, double gamma, double g2_4, bool eri_only)
43 {
44 #define STATIC_OO2NP1
45 #include "static.h"
46 
47  /*----------------
48  Local variables
49  ----------------*/
50  double P[3], Q[3], PQ[3], W[3];
51  double small_T = 1E-15; /*--- Use only one term in Taylor expansion of Fj(T) if T < small_T ---*/
52 
53  int p1 = quartet_info_.p1;
54  int p2 = quartet_info_.p2;
55  int p3 = quartet_info_.p3;
56  int p4 = quartet_info_.p4;
57 
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);
62 
63  prim_pair_t* pair12;
64  prim_pair_t* pair34;
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);
68  }
69  else {
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);
72  }
73 
74  //
75  // Prefactors for [T_i,g12] integrals
76  //
77 #if LIBINT2_DEFINED(g12,zeta_A)
78  Data->zeta_A[0] = a1;
79 #endif
80 #if LIBINT2_DEFINED(g12,zeta_B)
81  Data->zeta_B[0] = a2;
82 #endif
83 #if LIBINT2_DEFINED(g12,zeta_C)
84  Data->zeta_C[0] = a3;
85 #endif
86 #if LIBINT2_DEFINED(g12,zeta_D)
87  Data->zeta_D[0] = a4;
88 #endif
89 #if LIBINT2_DEFINED(g12,zeta_A_2)
90  Data->zeta_A_2[0] = a1*a1;
91 #endif
92 #if LIBINT2_DEFINED(g12,zeta_B_2)
93  Data->zeta_B_2[0] = a2*a2;
94 #endif
95 #if LIBINT2_DEFINED(g12,zeta_C_2)
96  Data->zeta_C_2[0] = a3*a3;
97 #endif
98 #if LIBINT2_DEFINED(g12,zeta_D_2)
99  Data->zeta_D_2[0] = a4*a4;
100 #endif
101 #if LIBINT2_DEFINED(g12,gamma)
102  Data->gamma[0] = gamma;
103 #endif
104 #if LIBINT2_DEFINED(g12,R12_2_G12_scale_to_G12T1G12)
105  Data->R12_2_G12_scale_to_G12T1G12[0] = g2_4;
106 #endif
107 
108  //
109  // prefactors for (ab|-1|cd) are same as for OSRR, only (00|-1|00)^m are different
110  //
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;
121 
122  P[0] = pair12->P[0];
123  P[1] = pair12->P[1];
124  P[2] = pair12->P[2];
125  Q[0] = pair34->P[0];
126  Q[1] = pair34->P[1];
127  Q[2] = pair34->P[2];
128 
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;
136 
137  /* PA */
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];
141  /* QC */
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];
145  /* WP */
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];
149  /* WQ */
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];
153 
154  /* AC */
155 #if LIBINT2_DEFINED(g12,AC_x)
156  Data->AC_x[0] = quartet_info_.A[0] - quartet_info_.C[0];
157 #endif
158 #if LIBINT2_DEFINED(g12,AC_y)
159  Data->AC_y[0] = quartet_info_.A[1] - quartet_info_.C[1];
160 #endif
161 #if LIBINT2_DEFINED(g12,AC_z)
162  Data->AC_z[0] = quartet_info_.A[2] - quartet_info_.C[2];
163 #endif
164  /* BD */
165 #if LIBINT2_DEFINED(g12,BD_x)
166  Data->BD_x[0] = quartet_info_.B[0] - quartet_info_.D[0];
167 #endif
168 #if LIBINT2_DEFINED(g12,BD_y)
169  Data->BD_y[0] = quartet_info_.B[1] - quartet_info_.D[1];
170 #endif
171 #if LIBINT2_DEFINED(g12,BD_z)
172  Data->BD_z[0] = quartet_info_.B[2] - quartet_info_.D[2];
173 #endif
174 
175  PQ[0] = P[0] - Q[0];
176  PQ[1] = P[1] - Q[1];
177  PQ[2] = P[2] - Q[2];
178  double PQ2 = PQ[0]*PQ[0];
179  PQ2 += PQ[1]*PQ[1];
180  PQ2 += PQ[2]*PQ[2];
181 
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;
187 
188  if (eri_only) {
189  double T = rho*PQ2;
190  double pfac = 2.0*sqrt(rho*M_1_PI)*pfac_normovlp;
191  if(T < small_T){
192  assign_FjT(Data,quartet_info_.am,oo2np1,pfac);
193  }
194  else {
195  double *fjttable = Fm_Eval_->values(quartet_info_.am,T);
196  assign_FjT(Data,quartet_info_.am,fjttable,pfac);
197  }
198  return;
199  }
200 
201  // else, if need other integrals
202  double T = rho2 * oorhog * PQ2;
203 
204  //
205  // (00|0|00) and (00|2|00) need to start recursion for (ab|0|cd), (ab|2|cd), and [T_i,G12]
206  //
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;
211 
212  //
213  // compute (00|-1|00)^m from Fj(x)
214  //
215  double pfac = 2.0 * sqrt(rhog*M_1_PI) * Data->LIBINT_T_SS_K0G12_SS_0[0];
216 
217  const double *F;
218  if(T < small_T){
219  F = oo2np1;
220  }
221  else {
222  F = Fm_Eval_->values(quartet_info_.am,T);
223  }
224 
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];
229  g_i[0] = 1.0;
230  r_i[0] = 1.0;
231  oorhog_i[0] = 1.0;
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;
236  }
237  for(int m=0; m<=quartet_info_.am; m++) {
238  double ssss = 0.0;
239  for(int k=0; k<=m; k++) {
240  ssss += ExpMath_.bc[m][k] * r_i[k] * g_i[m-k] * F[k];
241  }
242  ss_m1_ss[m] = ssss * oorhog_i[m];
243  }
244 
245  assign_ss_r12m1g12_ss(Data,quartet_info_.am,ss_m1_ss,pfac);
246 
247 
248  //
249  // prefactors for (a0|k|c0) (k!=-1) VRR
250  //
251  {
252  double u0 = 0.5/(zeta*eta + gamma*(zeta+eta));
253 
254  {
255  double t00 = a2*(eta + gamma);
256  double t01 = gamma*a4;
257  double t02 = gamma*eta;
258  double T[3];
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]));
263  }
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];
267  }
268  {
269  double t00 = a4*(zeta + gamma);
270  double t01 = gamma*a2;
271  double t02 = gamma*zeta;
272  double T[3];
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]));
277  }
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];
281  }
282  {
283  Data->R12kG12_pfac1_0[0] = u0 * (eta + gamma);
284  Data->R12kG12_pfac1_1[0] = u0 * (zeta + gamma);
285  }
286  {
287  Data->R12kG12_pfac2[0] = u0 * gamma;
288  }
289  {
290  Data->R12kG12_pfac3_0[0] = eta*u0;
291  Data->R12kG12_pfac3_1[0] = zeta*u0;
292  }
293  {
294  double T[3];
295  for(int w=0;w<3; w++) {
296  T[w] = quartet_info_.A[w]-quartet_info_.C[w];
297  }
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];
304  }
305  }
306 
307  return;
308 }
309 
310 }
311 
312 #endif
313 
314 // Local Variables:
315 // mode: c++
316 // c-file-style: "CLJ"
317 // End:
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14

Generated at Sun Jan 26 2020 23:23:58 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.