mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-08-25 13:41:47 +02:00
non_h_ints compiles
This commit is contained in:
parent
17d8197a67
commit
4472a6d9be
@ -46,142 +46,327 @@ double precision function NAI_pol_mult_erf_ao(i_ao,j_ao,mu_in,C_center)
|
||||
|
||||
end
|
||||
|
||||
double precision function NAI_pol_mult_erf(A_center, B_center, power_A, power_B, alpha, beta, C_center, n_pt_in, mu_in)
|
||||
|
||||
|
||||
double precision function NAI_pol_mult_erf(A_center,B_center,power_A,power_B,alpha,beta,C_center,n_pt_in,mu_in)
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
!
|
||||
! \int dr (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
! \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
! \frac{\erf(\mu |r - R_C |)}{| r - R_C |}$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n_pt_in
|
||||
integer, intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: C_center(3), A_center(3), B_center(3), alpha, beta, mu_in
|
||||
|
||||
integer :: i, n_pt, n_pt_out
|
||||
double precision :: P_center(3)
|
||||
double precision :: d(0:n_pt_in), coeff, dist, const, factor
|
||||
double precision :: const_factor, dist_integral
|
||||
double precision :: accu, p_inv, p, rho, p_inv_2
|
||||
double precision :: p_new
|
||||
|
||||
double precision :: rint
|
||||
|
||||
p = alpha + beta
|
||||
p_inv = 1.d0 / p
|
||||
p_inv_2 = 0.5d0 * p_inv
|
||||
rho = alpha * beta * p_inv
|
||||
|
||||
dist = 0.d0
|
||||
dist_integral = 0.d0
|
||||
do i = 1, 3
|
||||
P_center(i) = (alpha * A_center(i) + beta * B_center(i)) * p_inv
|
||||
dist += (A_center(i) - B_center(i)) * (A_center(i) - B_center(i))
|
||||
dist_integral += (P_center(i) - C_center(i)) * (P_center(i) - C_center(i))
|
||||
enddo
|
||||
const_factor = dist * rho
|
||||
if(const_factor > 80.d0) then
|
||||
NAI_pol_mult_erf = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
p_new = mu_in / dsqrt(p + mu_in * mu_in)
|
||||
factor = dexp(-const_factor)
|
||||
coeff = dtwo_pi * factor * p_inv * p_new
|
||||
|
||||
n_pt = 2 * ( (power_A(1) + power_B(1)) + (power_A(2) + power_B(2)) + (power_A(3) + power_B(3)) )
|
||||
const = p * dist_integral * p_new * p_new
|
||||
if(n_pt == 0) then
|
||||
NAI_pol_mult_erf = coeff * rint(0, const)
|
||||
return
|
||||
endif
|
||||
|
||||
do i = 0, n_pt_in
|
||||
d(i) = 0.d0
|
||||
enddo
|
||||
! call give_polynomial_mult_center_one_e_erf(A_center,B_center,alpha,beta,power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in)
|
||||
p_new = p_new * p_new
|
||||
call give_polynomial_mult_center_one_e_erf_opt(A_center, B_center, power_A, power_B, C_center, n_pt_in, d, n_pt_out, p_inv_2, p_new, P_center)
|
||||
|
||||
if(n_pt_out < 0) then
|
||||
NAI_pol_mult_erf = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
! sum of integrals of type : int {t,[0,1]} exp-(rho.(P-Q)^2 * t^2) * t^i
|
||||
accu = 0.d0
|
||||
do i = 0, n_pt_out, 2
|
||||
accu += d(i) * rint(i/2, const)
|
||||
enddo
|
||||
NAI_pol_mult_erf = accu * coeff
|
||||
|
||||
end function NAI_pol_mult_erf
|
||||
|
||||
! ---
|
||||
|
||||
|
||||
double precision function NAI_pol_mult_erf_ao_with1s(i_ao, j_ao, beta, B_center, mu_in, C_center)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Computes the following integral :
|
||||
! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) e^{-\beta (r - B_center)^2} \frac{\erf(\mu |r - R_C|)}{|r - R_C|}$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n_pt_in
|
||||
double precision,intent(in) :: C_center(3),A_center(3),B_center(3),alpha,beta,mu_in
|
||||
integer, intent(in) :: power_A(3),power_B(3)
|
||||
integer :: i,j,k,l,n_pt
|
||||
double precision :: P_center(3)
|
||||
integer, intent(in) :: i_ao, j_ao
|
||||
double precision, intent(in) :: beta, B_center(3)
|
||||
double precision, intent(in) :: mu_in, C_center(3)
|
||||
|
||||
integer :: i, j, power_A1(3), power_A2(3), n_pt_in
|
||||
double precision :: A1_center(3), A2_center(3), alpha1, alpha2, coef12, coef1, integral
|
||||
|
||||
double precision, external :: NAI_pol_mult_erf_with1s, NAI_pol_mult_erf_ao
|
||||
|
||||
ASSERT(beta .ge. 0.d0)
|
||||
if(beta .lt. 1d-10) then
|
||||
NAI_pol_mult_erf_ao_with1s = NAI_pol_mult_erf_ao(i_ao, j_ao, mu_in, C_center)
|
||||
return
|
||||
endif
|
||||
|
||||
power_A1(1:3) = ao_power(i_ao,1:3)
|
||||
power_A2(1:3) = ao_power(j_ao,1:3)
|
||||
|
||||
A1_center(1:3) = nucl_coord(ao_nucl(i_ao),1:3)
|
||||
A2_center(1:3) = nucl_coord(ao_nucl(j_ao),1:3)
|
||||
|
||||
n_pt_in = n_pt_max_integrals
|
||||
|
||||
NAI_pol_mult_erf_ao_with1s = 0.d0
|
||||
do i = 1, ao_prim_num(i_ao)
|
||||
alpha1 = ao_expo_ordered_transp (i,i_ao)
|
||||
coef1 = ao_coef_normalized_ordered_transp(i,i_ao)
|
||||
|
||||
do j = 1, ao_prim_num(j_ao)
|
||||
alpha2 = ao_expo_ordered_transp(j,j_ao)
|
||||
coef12 = coef1 * ao_coef_normalized_ordered_transp(j,j_ao)
|
||||
if(dabs(coef12) .lt. 1d-14) cycle
|
||||
|
||||
integral = NAI_pol_mult_erf_with1s( A1_center, A2_center, power_A1, power_A2, alpha1, alpha2 &
|
||||
, beta, B_center, C_center, n_pt_in, mu_in )
|
||||
|
||||
NAI_pol_mult_erf_ao_with1s += integral * coef12
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end function NAI_pol_mult_erf_ao_with1s
|
||||
|
||||
subroutine NAI_pol_mult_erf_with1s_v(A1_center, A2_center, power_A1, power_A2, alpha1, alpha2, beta, B_center, LD_B, C_center, LD_C, n_pt_in, mu_in, res_v, LD_resv, n_points)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math ::
|
||||
!
|
||||
! \int dx (x - A1_x)^a_1 (x - B1_x)^a_2 \exp(-\alpha_1 (x - A1_x)^2 - \alpha_2 (x - A2_x)^2)
|
||||
! \int dy (y - A1_y)^b_1 (y - B1_y)^b_2 \exp(-\alpha_1 (y - A1_y)^2 - \alpha_2 (y - A2_y)^2)
|
||||
! \int dz (x - A1_z)^c_1 (z - B1_z)^c_2 \exp(-\alpha_1 (z - A1_z)^2 - \alpha_2 (z - A2_z)^2)
|
||||
! \exp(-\beta (r - B)^2)
|
||||
! \frac{\erf(\mu |r - R_C|)}{|r - R_C|}$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
double precision :: d(0:n_pt_in),pouet,coeff,dist,const,pouet_2,factor
|
||||
double precision :: I_n_special_exact,integrate_bourrin,I_n_bibi
|
||||
double precision :: V_e_n,const_factor,dist_integral,tmp
|
||||
double precision :: accu,rint,p_inv,p,rho,p_inv_2
|
||||
integer :: n_pt_out,lmax
|
||||
include 'utils/constants.include.F'
|
||||
p = alpha + beta
|
||||
p_inv = 1.d0/p
|
||||
p_inv_2 = 0.5d0 * p_inv
|
||||
rho = alpha * beta * p_inv
|
||||
|
||||
dist = 0.d0
|
||||
dist_integral = 0.d0
|
||||
do i = 1, 3
|
||||
P_center(i) = (alpha * A_center(i) + beta * B_center(i)) * p_inv
|
||||
dist += (A_center(i) - B_center(i))*(A_center(i) - B_center(i))
|
||||
dist_integral += (P_center(i) - C_center(i))*(P_center(i) - C_center(i))
|
||||
enddo
|
||||
const_factor = dist*rho
|
||||
if(const_factor > 80.d0)then
|
||||
NAI_pol_mult_erf = 0.d0
|
||||
return
|
||||
endif
|
||||
double precision :: p_new
|
||||
p_new = mu_in/dsqrt(p+ mu_in * mu_in)
|
||||
factor = dexp(-const_factor)
|
||||
coeff = dtwo_pi * factor * p_inv * p_new
|
||||
lmax = 20
|
||||
implicit none
|
||||
integer, intent(in) :: n_pt_in, LD_B, LD_C, LD_resv, n_points
|
||||
integer, intent(in) :: power_A1(3), power_A2(3)
|
||||
double precision, intent(in) :: A1_center(3), A2_center(3)
|
||||
double precision, intent(in) :: C_center(LD_C,3), B_center(LD_B,3)
|
||||
double precision, intent(in) :: alpha1, alpha2, beta, mu_in
|
||||
double precision, intent(out) :: res_v(LD_resv)
|
||||
|
||||
! print*, "b"
|
||||
do i = 0, n_pt_in
|
||||
d(i) = 0.d0
|
||||
enddo
|
||||
n_pt = 2 * ( (power_A(1) + power_B(1)) +(power_A(2) + power_B(2)) +(power_A(3) + power_B(3)) )
|
||||
const = p * dist_integral * p_new * p_new
|
||||
if (n_pt == 0) then
|
||||
pouet = rint(0,const)
|
||||
NAI_pol_mult_erf = coeff * pouet
|
||||
integer :: i, n_pt, n_pt_out, ipoint
|
||||
double precision :: alpha12, alpha12_inv, alpha12_inv_2, rho12, A12_center(3), dist12, const_factor12
|
||||
double precision :: p, p_inv, p_inv_2, rho, P_center(3), dist, const_factor
|
||||
double precision :: dist_integral
|
||||
double precision :: d(0:n_pt_in), coeff, const, factor
|
||||
double precision :: accu
|
||||
double precision :: p_new, p_new2, coef_tmp, cons_tmp
|
||||
|
||||
double precision :: rint
|
||||
|
||||
|
||||
res_V(1:LD_resv) = 0.d0
|
||||
|
||||
! e^{-alpha1 (r - A1)^2} e^{-alpha2 (r - A2)^2} = e^{-K12} e^{-alpha12 (r - A12)^2}
|
||||
alpha12 = alpha1 + alpha2
|
||||
alpha12_inv = 1.d0 / alpha12
|
||||
alpha12_inv_2 = 0.5d0 * alpha12_inv
|
||||
rho12 = alpha1 * alpha2 * alpha12_inv
|
||||
A12_center(1) = (alpha1 * A1_center(1) + alpha2 * A2_center(1)) * alpha12_inv
|
||||
A12_center(2) = (alpha1 * A1_center(2) + alpha2 * A2_center(2)) * alpha12_inv
|
||||
A12_center(3) = (alpha1 * A1_center(3) + alpha2 * A2_center(3)) * alpha12_inv
|
||||
dist12 = (A1_center(1) - A2_center(1)) * (A1_center(1) - A2_center(1))&
|
||||
+ (A1_center(2) - A2_center(2)) * (A1_center(2) - A2_center(2))&
|
||||
+ (A1_center(3) - A2_center(3)) * (A1_center(3) - A2_center(3))
|
||||
|
||||
const_factor12 = dist12 * rho12
|
||||
if(const_factor12 > 80.d0) then
|
||||
return
|
||||
endif
|
||||
|
||||
! call give_polynomial_mult_center_one_e_erf(A_center,B_center,alpha,beta,power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in)
|
||||
p_new = p_new * p_new
|
||||
call give_polynomial_mult_center_one_e_erf_opt(A_center,B_center,alpha,beta,power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in,p,p_inv,p_inv_2,p_new,P_center)
|
||||
! e^{-K12} e^{-alpha12 (r - A12)^2} e^{-beta (r - B)^2} = e^{-K} e^{-p (r - P)^2}
|
||||
p = alpha12 + beta
|
||||
p_inv = 1.d0 / p
|
||||
p_inv_2 = 0.5d0 * p_inv
|
||||
rho = alpha12 * beta * p_inv
|
||||
p_new = mu_in / dsqrt(p + mu_in * mu_in)
|
||||
p_new2 = p_new * p_new
|
||||
coef_tmp = dtwo_pi * p_inv * p_new
|
||||
cons_tmp = p * p_new2
|
||||
n_pt = 2 * (power_A1(1) + power_A2(1) + power_A1(2) + power_A2(2) + power_A1(3) + power_A2(3) )
|
||||
|
||||
if(n_pt == 0) then
|
||||
|
||||
do ipoint = 1, n_points
|
||||
|
||||
dist = (A12_center(1) - B_center(ipoint,1)) * (A12_center(1) - B_center(ipoint,1))&
|
||||
+ (A12_center(2) - B_center(ipoint,2)) * (A12_center(2) - B_center(ipoint,2))&
|
||||
+ (A12_center(3) - B_center(ipoint,3)) * (A12_center(3) - B_center(ipoint,3))
|
||||
const_factor = const_factor12 + dist * rho
|
||||
if(const_factor > 80.d0) cycle
|
||||
coeff = coef_tmp * dexp(-const_factor)
|
||||
|
||||
P_center(1) = (alpha12 * A12_center(1) + beta * B_center(ipoint,1)) * p_inv
|
||||
P_center(2) = (alpha12 * A12_center(2) + beta * B_center(ipoint,2)) * p_inv
|
||||
P_center(3) = (alpha12 * A12_center(3) + beta * B_center(ipoint,3)) * p_inv
|
||||
dist_integral = (P_center(1) - C_center(ipoint,1)) * (P_center(1) - C_center(ipoint,1))&
|
||||
+ (P_center(2) - C_center(ipoint,2)) * (P_center(2) - C_center(ipoint,2))&
|
||||
+ (P_center(3) - C_center(ipoint,3)) * (P_center(3) - C_center(ipoint,3))
|
||||
const = cons_tmp * dist_integral
|
||||
|
||||
res_v(ipoint) = coeff * rint(0, const)
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
do ipoint = 1, n_points
|
||||
|
||||
dist = (A12_center(1) - B_center(ipoint,1)) * (A12_center(1) - B_center(ipoint,1))&
|
||||
+ (A12_center(2) - B_center(ipoint,2)) * (A12_center(2) - B_center(ipoint,2))&
|
||||
+ (A12_center(3) - B_center(ipoint,3)) * (A12_center(3) - B_center(ipoint,3))
|
||||
const_factor = const_factor12 + dist * rho
|
||||
if(const_factor > 80.d0) cycle
|
||||
coeff = coef_tmp * dexp(-const_factor)
|
||||
|
||||
P_center(1) = (alpha12 * A12_center(1) + beta * B_center(ipoint,1)) * p_inv
|
||||
P_center(2) = (alpha12 * A12_center(2) + beta * B_center(ipoint,2)) * p_inv
|
||||
P_center(3) = (alpha12 * A12_center(3) + beta * B_center(ipoint,3)) * p_inv
|
||||
dist_integral = (P_center(1) - C_center(ipoint,1)) * (P_center(1) - C_center(ipoint,1))&
|
||||
+ (P_center(2) - C_center(ipoint,2)) * (P_center(2) - C_center(ipoint,2))&
|
||||
+ (P_center(3) - C_center(ipoint,3)) * (P_center(3) - C_center(ipoint,3))
|
||||
const = cons_tmp * dist_integral
|
||||
|
||||
do i = 0, n_pt_in
|
||||
d(i) = 0.d0
|
||||
enddo
|
||||
!TODO: VECTORIZE HERE
|
||||
call give_polynomial_mult_center_one_e_erf_opt(A1_center, A2_center, power_A1, power_A2, C_center(ipoint,1:3), n_pt_in, d, n_pt_out, p_inv_2, p_new2, P_center)
|
||||
|
||||
if(n_pt_out < 0) then
|
||||
cycle
|
||||
endif
|
||||
|
||||
! sum of integrals of type : int {t,[0,1]} exp-(rho.(P-Q)^2 * t^2) * t^i
|
||||
accu = 0.d0
|
||||
do i = 0, n_pt_out, 2
|
||||
accu += d(i) * rint(i/2, const)
|
||||
enddo
|
||||
|
||||
res_v(ipoint) = accu * coeff
|
||||
enddo
|
||||
|
||||
if(n_pt_out<0)then
|
||||
NAI_pol_mult_erf = 0.d0
|
||||
return
|
||||
endif
|
||||
accu = 0.d0
|
||||
|
||||
! sum of integrals of type : int {t,[0,1]} exp-(rho.(P-Q)^2 * t^2) * t^i
|
||||
do i =0 ,n_pt_out,2
|
||||
accu += d(i) * rint(i/2,const)
|
||||
enddo
|
||||
NAI_pol_mult_erf = accu * coeff
|
||||
end subroutine NAI_pol_mult_erf_with1s_v
|
||||
|
||||
end
|
||||
! ---
|
||||
|
||||
subroutine give_polynomial_mult_center_one_e_erf_opt(A_center, B_center, power_A, power_B, C_center, n_pt_in, d, n_pt_out, p_inv_2, p_new, P_center)
|
||||
|
||||
subroutine give_polynomial_mult_center_one_e_erf_opt(A_center,B_center,alpha,beta,&
|
||||
power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in,p,p_inv,p_inv_2,p_new,P_center)
|
||||
BEGIN_DOC
|
||||
! Returns the explicit polynomial in terms of the $t$ variable of the
|
||||
! following polynomial:
|
||||
!
|
||||
! $I_{x1}(a_x, d_x,p,q) \times I_{x1}(a_y, d_y,p,q) \times I_{x1}(a_z, d_z,p,q)$.
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n_pt_in
|
||||
integer,intent(out) :: n_pt_out
|
||||
double precision, intent(in) :: A_center(3), B_center(3),C_center(3),p,p_inv,p_inv_2,p_new,P_center(3)
|
||||
double precision, intent(in) :: alpha,beta,mu_in
|
||||
integer, intent(in) :: power_A(3), power_B(3)
|
||||
integer :: a_x,b_x,a_y,b_y,a_z,b_z
|
||||
double precision :: d(0:n_pt_in)
|
||||
double precision :: d1(0:n_pt_in)
|
||||
double precision :: d2(0:n_pt_in)
|
||||
double precision :: d3(0:n_pt_in)
|
||||
double precision :: accu
|
||||
integer, intent(in) :: n_pt_in
|
||||
integer, intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: A_center(3), B_center(3), C_center(3), p_inv_2, p_new, P_center(3)
|
||||
integer, intent(out) :: n_pt_out
|
||||
double precision, intent(out) :: d(0:n_pt_in)
|
||||
|
||||
integer :: a_x, b_x, a_y, b_y, a_z, b_z
|
||||
integer :: n_pt1, n_pt2, n_pt3, dim, i
|
||||
integer :: n_pt_tmp
|
||||
double precision :: d1(0:n_pt_in)
|
||||
double precision :: d2(0:n_pt_in)
|
||||
double precision :: d3(0:n_pt_in)
|
||||
double precision :: accu
|
||||
double precision :: R1x(0:2), B01(0:2), R1xp(0:2), R2x(0:2)
|
||||
|
||||
accu = 0.d0
|
||||
ASSERT (n_pt_in > 1)
|
||||
|
||||
double precision :: R1x(0:2), B01(0:2), R1xp(0:2),R2x(0:2)
|
||||
R1x(0) = (P_center(1) - A_center(1))
|
||||
R1x(1) = 0.d0
|
||||
R1x(2) = -(P_center(1) - C_center(1))* p_new
|
||||
R1x(0) = (P_center(1) - A_center(1))
|
||||
R1x(1) = 0.d0
|
||||
R1x(2) = -(P_center(1) - C_center(1))* p_new
|
||||
! R1x = (P_x - A_x) - (P_x - C_x) ( t * mu/sqrt(p+mu^2) )^2
|
||||
R1xp(0) = (P_center(1) - B_center(1))
|
||||
R1xp(1) = 0.d0
|
||||
R1xp(2) =-(P_center(1) - C_center(1))* p_new
|
||||
R1xp(0) = (P_center(1) - B_center(1))
|
||||
R1xp(1) = 0.d0
|
||||
R1xp(2) =-(P_center(1) - C_center(1))* p_new
|
||||
!R1xp = (P_x - B_x) - (P_x - C_x) ( t * mu/sqrt(p+mu^2) )^2
|
||||
R2x(0) = p_inv_2
|
||||
R2x(1) = 0.d0
|
||||
R2x(2) = -p_inv_2* p_new
|
||||
R2x(0) = p_inv_2
|
||||
R2x(1) = 0.d0
|
||||
R2x(2) = -p_inv_2 * p_new
|
||||
!R2x = 0.5 / p - 0.5/p ( t * mu/sqrt(p+mu^2) )^2
|
||||
do i = 0,n_pt_in
|
||||
d(i) = 0.d0
|
||||
enddo
|
||||
do i = 0,n_pt_in
|
||||
|
||||
do i = 0, n_pt_in
|
||||
d (i) = 0.d0
|
||||
d1(i) = 0.d0
|
||||
enddo
|
||||
do i = 0,n_pt_in
|
||||
d2(i) = 0.d0
|
||||
enddo
|
||||
do i = 0,n_pt_in
|
||||
d3(i) = 0.d0
|
||||
enddo
|
||||
integer :: n_pt1,n_pt2,n_pt3,dim,i
|
||||
|
||||
n_pt1 = n_pt_in
|
||||
n_pt2 = n_pt_in
|
||||
n_pt3 = n_pt_in
|
||||
a_x = power_A(1)
|
||||
b_x = power_B(1)
|
||||
call I_x1_pol_mult_one_e(a_x,b_x,R1x,R1xp,R2x,d1,n_pt1,n_pt_in)
|
||||
call I_x1_pol_mult_one_e(a_x, b_x, R1x, R1xp, R2x, d1, n_pt1, n_pt_in)
|
||||
if(n_pt1<0)then
|
||||
n_pt_out = -1
|
||||
do i = 0,n_pt_in
|
||||
@ -190,17 +375,17 @@ subroutine give_polynomial_mult_center_one_e_erf_opt(A_center,B_center,alpha,bet
|
||||
return
|
||||
endif
|
||||
|
||||
R1x(0) = (P_center(2) - A_center(2))
|
||||
R1x(1) = 0.d0
|
||||
R1x(2) = -(P_center(2) - C_center(2))* p_new
|
||||
R1x(0) = (P_center(2) - A_center(2))
|
||||
R1x(1) = 0.d0
|
||||
R1x(2) = -(P_center(2) - C_center(2))* p_new
|
||||
! R1x = (P_x - A_x) - (P_x - C_x) ( t * mu/sqrt(p+mu^2) )^2
|
||||
R1xp(0) = (P_center(2) - B_center(2))
|
||||
R1xp(1) = 0.d0
|
||||
R1xp(2) =-(P_center(2) - C_center(2))* p_new
|
||||
R1xp(0) = (P_center(2) - B_center(2))
|
||||
R1xp(1) = 0.d0
|
||||
R1xp(2) =-(P_center(2) - C_center(2))* p_new
|
||||
!R1xp = (P_x - B_x) - (P_x - C_x) ( t * mu/sqrt(p+mu^2) )^2
|
||||
a_y = power_A(2)
|
||||
b_y = power_B(2)
|
||||
call I_x1_pol_mult_one_e(a_y,b_y,R1x,R1xp,R2x,d2,n_pt2,n_pt_in)
|
||||
call I_x1_pol_mult_one_e(a_y, b_y, R1x, R1xp, R2x, d2, n_pt2, n_pt_in)
|
||||
if(n_pt2<0)then
|
||||
n_pt_out = -1
|
||||
do i = 0,n_pt_in
|
||||
@ -209,51 +394,151 @@ subroutine give_polynomial_mult_center_one_e_erf_opt(A_center,B_center,alpha,bet
|
||||
return
|
||||
endif
|
||||
|
||||
|
||||
R1x(0) = (P_center(3) - A_center(3))
|
||||
R1x(1) = 0.d0
|
||||
R1x(2) = -(P_center(3) - C_center(3))* p_new
|
||||
R1x(0) = (P_center(3) - A_center(3))
|
||||
R1x(1) = 0.d0
|
||||
R1x(2) = -(P_center(3) - C_center(3)) * p_new
|
||||
! R1x = (P_x - A_x) - (P_x - C_x) ( t * mu/sqrt(p+mu^2) )^2
|
||||
R1xp(0) = (P_center(3) - B_center(3))
|
||||
R1xp(1) = 0.d0
|
||||
R1xp(2) =-(P_center(3) - C_center(3))* p_new
|
||||
R1xp(0) = (P_center(3) - B_center(3))
|
||||
R1xp(1) = 0.d0
|
||||
R1xp(2) =-(P_center(3) - C_center(3)) * p_new
|
||||
!R2x = 0.5 / p - 0.5/p ( t * mu/sqrt(p+mu^2) )^2
|
||||
a_z = power_A(3)
|
||||
b_z = power_B(3)
|
||||
|
||||
call I_x1_pol_mult_one_e(a_z,b_z,R1x,R1xp,R2x,d3,n_pt3,n_pt_in)
|
||||
if(n_pt3<0)then
|
||||
call I_x1_pol_mult_one_e(a_z, b_z, R1x, R1xp, R2x, d3, n_pt3, n_pt_in)
|
||||
if(n_pt3 < 0) then
|
||||
n_pt_out = -1
|
||||
do i = 0,n_pt_in
|
||||
d(i) = 0.d0
|
||||
enddo
|
||||
return
|
||||
endif
|
||||
integer :: n_pt_tmp
|
||||
|
||||
n_pt_tmp = 0
|
||||
call multiply_poly(d1,n_pt1,d2,n_pt2,d,n_pt_tmp)
|
||||
do i = 0,n_pt_tmp
|
||||
call multiply_poly(d1, n_pt1, d2, n_pt2, d, n_pt_tmp)
|
||||
do i = 0, n_pt_tmp
|
||||
d1(i) = 0.d0
|
||||
enddo
|
||||
n_pt_out = 0
|
||||
call multiply_poly(d ,n_pt_tmp ,d3,n_pt3,d1,n_pt_out)
|
||||
call multiply_poly(d, n_pt_tmp, d3, n_pt3, d1, n_pt_out)
|
||||
do i = 0, n_pt_out
|
||||
d(i) = d1(i)
|
||||
enddo
|
||||
|
||||
end
|
||||
end subroutine give_polynomial_mult_center_one_e_erf_opt
|
||||
|
||||
! ---
|
||||
subroutine NAI_pol_mult_erf_v(A_center, B_center, power_A, power_B, alpha, beta, C_center, LD_C, n_pt_in, mu_in, res_v, LD_resv, n_points)
|
||||
|
||||
|
||||
|
||||
subroutine give_polynomial_mult_center_one_e_erf(A_center,B_center,alpha,beta,&
|
||||
power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in)
|
||||
BEGIN_DOC
|
||||
! Returns the explicit polynomial in terms of the $t$ variable of the
|
||||
!
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dr (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
! \frac{\erf(\mu |r - R_C |)}{| r - R_C |}$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: n_pt_in, n_points, LD_C, LD_resv
|
||||
integer, intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: A_center(3), B_center(3), alpha, beta, mu_in
|
||||
double precision, intent(in) :: C_center(LD_C,3)
|
||||
double precision, intent(out) :: res_v(LD_resv)
|
||||
|
||||
integer :: i, n_pt, n_pt_out, ipoint
|
||||
double precision :: P_center(3)
|
||||
double precision :: d(0:n_pt_in), coeff, dist, const, factor
|
||||
double precision :: const_factor, dist_integral
|
||||
double precision :: accu, p_inv, p, rho, p_inv_2
|
||||
double precision :: p_new, p_new2, coef_tmp
|
||||
|
||||
double precision :: rint
|
||||
|
||||
res_V(1:LD_resv) = 0.d0
|
||||
|
||||
p = alpha + beta
|
||||
p_inv = 1.d0 / p
|
||||
p_inv_2 = 0.5d0 * p_inv
|
||||
rho = alpha * beta * p_inv
|
||||
p_new = mu_in / dsqrt(p + mu_in * mu_in)
|
||||
p_new2 = p_new * p_new
|
||||
coef_tmp = p * p_new2
|
||||
|
||||
dist = 0.d0
|
||||
do i = 1, 3
|
||||
P_center(i) = (alpha * A_center(i) + beta * B_center(i)) * p_inv
|
||||
dist += (A_center(i) - B_center(i)) * (A_center(i) - B_center(i))
|
||||
enddo
|
||||
|
||||
const_factor = dist * rho
|
||||
if(const_factor > 80.d0) then
|
||||
return
|
||||
endif
|
||||
factor = dexp(-const_factor)
|
||||
coeff = dtwo_pi * factor * p_inv * p_new
|
||||
|
||||
n_pt = 2 * ( power_A(1) + power_B(1) + power_A(2) + power_B(2) + power_A(3) + power_B(3) )
|
||||
|
||||
if(n_pt == 0) then
|
||||
|
||||
do ipoint = 1, n_points
|
||||
dist_integral = 0.d0
|
||||
do i = 1, 3
|
||||
dist_integral += (P_center(i) - C_center(ipoint,i)) * (P_center(i) - C_center(ipoint,i))
|
||||
enddo
|
||||
const = coef_tmp * dist_integral
|
||||
|
||||
res_v(ipoint) = coeff * rint(0, const)
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
do ipoint = 1, n_points
|
||||
dist_integral = 0.d0
|
||||
do i = 1, 3
|
||||
dist_integral += (P_center(i) - C_center(ipoint,i)) * (P_center(i) - C_center(ipoint,i))
|
||||
enddo
|
||||
const = coef_tmp * dist_integral
|
||||
|
||||
do i = 0, n_pt_in
|
||||
d(i) = 0.d0
|
||||
enddo
|
||||
call give_polynomial_mult_center_one_e_erf_opt(A_center, B_center, power_A, power_B, C_center(ipoint,1:3), n_pt_in, d, n_pt_out, p_inv_2, p_new2, P_center)
|
||||
|
||||
if(n_pt_out < 0) then
|
||||
res_v(ipoint) = 0.d0
|
||||
cycle
|
||||
endif
|
||||
|
||||
! sum of integrals of type : int {t,[0,1]} exp-(rho.(P-Q)^2 * t^2) * t^i
|
||||
accu = 0.d0
|
||||
do i = 0, n_pt_out, 2
|
||||
accu += d(i) * rint(i/2, const)
|
||||
enddo
|
||||
|
||||
res_v(ipoint) = accu * coeff
|
||||
enddo
|
||||
|
||||
endif
|
||||
|
||||
end subroutine NAI_pol_mult_erf_v
|
||||
|
||||
|
||||
subroutine give_polynomial_mult_center_one_e_erf(A_center,B_center,alpha,beta,power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in)
|
||||
|
||||
BEGIN_DOC
|
||||
! Returns the explicit polynomial in terms of the $t$ variable of the
|
||||
! following polynomial:
|
||||
!
|
||||
! $I_{x1}(a_x, d_x,p,q) \times I_{x1}(a_y, d_y,p,q) \times I_{x1}(a_z, d_z,p,q)$.
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n_pt_in
|
||||
integer,intent(out) :: n_pt_out
|
||||
@ -374,3 +659,113 @@ subroutine give_polynomial_mult_center_one_e_erf(A_center,B_center,alpha,beta,&
|
||||
|
||||
end
|
||||
|
||||
double precision function NAI_pol_mult_erf_with1s( A1_center, A2_center, power_A1, power_A2, alpha1, alpha2 &
|
||||
, beta, B_center, C_center, n_pt_in, mu_in )
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dx (x - A1_x)^a_1 (x - B1_x)^a_2 \exp(-\alpha_1 (x - A1_x)^2 - \alpha_2 (x - A2_x)^2)
|
||||
! \int dy (y - A1_y)^b_1 (y - B1_y)^b_2 \exp(-\alpha_1 (y - A1_y)^2 - \alpha_2 (y - A2_y)^2)
|
||||
! \int dz (x - A1_z)^c_1 (z - B1_z)^c_2 \exp(-\alpha_1 (z - A1_z)^2 - \alpha_2 (z - A2_z)^2)
|
||||
! \exp(-\beta (r - B)^2)
|
||||
! \frac{\erf(\mu |r - R_C|)}{|r - R_C|}$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n_pt_in
|
||||
integer, intent(in) :: power_A1(3), power_A2(3)
|
||||
double precision, intent(in) :: C_center(3), A1_center(3), A2_center(3), B_center(3)
|
||||
double precision, intent(in) :: alpha1, alpha2, beta, mu_in
|
||||
|
||||
integer :: i, n_pt, n_pt_out
|
||||
double precision :: alpha12, alpha12_inv, alpha12_inv_2, rho12, A12_center(3), dist12, const_factor12
|
||||
double precision :: p, p_inv, p_inv_2, rho, P_center(3), dist, const_factor
|
||||
double precision :: dist_integral
|
||||
double precision :: d(0:n_pt_in), coeff, const, factor
|
||||
double precision :: accu
|
||||
double precision :: p_new
|
||||
|
||||
double precision :: rint
|
||||
|
||||
|
||||
! e^{-alpha1 (r - A1)^2} e^{-alpha2 (r - A2)^2} = e^{-K12} e^{-alpha12 (r - A12)^2}
|
||||
alpha12 = alpha1 + alpha2
|
||||
alpha12_inv = 1.d0 / alpha12
|
||||
alpha12_inv_2 = 0.5d0 * alpha12_inv
|
||||
rho12 = alpha1 * alpha2 * alpha12_inv
|
||||
A12_center(1) = (alpha1 * A1_center(1) + alpha2 * A2_center(1)) * alpha12_inv
|
||||
A12_center(2) = (alpha1 * A1_center(2) + alpha2 * A2_center(2)) * alpha12_inv
|
||||
A12_center(3) = (alpha1 * A1_center(3) + alpha2 * A2_center(3)) * alpha12_inv
|
||||
dist12 = (A1_center(1) - A2_center(1)) * (A1_center(1) - A2_center(1)) &
|
||||
+ (A1_center(2) - A2_center(2)) * (A1_center(2) - A2_center(2)) &
|
||||
+ (A1_center(3) - A2_center(3)) * (A1_center(3) - A2_center(3))
|
||||
|
||||
const_factor12 = dist12 * rho12
|
||||
if(const_factor12 > 80.d0) then
|
||||
NAI_pol_mult_erf_with1s = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
! ---
|
||||
|
||||
! e^{-K12} e^{-alpha12 (r - A12)^2} e^{-beta (r - B)^2} = e^{-K} e^{-p (r - P)^2}
|
||||
p = alpha12 + beta
|
||||
p_inv = 1.d0 / p
|
||||
p_inv_2 = 0.5d0 * p_inv
|
||||
rho = alpha12 * beta * p_inv
|
||||
P_center(1) = (alpha12 * A12_center(1) + beta * B_center(1)) * p_inv
|
||||
P_center(2) = (alpha12 * A12_center(2) + beta * B_center(2)) * p_inv
|
||||
P_center(3) = (alpha12 * A12_center(3) + beta * B_center(3)) * p_inv
|
||||
dist = (A12_center(1) - B_center(1)) * (A12_center(1) - B_center(1)) &
|
||||
+ (A12_center(2) - B_center(2)) * (A12_center(2) - B_center(2)) &
|
||||
+ (A12_center(3) - B_center(3)) * (A12_center(3) - B_center(3))
|
||||
|
||||
const_factor = const_factor12 + dist * rho
|
||||
if(const_factor > 80.d0) then
|
||||
NAI_pol_mult_erf_with1s = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
dist_integral = (P_center(1) - C_center(1)) * (P_center(1) - C_center(1)) &
|
||||
+ (P_center(2) - C_center(2)) * (P_center(2) - C_center(2)) &
|
||||
+ (P_center(3) - C_center(3)) * (P_center(3) - C_center(3))
|
||||
|
||||
! ---
|
||||
|
||||
p_new = mu_in / dsqrt(p + mu_in * mu_in)
|
||||
factor = dexp(-const_factor)
|
||||
coeff = dtwo_pi * factor * p_inv * p_new
|
||||
|
||||
n_pt = 2 * ( (power_A1(1) + power_A2(1)) + (power_A1(2) + power_A2(2)) + (power_A1(3) + power_A2(3)) )
|
||||
const = p * dist_integral * p_new * p_new
|
||||
if(n_pt == 0) then
|
||||
NAI_pol_mult_erf_with1s = coeff * rint(0, const)
|
||||
return
|
||||
endif
|
||||
|
||||
do i = 0, n_pt_in
|
||||
d(i) = 0.d0
|
||||
enddo
|
||||
p_new = p_new * p_new
|
||||
call give_polynomial_mult_center_one_e_erf_opt( A1_center, A2_center, power_A1, power_A2, C_center, n_pt_in, d, n_pt_out, p_inv_2, p_new, P_center)
|
||||
|
||||
if(n_pt_out < 0) then
|
||||
NAI_pol_mult_erf_with1s = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
! sum of integrals of type : int {t,[0,1]} exp-(rho.(P-Q)^2 * t^2) * t^i
|
||||
accu = 0.d0
|
||||
do i = 0, n_pt_out, 2
|
||||
accu += d(i) * rint(i/2, const)
|
||||
enddo
|
||||
NAI_pol_mult_erf_with1s = accu * coeff
|
||||
|
||||
end function NAI_pol_mult_erf_with1s
|
||||
|
5
src/ao_tc_eff_map/NEED
Normal file
5
src/ao_tc_eff_map/NEED
Normal file
@ -0,0 +1,5 @@
|
||||
ao_two_e_erf_ints
|
||||
mo_one_e_ints
|
||||
ao_many_one_e_ints
|
||||
dft_utils_in_r
|
||||
tc_keywords
|
12
src/ao_tc_eff_map/README.rst
Normal file
12
src/ao_tc_eff_map/README.rst
Normal file
@ -0,0 +1,12 @@
|
||||
ao_tc_eff_map
|
||||
=============
|
||||
|
||||
This is a module to obtain the integrals on the AO basis of the SCALAR HERMITIAN
|
||||
effective potential defined in Eq. 32 of JCP 154, 084119 (2021)
|
||||
It also contains the modification by a one-body Jastrow factor.
|
||||
|
||||
The main routine/providers are
|
||||
|
||||
+) ao_tc_sym_two_e_pot_map : map of the SCALAR PART of total effective two-electron on the AO basis in PHYSICIST notations. It might contain the two-electron term coming from the one-e correlation factor.
|
||||
+) get_ao_tc_sym_two_e_pot(i,j,k,l,ao_tc_sym_two_e_pot_map) : routine to get the integrals from ao_tc_sym_two_e_pot_map.
|
||||
+) ao_tc_sym_two_e_pot(i,j,k,l) : FUNCTION that returns the scalar part of TC-potential EXCLUDING the erf(mu r12)/r12. See two_e_ints_gauss.irp.f for more details.
|
76
src/ao_tc_eff_map/compute_ints_eff_pot.irp.f
Normal file
76
src/ao_tc_eff_map/compute_ints_eff_pot.irp.f
Normal file
@ -0,0 +1,76 @@
|
||||
|
||||
|
||||
subroutine compute_ao_tc_sym_two_e_pot_jl(j, l, n_integrals, buffer_i, buffer_value)
|
||||
|
||||
use map_module
|
||||
|
||||
BEGIN_DOC
|
||||
! Parallel client for AO integrals
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: j, l
|
||||
integer,intent(out) :: n_integrals
|
||||
integer(key_kind),intent(out) :: buffer_i(ao_num*ao_num)
|
||||
real(integral_kind),intent(out) :: buffer_value(ao_num*ao_num)
|
||||
|
||||
integer :: i, k
|
||||
integer :: kk, m, j1, i1
|
||||
double precision :: cpu_1, cpu_2, wall_1, wall_2
|
||||
double precision :: integral, wall_0, integral_pot, integral_erf
|
||||
double precision :: thr
|
||||
|
||||
logical, external :: ao_two_e_integral_zero
|
||||
double precision :: ao_tc_sym_two_e_pot, ao_two_e_integral_erf
|
||||
double precision :: j1b_gauss_2e_j1, j1b_gauss_2e_j2
|
||||
|
||||
|
||||
PROVIDE j1b_type
|
||||
|
||||
thr = ao_integrals_threshold
|
||||
|
||||
n_integrals = 0
|
||||
|
||||
j1 = j+ishft(l*l-l,-1)
|
||||
do k = 1, ao_num ! r1
|
||||
i1 = ishft(k*k-k,-1)
|
||||
if (i1 > j1) then
|
||||
exit
|
||||
endif
|
||||
do i = 1, k
|
||||
i1 += 1
|
||||
if (i1 > j1) then
|
||||
exit
|
||||
endif
|
||||
|
||||
if (ao_two_e_integral_erf_schwartz(i,k)*ao_two_e_integral_erf_schwartz(j,l) < thr) then
|
||||
cycle
|
||||
endif
|
||||
|
||||
!DIR$ FORCEINLINE
|
||||
integral_pot = ao_tc_sym_two_e_pot (i, k, j, l) ! i,k : r1 j,l : r2
|
||||
integral_erf = ao_two_e_integral_erf(i, k, j, l)
|
||||
integral = integral_erf + integral_pot
|
||||
|
||||
if( j1b_type .eq. 1 ) then
|
||||
!print *, ' j1b type 1 is added'
|
||||
integral = integral + j1b_gauss_2e_j1(i, k, j, l)
|
||||
elseif( j1b_type .eq. 2 ) then
|
||||
!print *, ' j1b type 2 is added'
|
||||
integral = integral + j1b_gauss_2e_j2(i, k, j, l)
|
||||
endif
|
||||
|
||||
if(abs(integral) < thr) then
|
||||
cycle
|
||||
endif
|
||||
|
||||
n_integrals += 1
|
||||
!DIR$ FORCEINLINE
|
||||
call two_e_integrals_index(i, j, k, l, buffer_i(n_integrals))
|
||||
buffer_value(n_integrals) = integral
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end subroutine compute_ao_tc_sym_two_e_pot_jl
|
||||
|
510
src/ao_tc_eff_map/fit_j.irp.f
Normal file
510
src/ao_tc_eff_map/fit_j.irp.f
Normal file
@ -0,0 +1,510 @@
|
||||
BEGIN_PROVIDER [ double precision, expo_j_xmu_1gauss ]
|
||||
&BEGIN_PROVIDER [ double precision, coef_j_xmu_1gauss ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Upper bound long range fit of F(x) = x * (1 - erf(x)) - 1/sqrt(pi) * exp(-x**2)
|
||||
!
|
||||
! with a single gaussian.
|
||||
!
|
||||
! Such a function can be used to screen integrals with F(x).
|
||||
END_DOC
|
||||
expo_j_xmu_1gauss = 0.5d0
|
||||
coef_j_xmu_1gauss = 1.d0
|
||||
END_PROVIDER
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, expo_erfc_gauss ]
|
||||
implicit none
|
||||
expo_erfc_gauss = 1.41211d0
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, expo_erfc_mu_gauss ]
|
||||
implicit none
|
||||
expo_erfc_mu_gauss = expo_erfc_gauss * mu_erf * mu_erf
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, expo_good_j_mu_1gauss ]
|
||||
&BEGIN_PROVIDER [ double precision, coef_good_j_mu_1gauss ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! exponent of Gaussian in order to obtain an upper bound of J(r12,mu)
|
||||
!
|
||||
! Can be used to scree integrals with J(r12,mu)
|
||||
END_DOC
|
||||
expo_good_j_mu_1gauss = 2.D0 * mu_erf * expo_j_xmu_1gauss
|
||||
coef_good_j_mu_1gauss = 0.5d0/mu_erf * coef_j_xmu_1gauss
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, expo_j_xmu, (n_fit_1_erf_x) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! F(x) = x * (1 - erf(x)) - 1/sqrt(pi) * exp(-x**2) is fitted with a gaussian and a Slater
|
||||
!
|
||||
! \approx - 1/sqrt(pi) * exp(-alpha * x ) exp(-beta * x**2)
|
||||
!
|
||||
! where alpha = expo_j_xmu(1) and beta = expo_j_xmu(2)
|
||||
END_DOC
|
||||
expo_j_xmu(1) = 1.7477d0
|
||||
expo_j_xmu(2) = 0.668662d0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, expo_gauss_j_mu_x, (ng_fit_jast)]
|
||||
&BEGIN_PROVIDER [double precision, coef_gauss_j_mu_x, (ng_fit_jast)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! J(mu,r12) = 1/2 r12 * (1 - erf(mu*r12)) - 1/(2 sqrt(pi)*mu) exp(-(mu*r12)^2) is expressed as
|
||||
!
|
||||
! J(mu,r12) = 0.5/mu * F(r12*mu) where F(x) = x * (1 - erf(x)) - 1/sqrt(pi) * exp(-x**2)
|
||||
!
|
||||
! F(x) is fitted by - 1/sqrt(pi) * exp(-alpha * x) exp(-beta * x^2) (see expo_j_xmu)
|
||||
!
|
||||
! The slater function exp(-alpha * x) is fitted with n_max_fit_slat gaussians
|
||||
!
|
||||
! See Appendix 2 of JCP 154, 084119 (2021)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i
|
||||
double precision :: tmp
|
||||
double precision :: expos(ng_fit_jast), alpha, beta
|
||||
|
||||
if(ng_fit_jast .eq. 1) then
|
||||
|
||||
coef_gauss_j_mu_x = (/ -0.47947881d0 /)
|
||||
expo_gauss_j_mu_x = (/ 3.4987848d0 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x(i) = tmp * expo_gauss_j_mu_x(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 2) then
|
||||
|
||||
coef_gauss_j_mu_x = (/ -0.18390742d0, -0.35512656d0 /)
|
||||
expo_gauss_j_mu_x = (/ 31.9279947d0 , 2.11428789d0 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x(i) = tmp * expo_gauss_j_mu_x(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 3) then
|
||||
|
||||
coef_gauss_j_mu_x = (/ -0.07501725d0, -0.28499012d0, -0.1953932d0 /)
|
||||
expo_gauss_j_mu_x = (/ 206.74058566d0, 1.72974157d0, 11.18735164d0 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x(i) = tmp * expo_gauss_j_mu_x(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 5) then
|
||||
|
||||
coef_gauss_j_mu_x = (/ -0.01832955d0 , -0.10188952d0 , -0.20710858d0 , -0.18975032d0 , -0.04641657d0 /)
|
||||
expo_gauss_j_mu_x = (/ 4.33116687d+03, 2.61292842d+01, 1.43447161d+00, 4.92767426d+00, 2.10654699d+02 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x(i) = tmp * expo_gauss_j_mu_x(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 6) then
|
||||
|
||||
coef_gauss_j_mu_x = (/ -0.08783664d0 , -0.16088711d0 , -0.18464486d0 , -0.0368509d0 , -0.08130028d0 , -0.0126972d0 /)
|
||||
expo_gauss_j_mu_x = (/ 4.09729729d+01, 7.11620618d+00, 2.03692338d+00, 4.10831731d+02, 1.12480198d+00, 1.00000000d+04 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x(i) = tmp * expo_gauss_j_mu_x(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 7) then
|
||||
|
||||
coef_gauss_j_mu_x = (/ -0.01756495d0 , -0.01023623d0 , -0.06548959d0 , -0.03539446d0 , -0.17150646d0 , -0.15071096d0 , -0.11326834d0 /)
|
||||
expo_gauss_j_mu_x = (/ 9.88572565d+02, 1.21363371d+04, 3.69794870d+01, 1.67364529d+02, 3.03962934d+00, 1.27854005d+00, 9.76383343d+00 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x(i) = tmp * expo_gauss_j_mu_x(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 8) then
|
||||
|
||||
coef_gauss_j_mu_x = (/ -0.11489205d0 , -0.16008968d0 , -0.12892456d0 , -0.04250838d0 , -0.0718451d0 , -0.02394051d0 , -0.00913353d0 , -0.01285182d0 /)
|
||||
expo_gauss_j_mu_x = (/ 6.97632442d+00, 2.56010878d+00, 1.22760977d+00, 7.47697124d+01, 2.16104215d+01, 2.96549728d+02, 1.40773328d+04, 1.43335159d+03 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x(i) = tmp * expo_gauss_j_mu_x(i)
|
||||
enddo
|
||||
|
||||
!elseif(ng_fit_jast .eq. 9) then
|
||||
|
||||
! coef_gauss_j_mu_x = (/ /)
|
||||
! expo_gauss_j_mu_x = (/ /)
|
||||
|
||||
! tmp = mu_erf * mu_erf
|
||||
! do i = 1, ng_fit_jast
|
||||
! expo_gauss_j_mu_x(i) = tmp * expo_gauss_j_mu_x(i)
|
||||
! enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 20) then
|
||||
|
||||
ASSERT(n_max_fit_slat == 20)
|
||||
|
||||
alpha = expo_j_xmu(1) * mu_erf
|
||||
call expo_fit_slater_gam(alpha, expos)
|
||||
beta = expo_j_xmu(2) * mu_erf * mu_erf
|
||||
|
||||
tmp = -1.0d0 / sqrt(dacos(-1.d0))
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x(i) = expos(i) + beta
|
||||
coef_gauss_j_mu_x(i) = tmp * coef_fit_slat_gauss(i)
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
print *, ' not implemented yet'
|
||||
stop
|
||||
|
||||
endif
|
||||
|
||||
tmp = 0.5d0 / mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
coef_gauss_j_mu_x(i) = tmp * coef_gauss_j_mu_x(i)
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, expo_gauss_j_mu_x_2, (ng_fit_jast)]
|
||||
&BEGIN_PROVIDER [double precision, coef_gauss_j_mu_x_2, (ng_fit_jast)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! J(mu,r12)^2 = 0.25/mu^2 F(r12*mu)^2
|
||||
!
|
||||
! F(x)^2 = 1/pi * exp(-2 * alpha * x) exp(-2 * beta * x^2)
|
||||
!
|
||||
! The slater function exp(-2 * alpha * x) is fitted with n_max_fit_slat gaussians
|
||||
!
|
||||
! See Appendix 2 of JCP 154, 084119 (2021)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i
|
||||
double precision :: tmp
|
||||
double precision :: expos(ng_fit_jast), alpha, beta
|
||||
double precision :: alpha_opt, beta_opt
|
||||
|
||||
if(ng_fit_jast .eq. 1) then
|
||||
|
||||
coef_gauss_j_mu_x_2 = (/ 0.26699573d0 /)
|
||||
expo_gauss_j_mu_x_2 = (/ 11.71029824d0 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x_2(i) = tmp * expo_gauss_j_mu_x_2(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 2) then
|
||||
|
||||
coef_gauss_j_mu_x_2 = (/ 0.11627934d0 , 0.18708824d0 /)
|
||||
expo_gauss_j_mu_x_2 = (/ 102.41386863d0, 6.36239771d0 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x_2(i) = tmp * expo_gauss_j_mu_x_2(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 3) then
|
||||
|
||||
coef_gauss_j_mu_x_2 = (/ 0.04947216d0 , 0.14116238d0, 0.12276501d0 /)
|
||||
expo_gauss_j_mu_x_2 = (/ 635.29701766d0, 4.87696954d0, 33.36745891d0 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x_2(i) = tmp * expo_gauss_j_mu_x_2(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 5) then
|
||||
|
||||
coef_gauss_j_mu_x_2 = (/ 0.01461527d0 , 0.03257147d0 , 0.08831354d0 , 0.11411794d0 , 0.06858783d0 /)
|
||||
expo_gauss_j_mu_x_2 = (/ 8.76554470d+03, 4.90224577d+02, 3.68267125d+00, 1.29663940d+01, 6.58240931d+01 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x_2(i) = tmp * expo_gauss_j_mu_x_2(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 6) then
|
||||
|
||||
coef_gauss_j_mu_x_2 = (/ 0.01347632d0 , 0.03929124d0 , 0.06289468d0 , 0.10702493d0 , 0.06999865d0 , 0.02558191d0 /)
|
||||
expo_gauss_j_mu_x_2 = (/ 1.00000000d+04, 1.20900717d+02, 3.20346191d+00, 8.92157196d+00, 3.28119120d+01, 6.49045808d+02 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x_2(i) = tmp * expo_gauss_j_mu_x_2(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 7) then
|
||||
|
||||
coef_gauss_j_mu_x_2 = (/ 0.05202849d0 , 0.01031081d0 , 0.04699157d0 , 0.01451002d0 , 0.07442576d0 , 0.02692033d0 , 0.09311842d0 /)
|
||||
expo_gauss_j_mu_x_2 = (/ 3.04469415d+00, 1.40682034d+04, 7.45960945d+01, 1.43067466d+03, 2.16815661d+01, 2.95750306d+02, 7.23471236d+00 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x_2(i) = tmp * expo_gauss_j_mu_x_2(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 8) then
|
||||
|
||||
coef_gauss_j_mu_x_2 = (/ 0.00942115d0 , 0.07332421d0 , 0.0508308d0 , 0.08204949d0 , 0.0404099d0 , 0.03201288d0 , 0.01911313d0 , 0.01114732d0 /)
|
||||
expo_gauss_j_mu_x_2 = (/ 1.56957321d+04, 1.52867810d+01, 4.36016903d+01, 5.96818956d+00, 2.85535269d+00, 1.36064008d+02, 4.71968910d+02, 1.92022350d+03 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x_2(i) = tmp * expo_gauss_j_mu_x_2(i)
|
||||
enddo
|
||||
|
||||
!elseif(ng_fit_jast .eq. 9) then
|
||||
|
||||
! coef_gauss_j_mu_x_2 = (/ /)
|
||||
! expo_gauss_j_mu_x_2 = (/ /)
|
||||
!
|
||||
! tmp = mu_erf * mu_erf
|
||||
! do i = 1, ng_fit_jast
|
||||
! expo_gauss_j_mu_x_2(i) = tmp * expo_gauss_j_mu_x_2(i)
|
||||
! enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 20) then
|
||||
|
||||
ASSERT(n_max_fit_slat == 20)
|
||||
|
||||
!alpha_opt = 2.d0 * expo_j_xmu(1)
|
||||
!beta_opt = 2.d0 * expo_j_xmu(2)
|
||||
|
||||
! direct opt
|
||||
alpha_opt = 3.52751759d0
|
||||
beta_opt = 1.26214809d0
|
||||
|
||||
alpha = alpha_opt * mu_erf
|
||||
call expo_fit_slater_gam(alpha, expos)
|
||||
beta = beta_opt * mu_erf * mu_erf
|
||||
|
||||
tmp = 1.d0 / dacos(-1.d0)
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_x_2(i) = expos(i) + beta
|
||||
coef_gauss_j_mu_x_2(i) = tmp * coef_fit_slat_gauss(i)
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
print *, ' not implemented yet'
|
||||
stop
|
||||
|
||||
endif
|
||||
|
||||
tmp = 0.25d0 / (mu_erf * mu_erf)
|
||||
do i = 1, ng_fit_jast
|
||||
coef_gauss_j_mu_x_2(i) = tmp * coef_gauss_j_mu_x_2(i)
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, expo_gauss_j_mu_1_erf, (ng_fit_jast)]
|
||||
&BEGIN_PROVIDER [double precision, coef_gauss_j_mu_1_erf, (ng_fit_jast)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! J(mu,r12) x \frac{1 - erf(mu * r12)}{2} =
|
||||
!
|
||||
! - \frac{1}{4 \sqrt{\pi} \mu} \exp(-(alpha1 + alpha2) * mu * r12 - (beta1 + beta2) * mu^2 * r12^2)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i
|
||||
double precision :: tmp
|
||||
double precision :: expos(ng_fit_jast), alpha, beta
|
||||
double precision :: alpha_opt, beta_opt
|
||||
|
||||
if(ng_fit_jast .eq. 1) then
|
||||
|
||||
coef_gauss_j_mu_1_erf = (/ -0.47742461d0 /)
|
||||
expo_gauss_j_mu_1_erf = (/ 8.72255696d0 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_1_erf(i) = tmp * expo_gauss_j_mu_1_erf(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 2) then
|
||||
|
||||
coef_gauss_j_mu_1_erf = (/ -0.19342649d0, -0.34563835d0 /)
|
||||
expo_gauss_j_mu_1_erf = (/ 78.66099999d0, 5.04324363d0 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_1_erf(i) = tmp * expo_gauss_j_mu_1_erf(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 3) then
|
||||
|
||||
coef_gauss_j_mu_1_erf = (/ -0.0802541d0 , -0.27019258d0, -0.20546681d0 /)
|
||||
expo_gauss_j_mu_1_erf = (/ 504.53350764d0, 4.01408169d0, 26.5758329d0 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_1_erf(i) = tmp * expo_gauss_j_mu_1_erf(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 5) then
|
||||
|
||||
coef_gauss_j_mu_1_erf = (/ -0.02330531d0 , -0.11888176d0 , -0.16476192d0 , -0.19874713d0 , -0.05889174d0 /)
|
||||
expo_gauss_j_mu_1_erf = (/ 1.00000000d+04, 4.66067922d+01, 3.04359857d+00, 9.54726649d+00, 3.59796835d+02 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_1_erf(i) = tmp * expo_gauss_j_mu_1_erf(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 6) then
|
||||
|
||||
coef_gauss_j_mu_1_erf = (/ -0.01865654d0 , -0.18319251d0 , -0.06543196d0 , -0.11522778d0 , -0.14825793d0 , -0.03327101d0 /)
|
||||
expo_gauss_j_mu_1_erf = (/ 1.00000000d+04, 8.05593848d+00, 1.27986190d+02, 2.92674319d+01, 2.93583623d+00, 7.65609148d+02 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_1_erf(i) = tmp * expo_gauss_j_mu_1_erf(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 7) then
|
||||
|
||||
coef_gauss_j_mu_1_erf = (/ -0.11853067d0 , -0.01522824d0 , -0.07419098d0 , -0.022202d0 , -0.12242283d0 , -0.04177571d0 , -0.16983107d0 /)
|
||||
expo_gauss_j_mu_1_erf = (/ 2.74057056d+00, 1.37626591d+04, 6.65578663d+01, 1.34693031d+03, 1.90547699d+01, 2.69445390d+02, 6.31845879d+00/)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_1_erf(i) = tmp * expo_gauss_j_mu_1_erf(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 8) then
|
||||
|
||||
coef_gauss_j_mu_1_erf = (/ -0.12263328d0 , -0.04965255d0 , -0.15463564d0 , -0.09675781d0 , -0.0807023d0 , -0.02923298d0 , -0.01381381d0 , -0.01675923d0 /)
|
||||
expo_gauss_j_mu_1_erf = (/ 1.36101994d+01, 1.24908367d+02, 5.29061388d+00, 2.60692516d+00, 3.93396935d+01, 4.43071610d+02, 1.54902240d+04, 1.85170446d+03 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_1_erf(i) = tmp * expo_gauss_j_mu_1_erf(i)
|
||||
enddo
|
||||
|
||||
!elseif(ng_fit_jast .eq. 9) then
|
||||
|
||||
! coef_gauss_j_mu_1_erf = (/ /)
|
||||
! expo_gauss_j_mu_1_erf = (/ /)
|
||||
|
||||
! tmp = mu_erf * mu_erf
|
||||
! do i = 1, ng_fit_jast
|
||||
! expo_gauss_j_mu_1_erf(i) = tmp * expo_gauss_j_mu_1_erf(i)
|
||||
! enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 20) then
|
||||
|
||||
ASSERT(n_max_fit_slat == 20)
|
||||
|
||||
!alpha_opt = expo_j_xmu(1) + expo_gauss_1_erf_x(1)
|
||||
!beta_opt = expo_j_xmu(2) + expo_gauss_1_erf_x(2)
|
||||
|
||||
! direct opt
|
||||
alpha_opt = 2.87875632d0
|
||||
beta_opt = 1.34801003d0
|
||||
|
||||
alpha = alpha_opt * mu_erf
|
||||
call expo_fit_slater_gam(alpha, expos)
|
||||
beta = beta_opt * mu_erf * mu_erf
|
||||
|
||||
tmp = -1.d0 / dsqrt(dacos(-1.d0))
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_j_mu_1_erf(i) = expos(i) + beta
|
||||
coef_gauss_j_mu_1_erf(i) = tmp * coef_fit_slat_gauss(i)
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
print *, ' not implemented yet'
|
||||
stop
|
||||
|
||||
endif
|
||||
|
||||
tmp = 0.25d0 / mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
coef_gauss_j_mu_1_erf(i) = tmp * coef_gauss_j_mu_1_erf(i)
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
double precision function F_x_j(x)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! F_x_j(x) = dimension-less correlation factor = x (1 - erf(x)) - 1/sqrt(pi) exp(-x^2)
|
||||
END_DOC
|
||||
double precision, intent(in) :: x
|
||||
F_x_j = x * (1.d0 - derf(x)) - 1/dsqrt(dacos(-1.d0)) * dexp(-x**2)
|
||||
|
||||
end
|
||||
|
||||
double precision function j_mu_F_x_j(x)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! j_mu_F_x_j(x) = correlation factor = 1/2 r12 * (1 - erf(mu*r12)) - 1/(2 sqrt(pi)*mu) exp(-(mu*r12)^2)
|
||||
!
|
||||
! = 1/(2*mu) * F_x_j(mu*x)
|
||||
END_DOC
|
||||
double precision :: F_x_j
|
||||
double precision, intent(in) :: x
|
||||
j_mu_F_x_j = 0.5d0/mu_erf * F_x_j(x*mu_erf)
|
||||
end
|
||||
|
||||
double precision function j_mu(x)
|
||||
implicit none
|
||||
double precision, intent(in) :: x
|
||||
BEGIN_DOC
|
||||
! j_mu(x) = correlation factor = 1/2 r12 * (1 - erf(mu*r12)) - 1/(2 sqrt(pi)*mu) exp(-(mu*r12)^2)
|
||||
END_DOC
|
||||
j_mu = 0.5d0* x * (1.d0 - derf(mu_erf*x)) - 0.5d0/( dsqrt(dacos(-1.d0))*mu_erf) * dexp(-(mu_erf*x)*(mu_erf*x))
|
||||
|
||||
end
|
||||
|
||||
double precision function j_mu_fit_gauss(x)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! j_mu_fit_gauss(x) = correlation factor = 1/2 r12 * (1 - erf(mu*r12)) - 1/(2 sqrt(pi)*mu) exp(-(mu*r12)^2)
|
||||
!
|
||||
! but fitted with gaussians
|
||||
END_DOC
|
||||
double precision, intent(in) :: x
|
||||
integer :: i
|
||||
double precision :: alpha,coef
|
||||
j_mu_fit_gauss = 0.d0
|
||||
do i = 1, n_max_fit_slat
|
||||
alpha = expo_gauss_j_mu_x(i)
|
||||
coef = coef_gauss_j_mu_x(i)
|
||||
j_mu_fit_gauss += coef * dexp(-alpha*x*x)
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
! ---
|
||||
|
194
src/ao_tc_eff_map/integrals_eff_pot_in_map_slave.irp.f
Normal file
194
src/ao_tc_eff_map/integrals_eff_pot_in_map_slave.irp.f
Normal file
@ -0,0 +1,194 @@
|
||||
subroutine ao_tc_sym_two_e_pot_in_map_slave_tcp(i)
|
||||
implicit none
|
||||
integer, intent(in) :: i
|
||||
BEGIN_DOC
|
||||
! Computes a buffer of integrals. i is the ID of the current thread.
|
||||
END_DOC
|
||||
call ao_tc_sym_two_e_pot_in_map_slave(0,i)
|
||||
end
|
||||
|
||||
|
||||
subroutine ao_tc_sym_two_e_pot_in_map_slave_inproc(i)
|
||||
implicit none
|
||||
integer, intent(in) :: i
|
||||
BEGIN_DOC
|
||||
! Computes a buffer of integrals. i is the ID of the current thread.
|
||||
END_DOC
|
||||
call ao_tc_sym_two_e_pot_in_map_slave(1,i)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
subroutine ao_tc_sym_two_e_pot_in_map_slave(thread,iproc)
|
||||
use map_module
|
||||
use f77_zmq
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Computes a buffer of integrals
|
||||
END_DOC
|
||||
|
||||
integer, intent(in) :: thread, iproc
|
||||
|
||||
integer :: j,l,n_integrals
|
||||
integer :: rc
|
||||
real(integral_kind), allocatable :: buffer_value(:)
|
||||
integer(key_kind), allocatable :: buffer_i(:)
|
||||
|
||||
integer :: worker_id, task_id
|
||||
character*(512) :: task
|
||||
|
||||
integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket
|
||||
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
|
||||
|
||||
integer(ZMQ_PTR), external :: new_zmq_push_socket
|
||||
integer(ZMQ_PTR) :: zmq_socket_push
|
||||
|
||||
character*(64) :: state
|
||||
|
||||
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
||||
|
||||
integer, external :: connect_to_taskserver
|
||||
if (connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) == -1) then
|
||||
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
|
||||
return
|
||||
endif
|
||||
|
||||
zmq_socket_push = new_zmq_push_socket(thread)
|
||||
|
||||
allocate ( buffer_i(ao_num*ao_num), buffer_value(ao_num*ao_num) )
|
||||
|
||||
|
||||
do
|
||||
integer, external :: get_task_from_taskserver
|
||||
if (get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task) == -1) then
|
||||
exit
|
||||
endif
|
||||
if (task_id == 0) exit
|
||||
read(task,*) j, l
|
||||
integer, external :: task_done_to_taskserver
|
||||
call compute_ao_tc_sym_two_e_pot_jl(j,l,n_integrals,buffer_i,buffer_value)
|
||||
if (task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id) == -1) then
|
||||
stop 'Unable to send task_done'
|
||||
endif
|
||||
call push_integrals(zmq_socket_push, n_integrals, buffer_i, buffer_value, task_id)
|
||||
enddo
|
||||
|
||||
integer, external :: disconnect_from_taskserver
|
||||
if (disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) == -1) then
|
||||
continue
|
||||
endif
|
||||
deallocate( buffer_i, buffer_value )
|
||||
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
|
||||
call end_zmq_push_socket(zmq_socket_push,thread)
|
||||
|
||||
end
|
||||
|
||||
|
||||
subroutine ao_tc_sym_two_e_pot_in_map_collector(zmq_socket_pull)
|
||||
use map_module
|
||||
use f77_zmq
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Collects results from the AO integral calculation
|
||||
END_DOC
|
||||
|
||||
integer(ZMQ_PTR), intent(in) :: zmq_socket_pull
|
||||
integer :: j,l,n_integrals
|
||||
integer :: rc
|
||||
|
||||
real(integral_kind), allocatable :: buffer_value(:)
|
||||
integer(key_kind), allocatable :: buffer_i(:)
|
||||
|
||||
integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket
|
||||
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
|
||||
|
||||
integer(ZMQ_PTR), external :: new_zmq_pull_socket
|
||||
|
||||
integer*8 :: control, accu, sze
|
||||
integer :: task_id, more
|
||||
|
||||
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
||||
|
||||
sze = ao_num*ao_num
|
||||
allocate ( buffer_i(sze), buffer_value(sze) )
|
||||
|
||||
accu = 0_8
|
||||
more = 1
|
||||
do while (more == 1)
|
||||
|
||||
rc = f77_zmq_recv( zmq_socket_pull, n_integrals, 4, 0)
|
||||
if (rc == -1) then
|
||||
n_integrals = 0
|
||||
return
|
||||
endif
|
||||
if (rc /= 4) then
|
||||
print *, irp_here, ': f77_zmq_recv( zmq_socket_pull, n_integrals, 4, 0)'
|
||||
stop 'error'
|
||||
endif
|
||||
|
||||
if (n_integrals >= 0) then
|
||||
|
||||
if (n_integrals > sze) then
|
||||
deallocate (buffer_value, buffer_i)
|
||||
sze = n_integrals
|
||||
allocate (buffer_value(sze), buffer_i(sze))
|
||||
endif
|
||||
|
||||
rc = f77_zmq_recv( zmq_socket_pull, buffer_i, key_kind*n_integrals, 0)
|
||||
if (rc /= key_kind*n_integrals) then
|
||||
print *, rc, key_kind, n_integrals
|
||||
print *, irp_here, ': f77_zmq_recv( zmq_socket_pull, buffer_i, key_kind*n_integrals, 0)'
|
||||
stop 'error'
|
||||
endif
|
||||
|
||||
rc = f77_zmq_recv( zmq_socket_pull, buffer_value, integral_kind*n_integrals, 0)
|
||||
if (rc /= integral_kind*n_integrals) then
|
||||
print *, irp_here, ': f77_zmq_recv( zmq_socket_pull, buffer_value, integral_kind*n_integrals, 0)'
|
||||
stop 'error'
|
||||
endif
|
||||
|
||||
rc = f77_zmq_recv( zmq_socket_pull, task_id, 4, 0)
|
||||
|
||||
IRP_IF ZMQ_PUSH
|
||||
IRP_ELSE
|
||||
rc = f77_zmq_send( zmq_socket_pull, 0, 4, 0)
|
||||
if (rc /= 4) then
|
||||
print *, irp_here, ' : f77_zmq_send (zmq_socket_pull,...'
|
||||
stop 'error'
|
||||
endif
|
||||
IRP_ENDIF
|
||||
|
||||
|
||||
call insert_into_ao_tc_sym_two_e_pot_map(n_integrals,buffer_i,buffer_value)
|
||||
accu += n_integrals
|
||||
if (task_id /= 0) then
|
||||
integer, external :: zmq_delete_task
|
||||
if (zmq_delete_task(zmq_to_qp_run_socket,zmq_socket_pull,task_id,more) == -1) then
|
||||
stop 'Unable to delete task'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
enddo
|
||||
|
||||
deallocate( buffer_i, buffer_value )
|
||||
|
||||
integer (map_size_kind) :: get_ao_tc_sym_two_e_pot_map_size
|
||||
control = get_ao_tc_sym_two_e_pot_map_size(ao_tc_sym_two_e_pot_map)
|
||||
|
||||
if (control /= accu) then
|
||||
print *, ''
|
||||
print *, irp_here
|
||||
print *, 'Control : ', control
|
||||
print *, 'Accu : ', accu
|
||||
print *, 'Some integrals were lost during the parallel computation.'
|
||||
print *, 'Try to reduce the number of threads.'
|
||||
stop
|
||||
endif
|
||||
|
||||
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
|
||||
|
||||
end
|
||||
|
313
src/ao_tc_eff_map/map_integrals_eff_pot.irp.f
Normal file
313
src/ao_tc_eff_map/map_integrals_eff_pot.irp.f
Normal file
@ -0,0 +1,313 @@
|
||||
use map_module
|
||||
|
||||
!! AO Map
|
||||
!! ======
|
||||
|
||||
BEGIN_PROVIDER [ type(map_type), ao_tc_sym_two_e_pot_map ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! |AO| integrals
|
||||
END_DOC
|
||||
integer(key_kind) :: key_max
|
||||
integer(map_size_kind) :: sze
|
||||
call two_e_integrals_index(ao_num,ao_num,ao_num,ao_num,key_max)
|
||||
sze = key_max
|
||||
call map_init(ao_tc_sym_two_e_pot_map,sze)
|
||||
print*, 'ao_tc_sym_two_e_pot_map map initialized : ', sze
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ integer, ao_tc_sym_two_e_pot_cache_min ]
|
||||
&BEGIN_PROVIDER [ integer, ao_tc_sym_two_e_pot_cache_max ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Min and max values of the AOs for which the integrals are in the cache
|
||||
END_DOC
|
||||
ao_tc_sym_two_e_pot_cache_min = max(1,ao_num - 63)
|
||||
ao_tc_sym_two_e_pot_cache_max = ao_num
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_tc_sym_two_e_pot_cache, (0:64*64*64*64) ]
|
||||
|
||||
use map_module
|
||||
implicit none
|
||||
|
||||
BEGIN_DOC
|
||||
! Cache of |AO| integrals for fast access
|
||||
END_DOC
|
||||
|
||||
integer :: i,j,k,l,ii
|
||||
integer(key_kind) :: idx
|
||||
real(integral_kind) :: integral
|
||||
|
||||
PROVIDE ao_tc_sym_two_e_pot_in_map
|
||||
|
||||
!$OMP PARALLEL DO PRIVATE (i,j,k,l,idx,ii,integral)
|
||||
do l = ao_tc_sym_two_e_pot_cache_min, ao_tc_sym_two_e_pot_cache_max
|
||||
do k = ao_tc_sym_two_e_pot_cache_min, ao_tc_sym_two_e_pot_cache_max
|
||||
do j = ao_tc_sym_two_e_pot_cache_min, ao_tc_sym_two_e_pot_cache_max
|
||||
do i = ao_tc_sym_two_e_pot_cache_min, ao_tc_sym_two_e_pot_cache_max
|
||||
!DIR$ FORCEINLINE
|
||||
call two_e_integrals_index(i, j, k, l, idx)
|
||||
!DIR$ FORCEINLINE
|
||||
call map_get(ao_tc_sym_two_e_pot_map, idx, integral)
|
||||
ii = l-ao_tc_sym_two_e_pot_cache_min
|
||||
ii = ior( ishft(ii,6), k-ao_tc_sym_two_e_pot_cache_min)
|
||||
ii = ior( ishft(ii,6), j-ao_tc_sym_two_e_pot_cache_min)
|
||||
ii = ior( ishft(ii,6), i-ao_tc_sym_two_e_pot_cache_min)
|
||||
ao_tc_sym_two_e_pot_cache(ii) = integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END PARALLEL DO
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
subroutine insert_into_ao_tc_sym_two_e_pot_map(n_integrals, buffer_i, buffer_values)
|
||||
|
||||
use map_module
|
||||
implicit none
|
||||
|
||||
BEGIN_DOC
|
||||
! Create new entry into |AO| map
|
||||
END_DOC
|
||||
|
||||
integer, intent(in) :: n_integrals
|
||||
integer(key_kind), intent(inout) :: buffer_i(n_integrals)
|
||||
real(integral_kind), intent(inout) :: buffer_values(n_integrals)
|
||||
|
||||
call map_append(ao_tc_sym_two_e_pot_map, buffer_i, buffer_values, n_integrals)
|
||||
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
double precision function get_ao_tc_sym_two_e_pot(i, j, k, l, map) result(result)
|
||||
|
||||
use map_module
|
||||
|
||||
implicit none
|
||||
|
||||
BEGIN_DOC
|
||||
! Gets one |AO| two-electron integral from the |AO| map
|
||||
END_DOC
|
||||
|
||||
integer, intent(in) :: i,j,k,l
|
||||
integer(key_kind) :: idx
|
||||
type(map_type), intent(inout) :: map
|
||||
integer :: ii
|
||||
real(integral_kind) :: tmp
|
||||
logical, external :: ao_two_e_integral_zero
|
||||
|
||||
PROVIDE ao_tc_sym_two_e_pot_in_map ao_tc_sym_two_e_pot_cache ao_tc_sym_two_e_pot_cache_min
|
||||
|
||||
!DIR$ FORCEINLINE
|
||||
! if (ao_two_e_integral_zero(i,j,k,l)) then
|
||||
if (.False.) then
|
||||
tmp = 0.d0
|
||||
!else if (ao_two_e_integral_erf_schwartz(i,k)*ao_two_e_integral_erf_schwartz(j,l) < ao_integrals_threshold) then
|
||||
! tmp = 0.d0
|
||||
else
|
||||
ii = l-ao_tc_sym_two_e_pot_cache_min
|
||||
ii = ior(ii, k-ao_tc_sym_two_e_pot_cache_min)
|
||||
ii = ior(ii, j-ao_tc_sym_two_e_pot_cache_min)
|
||||
ii = ior(ii, i-ao_tc_sym_two_e_pot_cache_min)
|
||||
if (iand(ii, -64) /= 0) then
|
||||
!DIR$ FORCEINLINE
|
||||
call two_e_integrals_index(i, j, k, l, idx)
|
||||
!DIR$ FORCEINLINE
|
||||
call map_get(map, idx, tmp)
|
||||
tmp = tmp
|
||||
else
|
||||
ii = l-ao_tc_sym_two_e_pot_cache_min
|
||||
ii = ior( ishft(ii,6), k-ao_tc_sym_two_e_pot_cache_min)
|
||||
ii = ior( ishft(ii,6), j-ao_tc_sym_two_e_pot_cache_min)
|
||||
ii = ior( ishft(ii,6), i-ao_tc_sym_two_e_pot_cache_min)
|
||||
tmp = ao_tc_sym_two_e_pot_cache(ii)
|
||||
endif
|
||||
endif
|
||||
|
||||
result = tmp
|
||||
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
subroutine get_many_ao_tc_sym_two_e_pot(j,k,l,sze,out_val)
|
||||
use map_module
|
||||
BEGIN_DOC
|
||||
! Gets multiple |AO| two-electron integral from the |AO| map .
|
||||
! All i are retrieved for j,k,l fixed.
|
||||
END_DOC
|
||||
implicit none
|
||||
integer, intent(in) :: j,k,l, sze
|
||||
real(integral_kind), intent(out) :: out_val(sze)
|
||||
|
||||
integer :: i
|
||||
integer(key_kind) :: hash
|
||||
double precision :: thresh
|
||||
! logical, external :: ao_one_e_integral_zero
|
||||
PROVIDE ao_tc_sym_two_e_pot_in_map ao_tc_sym_two_e_pot_map
|
||||
thresh = ao_integrals_threshold
|
||||
|
||||
! if (ao_one_e_integral_zero(j,l)) then
|
||||
if (.False.) then
|
||||
out_val = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
double precision :: get_ao_tc_sym_two_e_pot
|
||||
do i=1,sze
|
||||
out_val(i) = get_ao_tc_sym_two_e_pot(i,j,k,l,ao_tc_sym_two_e_pot_map)
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
subroutine get_many_ao_tc_sym_two_e_pot_non_zero(j,k,l,sze,out_val,out_val_index,non_zero_int)
|
||||
use map_module
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Gets multiple |AO| two-electron integrals from the |AO| map .
|
||||
! All non-zero i are retrieved for j,k,l fixed.
|
||||
END_DOC
|
||||
integer, intent(in) :: j,k,l, sze
|
||||
real(integral_kind), intent(out) :: out_val(sze)
|
||||
integer, intent(out) :: out_val_index(sze),non_zero_int
|
||||
|
||||
integer :: i
|
||||
integer(key_kind) :: hash
|
||||
double precision :: thresh,tmp
|
||||
! logical, external :: ao_one_e_integral_zero
|
||||
PROVIDE ao_tc_sym_two_e_pot_in_map
|
||||
thresh = ao_integrals_threshold
|
||||
|
||||
non_zero_int = 0
|
||||
! if (ao_one_e_integral_zero(j,l)) then
|
||||
if (.False.) then
|
||||
out_val = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
non_zero_int = 0
|
||||
do i=1,sze
|
||||
integer, external :: ao_l4
|
||||
double precision, external :: ao_two_e_integral_eff_pot
|
||||
!DIR$ FORCEINLINE
|
||||
!if (ao_two_e_integral_erf_schwartz(i,k)*ao_two_e_integral_erf_schwartz(j,l) < thresh) then
|
||||
! cycle
|
||||
!endif
|
||||
call two_e_integrals_index(i,j,k,l,hash)
|
||||
call map_get(ao_tc_sym_two_e_pot_map, hash,tmp)
|
||||
if (dabs(tmp) < thresh ) cycle
|
||||
non_zero_int = non_zero_int+1
|
||||
out_val_index(non_zero_int) = i
|
||||
out_val(non_zero_int) = tmp
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
|
||||
function get_ao_tc_sym_two_e_pot_map_size()
|
||||
implicit none
|
||||
integer (map_size_kind) :: get_ao_tc_sym_two_e_pot_map_size
|
||||
BEGIN_DOC
|
||||
! Returns the number of elements in the |AO| map
|
||||
END_DOC
|
||||
get_ao_tc_sym_two_e_pot_map_size = ao_tc_sym_two_e_pot_map % n_elements
|
||||
end
|
||||
|
||||
subroutine clear_ao_tc_sym_two_e_pot_map
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Frees the memory of the |AO| map
|
||||
END_DOC
|
||||
call map_deinit(ao_tc_sym_two_e_pot_map)
|
||||
FREE ao_tc_sym_two_e_pot_map
|
||||
end
|
||||
|
||||
|
||||
|
||||
subroutine dump_ao_tc_sym_two_e_pot(filename)
|
||||
use map_module
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Save to disk the |AO| eff_pot integrals
|
||||
END_DOC
|
||||
character*(*), intent(in) :: filename
|
||||
integer(cache_key_kind), pointer :: key(:)
|
||||
real(integral_kind), pointer :: val(:)
|
||||
integer*8 :: i,j, n
|
||||
call ezfio_set_work_empty(.False.)
|
||||
open(unit=66,file=filename,FORM='unformatted')
|
||||
write(66) integral_kind, key_kind
|
||||
write(66) ao_tc_sym_two_e_pot_map%sorted, ao_tc_sym_two_e_pot_map%map_size, &
|
||||
ao_tc_sym_two_e_pot_map%n_elements
|
||||
do i=0_8,ao_tc_sym_two_e_pot_map%map_size
|
||||
write(66) ao_tc_sym_two_e_pot_map%map(i)%sorted, ao_tc_sym_two_e_pot_map%map(i)%map_size,&
|
||||
ao_tc_sym_two_e_pot_map%map(i)%n_elements
|
||||
enddo
|
||||
do i=0_8,ao_tc_sym_two_e_pot_map%map_size
|
||||
key => ao_tc_sym_two_e_pot_map%map(i)%key
|
||||
val => ao_tc_sym_two_e_pot_map%map(i)%value
|
||||
n = ao_tc_sym_two_e_pot_map%map(i)%n_elements
|
||||
write(66) (key(j), j=1,n), (val(j), j=1,n)
|
||||
enddo
|
||||
close(66)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
integer function load_ao_tc_sym_two_e_pot(filename)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Read from disk the |AO| eff_pot integrals
|
||||
END_DOC
|
||||
character*(*), intent(in) :: filename
|
||||
integer*8 :: i
|
||||
integer(cache_key_kind), pointer :: key(:)
|
||||
real(integral_kind), pointer :: val(:)
|
||||
integer :: iknd, kknd
|
||||
integer*8 :: n, j
|
||||
load_ao_tc_sym_two_e_pot = 1
|
||||
open(unit=66,file=filename,FORM='unformatted',STATUS='UNKNOWN')
|
||||
read(66,err=98,end=98) iknd, kknd
|
||||
if (iknd /= integral_kind) then
|
||||
print *, 'Wrong integrals kind in file :', iknd
|
||||
stop 1
|
||||
endif
|
||||
if (kknd /= key_kind) then
|
||||
print *, 'Wrong key kind in file :', kknd
|
||||
stop 1
|
||||
endif
|
||||
read(66,err=98,end=98) ao_tc_sym_two_e_pot_map%sorted, ao_tc_sym_two_e_pot_map%map_size,&
|
||||
ao_tc_sym_two_e_pot_map%n_elements
|
||||
do i=0_8, ao_tc_sym_two_e_pot_map%map_size
|
||||
read(66,err=99,end=99) ao_tc_sym_two_e_pot_map%map(i)%sorted, &
|
||||
ao_tc_sym_two_e_pot_map%map(i)%map_size, ao_tc_sym_two_e_pot_map%map(i)%n_elements
|
||||
call cache_map_reallocate(ao_tc_sym_two_e_pot_map%map(i),ao_tc_sym_two_e_pot_map%map(i)%map_size)
|
||||
enddo
|
||||
do i=0_8, ao_tc_sym_two_e_pot_map%map_size
|
||||
key => ao_tc_sym_two_e_pot_map%map(i)%key
|
||||
val => ao_tc_sym_two_e_pot_map%map(i)%value
|
||||
n = ao_tc_sym_two_e_pot_map%map(i)%n_elements
|
||||
read(66,err=99,end=99) (key(j), j=1,n), (val(j), j=1,n)
|
||||
enddo
|
||||
call map_sort(ao_tc_sym_two_e_pot_map)
|
||||
load_ao_tc_sym_two_e_pot = 0
|
||||
return
|
||||
99 continue
|
||||
call map_deinit(ao_tc_sym_two_e_pot_map)
|
||||
98 continue
|
||||
stop 'Problem reading ao_tc_sym_two_e_pot_map file in work/'
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
332
src/ao_tc_eff_map/one_e_1bgauss_grad2.irp.f
Normal file
332
src/ao_tc_eff_map/one_e_1bgauss_grad2.irp.f
Normal file
@ -0,0 +1,332 @@
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, j1b_gauss_hermII, (ao_num,ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! :math:`\langle \chi_A | -0.5 \grad \tau_{1b} \cdot \grad \tau_{1b} | \chi_B \rangle`
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: num_A, num_B
|
||||
integer :: power_A(3), power_B(3)
|
||||
integer :: i, j, k1, k2, l, m
|
||||
double precision :: alpha, beta, gama1, gama2, coef1, coef2
|
||||
double precision :: A_center(3), B_center(3), C_center1(3), C_center2(3)
|
||||
double precision :: c1, c
|
||||
|
||||
integer :: dim1
|
||||
double precision :: overlap_y, d_a_2, overlap_z, overlap
|
||||
|
||||
double precision :: int_gauss_4G
|
||||
|
||||
PROVIDE j1b_type j1b_pen j1b_coeff
|
||||
|
||||
! --------------------------------------------------------------------------------
|
||||
! -- Dummy call to provide everything
|
||||
dim1 = 100
|
||||
A_center(:) = 0.d0
|
||||
B_center(:) = 1.d0
|
||||
alpha = 1.d0
|
||||
beta = 0.1d0
|
||||
power_A(:) = 1
|
||||
power_B(:) = 0
|
||||
call overlap_gaussian_xyz( A_center, B_center, alpha, beta, power_A, power_B &
|
||||
, overlap_y, d_a_2, overlap_z, overlap, dim1 )
|
||||
! --------------------------------------------------------------------------------
|
||||
|
||||
|
||||
j1b_gauss_hermII(1:ao_num,1:ao_num) = 0.d0
|
||||
|
||||
if(j1b_type .eq. 1) then
|
||||
! \tau_1b = \sum_iA -[1 - exp(-alpha_A r_iA^2)]
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k1, k2, l, m, alpha, beta, gama1, gama2, &
|
||||
!$OMP A_center, B_center, C_center1, C_center2, &
|
||||
!$OMP power_A, power_B, num_A, num_B, c1, c) &
|
||||
!$OMP SHARED (ao_num, ao_prim_num, ao_expo_ordered_transp, &
|
||||
!$OMP ao_power, ao_nucl, nucl_coord, &
|
||||
!$OMP ao_coef_normalized_ordered_transp, &
|
||||
!$OMP nucl_num, j1b_pen, j1b_gauss_hermII)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
do i = 1, ao_num
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
c = 0.d0
|
||||
do k1 = 1, nucl_num
|
||||
gama1 = j1b_pen(k1)
|
||||
C_center1(1:3) = nucl_coord(k1,1:3)
|
||||
|
||||
do k2 = 1, nucl_num
|
||||
gama2 = j1b_pen(k2)
|
||||
C_center2(1:3) = nucl_coord(k2,1:3)
|
||||
|
||||
! < XA | exp[-gama1 r_C1^2 -gama2 r_C2^2] r_C1 \cdot r_C2 | XB >
|
||||
c1 = int_gauss_4G( A_center, B_center, C_center1, C_center2 &
|
||||
, power_A, power_B, alpha, beta, gama1, gama2 )
|
||||
|
||||
c = c - 2.d0 * gama1 * gama2 * c1
|
||||
enddo
|
||||
enddo
|
||||
|
||||
j1b_gauss_hermII(i,j) = j1b_gauss_hermII(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
elseif(j1b_type .eq. 2) then
|
||||
! \tau_1b = \sum_iA [c_A exp(-alpha_A r_iA^2)]
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k1, k2, l, m, alpha, beta, gama1, gama2, &
|
||||
!$OMP A_center, B_center, C_center1, C_center2, &
|
||||
!$OMP power_A, power_B, num_A, num_B, c1, c, &
|
||||
!$OMP coef1, coef2) &
|
||||
!$OMP SHARED (ao_num, ao_prim_num, ao_expo_ordered_transp, &
|
||||
!$OMP ao_power, ao_nucl, nucl_coord, &
|
||||
!$OMP ao_coef_normalized_ordered_transp, &
|
||||
!$OMP nucl_num, j1b_pen, j1b_gauss_hermII, &
|
||||
!$OMP j1b_coeff)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
do i = 1, ao_num
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
c = 0.d0
|
||||
do k1 = 1, nucl_num
|
||||
gama1 = j1b_pen (k1)
|
||||
coef1 = j1b_coeff(k1)
|
||||
C_center1(1:3) = nucl_coord(k1,1:3)
|
||||
|
||||
do k2 = 1, nucl_num
|
||||
gama2 = j1b_pen (k2)
|
||||
coef2 = j1b_coeff(k2)
|
||||
C_center2(1:3) = nucl_coord(k2,1:3)
|
||||
|
||||
! < XA | exp[-gama1 r_C1^2 -gama2 r_C2^2] r_C1 \cdot r_C2 | XB >
|
||||
c1 = int_gauss_4G( A_center, B_center, C_center1, C_center2 &
|
||||
, power_A, power_B, alpha, beta, gama1, gama2 )
|
||||
|
||||
c = c - 2.d0 * gama1 * gama2 * coef1 * coef2 * c1
|
||||
enddo
|
||||
enddo
|
||||
|
||||
j1b_gauss_hermII(i,j) = j1b_gauss_hermII(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
!_____________________________________________________________________________________________________________
|
||||
!
|
||||
! < XA | exp[-gama1 r_C1^2 -gama2 r_C2^2] r_C1 \cdot r_C2 | XB >
|
||||
!
|
||||
double precision function int_gauss_4G( A_center, B_center, C_center1, C_center2, power_A, power_B &
|
||||
, alpha, beta, gama1, gama2 )
|
||||
|
||||
! for max_dim
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer , intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: A_center(3), B_center(3), C_center1(3), C_center2(3)
|
||||
double precision, intent(in) :: alpha, beta, gama1, gama2
|
||||
|
||||
integer :: i, dim1, power_C
|
||||
integer :: iorder(3)
|
||||
double precision :: AB_expo, fact_AB, AB_center(3), P_AB(0:max_dim,3)
|
||||
double precision :: gama, fact_C, C_center(3)
|
||||
double precision :: cx0, cy0, cz0, c_tmp1, c_tmp2, cx, cy, cz
|
||||
double precision :: int_tmp
|
||||
|
||||
double precision :: overlap_gaussian_x
|
||||
|
||||
dim1 = 100
|
||||
|
||||
! P_AB(0:max_dim,3) polynomial
|
||||
! AB_center(3) new center
|
||||
! AB_expo new exponent
|
||||
! fact_AB constant factor
|
||||
! iorder(3) i_order(i) = order of the polynomials
|
||||
call give_explicit_poly_and_gaussian( P_AB, AB_center, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_B, A_center, B_center, dim1)
|
||||
|
||||
call gaussian_product(gama1, C_center1, gama2, C_center2, fact_C, gama, C_center)
|
||||
|
||||
! <<<
|
||||
! to avoid multi-evaluation
|
||||
power_C = 0
|
||||
|
||||
cx0 = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx0 = cx0 + P_AB(i,1) * overlap_gaussian_x( AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
cy0 = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy0 = cy0 + P_AB(i,2) * overlap_gaussian_x( AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
cz0 = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz0 = cz0 + P_AB(i,3) * overlap_gaussian_x( AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
! >>>
|
||||
|
||||
int_tmp = 0.d0
|
||||
|
||||
! -----------------------------------------------------------------------------------------------
|
||||
!
|
||||
! x term:
|
||||
! < XA | exp[-gama1 r_C1^2 -gama2 r_C2^2] (x - x_C1) (x - x_C2) | XB >
|
||||
!
|
||||
|
||||
c_tmp1 = 2.d0 * C_center(1) - C_center1(1) - C_center2(1)
|
||||
c_tmp2 = ( C_center(1) - C_center1(1) ) * ( C_center(1) - C_center2(1) )
|
||||
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] (x - x_C)^2 | XB >
|
||||
power_C = 2
|
||||
cx = cx + P_AB(i,1) &
|
||||
* overlap_gaussian_x( AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] (x - x_C) | XB >
|
||||
power_C = 1
|
||||
cx = cx + P_AB(i,1) * c_tmp1 &
|
||||
* overlap_gaussian_x( AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] | XB >
|
||||
power_C = 0
|
||||
cx = cx + P_AB(i,1) * c_tmp2 &
|
||||
* overlap_gaussian_x( AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
enddo
|
||||
|
||||
int_tmp += cx * cy0 * cz0
|
||||
|
||||
! -----------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
! -----------------------------------------------------------------------------------------------
|
||||
!
|
||||
! y term:
|
||||
! < XA | exp[-gama1 r_C1^2 -gama2 r_C2^2] (y - y_C1) (y - y_C2) | XB >
|
||||
!
|
||||
|
||||
c_tmp1 = 2.d0 * C_center(2) - C_center1(2) - C_center2(2)
|
||||
c_tmp2 = ( C_center(2) - C_center1(2) ) * ( C_center(2) - C_center2(2) )
|
||||
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
|
||||
! < XA | exp[-gama r_C^2] (y - y_C)^2 | XB >
|
||||
power_C = 2
|
||||
cy = cy + P_AB(i,2) &
|
||||
* overlap_gaussian_x( AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] (y - y_C) | XB >
|
||||
power_C = 1
|
||||
cy = cy + P_AB(i,2) * c_tmp1 &
|
||||
* overlap_gaussian_x( AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] | XB >
|
||||
power_C = 0
|
||||
cy = cy + P_AB(i,2) * c_tmp2 &
|
||||
* overlap_gaussian_x( AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
enddo
|
||||
|
||||
int_tmp += cx0 * cy * cz0
|
||||
|
||||
! -----------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
! -----------------------------------------------------------------------------------------------
|
||||
!
|
||||
! z term:
|
||||
! < XA | exp[-gama1 r_C1^2 -gama2 r_C2^2] (z - z_C1) (z - z_C2) | XB >
|
||||
!
|
||||
|
||||
c_tmp1 = 2.d0 * C_center(3) - C_center1(3) - C_center2(3)
|
||||
c_tmp2 = ( C_center(3) - C_center1(3) ) * ( C_center(3) - C_center2(3) )
|
||||
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
|
||||
! < XA | exp[-gama r_C^2] (z - z_C)^2 | XB >
|
||||
power_C = 2
|
||||
cz = cz + P_AB(i,3) &
|
||||
* overlap_gaussian_x( AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] (z - z_C) | XB >
|
||||
power_C = 1
|
||||
cz = cz + P_AB(i,3) * c_tmp1 &
|
||||
* overlap_gaussian_x( AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] | XB >
|
||||
power_C = 0
|
||||
cz = cz + P_AB(i,3) * c_tmp2 &
|
||||
* overlap_gaussian_x( AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
enddo
|
||||
|
||||
int_tmp += cx0 * cy0 * cz
|
||||
|
||||
! -----------------------------------------------------------------------------------------------
|
||||
|
||||
int_gauss_4G = fact_AB * fact_C * int_tmp
|
||||
|
||||
return
|
||||
end function int_gauss_4G
|
||||
!_____________________________________________________________________________________________________________
|
||||
!_____________________________________________________________________________________________________________
|
||||
|
||||
|
303
src/ao_tc_eff_map/one_e_1bgauss_lap.irp.f
Normal file
303
src/ao_tc_eff_map/one_e_1bgauss_lap.irp.f
Normal file
@ -0,0 +1,303 @@
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, j1b_gauss_hermI, (ao_num,ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! :math:`\langle \chi_A | -0.5 \Delta \tau_{1b} | \chi_B \rangle`
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: num_A, num_B
|
||||
integer :: power_A(3), power_B(3)
|
||||
integer :: i, j, k, l, m
|
||||
double precision :: alpha, beta, gama, coef
|
||||
double precision :: A_center(3), B_center(3), C_center(3)
|
||||
double precision :: c1, c2, c
|
||||
|
||||
integer :: dim1
|
||||
double precision :: overlap_y, d_a_2, overlap_z, overlap
|
||||
|
||||
double precision :: int_gauss_r0, int_gauss_r2
|
||||
|
||||
PROVIDE j1b_type j1b_pen j1b_coeff
|
||||
|
||||
! --------------------------------------------------------------------------------
|
||||
! -- Dummy call to provide everything
|
||||
dim1 = 100
|
||||
A_center(:) = 0.d0
|
||||
B_center(:) = 1.d0
|
||||
alpha = 1.d0
|
||||
beta = 0.1d0
|
||||
power_A(:) = 1
|
||||
power_B(:) = 0
|
||||
call overlap_gaussian_xyz( A_center, B_center, alpha, beta, power_A, power_B &
|
||||
, overlap_y, d_a_2, overlap_z, overlap, dim1 )
|
||||
! --------------------------------------------------------------------------------
|
||||
|
||||
j1b_gauss_hermI(1:ao_num,1:ao_num) = 0.d0
|
||||
|
||||
if(j1b_type .eq. 1) then
|
||||
! \tau_1b = \sum_iA -[1 - exp(-alpha_A r_iA^2)]
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k, l, m, alpha, beta, gama, &
|
||||
!$OMP A_center, B_center, C_center, power_A, power_B, &
|
||||
!$OMP num_A, num_B, c1, c2, c) &
|
||||
!$OMP SHARED (ao_num, ao_prim_num, ao_expo_ordered_transp, &
|
||||
!$OMP ao_power, ao_nucl, nucl_coord, &
|
||||
!$OMP ao_coef_normalized_ordered_transp, &
|
||||
!$OMP nucl_num, j1b_pen, j1b_gauss_hermI)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
do i = 1, ao_num
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
c = 0.d0
|
||||
do k = 1, nucl_num
|
||||
gama = j1b_pen(k)
|
||||
C_center(1:3) = nucl_coord(k,1:3)
|
||||
|
||||
! < XA | exp[-gama r_C^2] | XB >
|
||||
c1 = int_gauss_r0( A_center, B_center, C_center &
|
||||
, power_A, power_B, alpha, beta, gama )
|
||||
|
||||
! < XA | r_A^2 exp[-gama r_C^2] | XB >
|
||||
c2 = int_gauss_r2( A_center, B_center, C_center &
|
||||
, power_A, power_B, alpha, beta, gama )
|
||||
|
||||
c = c + 3.d0 * gama * c1 - 2.d0 * gama * gama * c2
|
||||
enddo
|
||||
|
||||
j1b_gauss_hermI(i,j) = j1b_gauss_hermI(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
elseif(j1b_type .eq. 2) then
|
||||
! \tau_1b = \sum_iA [c_A exp(-alpha_A r_iA^2)]
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k, l, m, alpha, beta, gama, coef, &
|
||||
!$OMP A_center, B_center, C_center, power_A, power_B, &
|
||||
!$OMP num_A, num_B, c1, c2, c) &
|
||||
!$OMP SHARED (ao_num, ao_prim_num, ao_expo_ordered_transp, &
|
||||
!$OMP ao_power, ao_nucl, nucl_coord, &
|
||||
!$OMP ao_coef_normalized_ordered_transp, &
|
||||
!$OMP nucl_num, j1b_pen, j1b_gauss_hermI, &
|
||||
!$OMP j1b_coeff)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
do i = 1, ao_num
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
c = 0.d0
|
||||
do k = 1, nucl_num
|
||||
gama = j1b_pen (k)
|
||||
coef = j1b_coeff(k)
|
||||
C_center(1:3) = nucl_coord(k,1:3)
|
||||
|
||||
! < XA | exp[-gama r_C^2] | XB >
|
||||
c1 = int_gauss_r0( A_center, B_center, C_center &
|
||||
, power_A, power_B, alpha, beta, gama )
|
||||
|
||||
! < XA | r_A^2 exp[-gama r_C^2] | XB >
|
||||
c2 = int_gauss_r2( A_center, B_center, C_center &
|
||||
, power_A, power_B, alpha, beta, gama )
|
||||
|
||||
c = c + 3.d0 * gama * coef * c1 - 2.d0 * gama * gama * coef * c2
|
||||
enddo
|
||||
|
||||
j1b_gauss_hermI(i,j) = j1b_gauss_hermI(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
!_____________________________________________________________________________________________________________
|
||||
!
|
||||
! < XA | exp[-gama r_C^2] | XB >
|
||||
!
|
||||
double precision function int_gauss_r0(A_center, B_center, C_center, power_A, power_B, alpha, beta, gama)
|
||||
|
||||
! for max_dim
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer , intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: A_center(3), B_center(3), C_center(3)
|
||||
double precision, intent(in) :: alpha, beta, gama
|
||||
|
||||
integer :: i, power_C, dim1
|
||||
integer :: iorder(3)
|
||||
integer :: nmax
|
||||
double precision :: AB_expo, fact_AB, AB_center(3), P_AB(0:max_dim,3)
|
||||
double precision :: cx, cy, cz
|
||||
|
||||
double precision :: overlap_gaussian_x
|
||||
|
||||
dim1 = 100
|
||||
|
||||
! P_AB(0:max_dim,3) polynomial
|
||||
! AB_center(3) new center
|
||||
! AB_expo new exponent
|
||||
! fact_AB constant factor
|
||||
! iorder(3) i_order(i) = order of the polynomials
|
||||
call give_explicit_poly_and_gaussian( P_AB, AB_center, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_B, A_center, B_center, dim1)
|
||||
|
||||
if( fact_AB .lt. 1d-20 ) then
|
||||
int_gauss_r0 = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
power_C = 0
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + P_AB(i,1) * overlap_gaussian_x(AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + P_AB(i,2) * overlap_gaussian_x(AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + P_AB(i,3) * overlap_gaussian_x(AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_r0 = fact_AB * cx * cy * cz
|
||||
|
||||
return
|
||||
end function int_gauss_r0
|
||||
!_____________________________________________________________________________________________________________
|
||||
!_____________________________________________________________________________________________________________
|
||||
|
||||
|
||||
|
||||
!_____________________________________________________________________________________________________________
|
||||
!
|
||||
! < XA | r_C^2 exp[-gama r_C^2] | XB >
|
||||
!
|
||||
double precision function int_gauss_r2(A_center, B_center, C_center, power_A, power_B, alpha, beta, gama)
|
||||
|
||||
! for max_dim
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: A_center(3), B_center(3), C_center(3)
|
||||
double precision, intent(in) :: alpha, beta, gama
|
||||
|
||||
integer :: i, power_C, dim1
|
||||
integer :: iorder(3)
|
||||
double precision :: AB_expo, fact_AB, AB_center(3), P_AB(0:max_dim,3)
|
||||
double precision :: cx0, cy0, cz0, cx, cy, cz
|
||||
double precision :: int_tmp
|
||||
|
||||
double precision :: overlap_gaussian_x
|
||||
|
||||
dim1 = 100
|
||||
|
||||
! P_AB(0:max_dim,3) polynomial centered on AB_center
|
||||
! AB_center(3) new center
|
||||
! AB_expo new exponent
|
||||
! fact_AB constant factor
|
||||
! iorder(3) i_order(i) = order of the polynomials
|
||||
call give_explicit_poly_and_gaussian( P_AB, AB_center, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_B, A_center, B_center, dim1)
|
||||
|
||||
! <<<
|
||||
! to avoid multi-evaluation
|
||||
power_C = 0
|
||||
|
||||
cx0 = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx0 = cx0 + P_AB(i,1) * overlap_gaussian_x(AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
cy0 = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy0 = cy0 + P_AB(i,2) * overlap_gaussian_x(AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
cz0 = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz0 = cz0 + P_AB(i,3) * overlap_gaussian_x(AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
! >>>
|
||||
|
||||
int_tmp = 0.d0
|
||||
|
||||
power_C = 2
|
||||
|
||||
! ( x - XC)^2
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + P_AB(i,1) * overlap_gaussian_x(AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
int_tmp += cx * cy0 * cz0
|
||||
|
||||
! ( y - YC)^2
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + P_AB(i,2) * overlap_gaussian_x(AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
int_tmp += cx0 * cy * cz0
|
||||
|
||||
! ( z - ZC)^2
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + P_AB(i,3) * overlap_gaussian_x(AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
int_tmp += cx0 * cy0 * cz
|
||||
|
||||
int_gauss_r2 = fact_AB * int_tmp
|
||||
|
||||
return
|
||||
end function int_gauss_r2
|
||||
!_____________________________________________________________________________________________________________
|
||||
!_____________________________________________________________________________________________________________
|
||||
|
||||
|
371
src/ao_tc_eff_map/one_e_1bgauss_nonherm.irp.f
Normal file
371
src/ao_tc_eff_map/one_e_1bgauss_nonherm.irp.f
Normal file
@ -0,0 +1,371 @@
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, j1b_gauss_nonherm, (ao_num,ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! j1b_gauss_nonherm(i,j) = \langle \chi_j | - grad \tau_{1b} \cdot grad | \chi_i \rangle
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: num_A, num_B
|
||||
integer :: power_A(3), power_B(3)
|
||||
integer :: i, j, k, l, m
|
||||
double precision :: alpha, beta, gama, coef
|
||||
double precision :: A_center(3), B_center(3), C_center(3)
|
||||
double precision :: c1, c
|
||||
|
||||
integer :: dim1
|
||||
double precision :: overlap_y, d_a_2, overlap_z, overlap
|
||||
|
||||
double precision :: int_gauss_deriv
|
||||
|
||||
PROVIDE j1b_type j1b_pen j1b_coeff
|
||||
|
||||
! --------------------------------------------------------------------------------
|
||||
! -- Dummy call to provide everything
|
||||
dim1 = 100
|
||||
A_center(:) = 0.d0
|
||||
B_center(:) = 1.d0
|
||||
alpha = 1.d0
|
||||
beta = 0.1d0
|
||||
power_A(:) = 1
|
||||
power_B(:) = 0
|
||||
call overlap_gaussian_xyz( A_center, B_center, alpha, beta, power_A, power_B &
|
||||
, overlap_y, d_a_2, overlap_z, overlap, dim1 )
|
||||
! --------------------------------------------------------------------------------
|
||||
|
||||
|
||||
j1b_gauss_nonherm(1:ao_num,1:ao_num) = 0.d0
|
||||
|
||||
if(j1b_type .eq. 1) then
|
||||
! \tau_1b = \sum_iA -[1 - exp(-alpha_A r_iA^2)]
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k, l, m, alpha, beta, gama, &
|
||||
!$OMP A_center, B_center, C_center, power_A, power_B, &
|
||||
!$OMP num_A, num_B, c1, c) &
|
||||
!$OMP SHARED (ao_num, ao_prim_num, ao_expo_ordered_transp, &
|
||||
!$OMP ao_power, ao_nucl, nucl_coord, &
|
||||
!$OMP ao_coef_normalized_ordered_transp, &
|
||||
!$OMP nucl_num, j1b_pen, j1b_gauss_nonherm)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
do i = 1, ao_num
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
c = 0.d0
|
||||
do k = 1, nucl_num
|
||||
gama = j1b_pen(k)
|
||||
C_center(1:3) = nucl_coord(k,1:3)
|
||||
|
||||
! \langle \chi_A | exp[-gama r_C^2] r_C \cdot grad | \chi_B \rangle
|
||||
c1 = int_gauss_deriv( A_center, B_center, C_center &
|
||||
, power_A, power_B, alpha, beta, gama )
|
||||
|
||||
c = c + 2.d0 * gama * c1
|
||||
enddo
|
||||
|
||||
j1b_gauss_nonherm(i,j) = j1b_gauss_nonherm(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
elseif(j1b_type .eq. 2) then
|
||||
! \tau_1b = \sum_iA [c_A exp(-alpha_A r_iA^2)]
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k, l, m, alpha, beta, gama, coef, &
|
||||
!$OMP A_center, B_center, C_center, power_A, power_B, &
|
||||
!$OMP num_A, num_B, c1, c) &
|
||||
!$OMP SHARED (ao_num, ao_prim_num, ao_expo_ordered_transp, &
|
||||
!$OMP ao_power, ao_nucl, nucl_coord, &
|
||||
!$OMP ao_coef_normalized_ordered_transp, &
|
||||
!$OMP nucl_num, j1b_pen, j1b_gauss_nonherm, &
|
||||
!$OMP j1b_coeff)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
do i = 1, ao_num
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
c = 0.d0
|
||||
do k = 1, nucl_num
|
||||
gama = j1b_pen (k)
|
||||
coef = j1b_coeff(k)
|
||||
C_center(1:3) = nucl_coord(k,1:3)
|
||||
|
||||
! \langle \chi_A | exp[-gama r_C^2] r_C \cdot grad | \chi_B \rangle
|
||||
c1 = int_gauss_deriv( A_center, B_center, C_center &
|
||||
, power_A, power_B, alpha, beta, gama )
|
||||
|
||||
c = c + 2.d0 * gama * coef * c1
|
||||
enddo
|
||||
|
||||
j1b_gauss_nonherm(i,j) = j1b_gauss_nonherm(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
!_____________________________________________________________________________________________________________
|
||||
!
|
||||
! < XA | exp[-gama r_C^2] r_C \cdot grad | XB >
|
||||
!
|
||||
double precision function int_gauss_deriv(A_center, B_center, C_center, power_A, power_B, alpha, beta, gama)
|
||||
|
||||
! for max_dim
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
double precision, intent(in) :: A_center(3), B_center(3), C_center(3)
|
||||
integer , intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: alpha, beta, gama
|
||||
|
||||
integer :: i, power_C, dim1
|
||||
integer :: iorder(3), power_D(3)
|
||||
double precision :: AB_expo
|
||||
double precision :: fact_AB, center_AB(3), pol_AB(0:max_dim,3)
|
||||
double precision :: cx, cy, cz
|
||||
|
||||
double precision :: overlap_gaussian_x
|
||||
|
||||
dim1 = 100
|
||||
|
||||
int_gauss_deriv = 0.d0
|
||||
|
||||
! ===============
|
||||
! term I:
|
||||
! \partial_x
|
||||
! ===============
|
||||
|
||||
if( power_B(1) .ge. 1 ) then
|
||||
|
||||
power_D(1) = power_B(1) - 1
|
||||
power_D(2) = power_B(2)
|
||||
power_D(3) = power_B(3)
|
||||
|
||||
call give_explicit_poly_and_gaussian( pol_AB, center_AB, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_D, A_center, B_center, dim1)
|
||||
power_C = 1
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + pol_AB(i,1) * overlap_gaussian_x( center_AB(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + pol_AB(i,2) * overlap_gaussian_x( center_AB(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + pol_AB(i,3) * overlap_gaussian_x( center_AB(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_deriv = int_gauss_deriv + fact_AB * dble(power_B(1)) * cx * cy * cz
|
||||
endif
|
||||
|
||||
! ===============
|
||||
|
||||
power_D(1) = power_B(1) + 1
|
||||
power_D(2) = power_B(2)
|
||||
power_D(3) = power_B(3)
|
||||
|
||||
call give_explicit_poly_and_gaussian( pol_AB, center_AB, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_D, A_center, B_center, dim1)
|
||||
power_C = 1
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + pol_AB(i,1) * overlap_gaussian_x( center_AB(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + pol_AB(i,2) * overlap_gaussian_x( center_AB(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + pol_AB(i,3) * overlap_gaussian_x( center_AB(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_deriv = int_gauss_deriv - 2.d0 * beta * fact_AB * cx * cy * cz
|
||||
|
||||
! ===============
|
||||
! ===============
|
||||
|
||||
|
||||
! ===============
|
||||
! term II:
|
||||
! \partial_y
|
||||
! ===============
|
||||
|
||||
if( power_B(2) .ge. 1 ) then
|
||||
|
||||
power_D(1) = power_B(1)
|
||||
power_D(2) = power_B(2) - 1
|
||||
power_D(3) = power_B(3)
|
||||
|
||||
call give_explicit_poly_and_gaussian( pol_AB, center_AB, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_D, A_center, B_center, dim1)
|
||||
power_C = 0
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + pol_AB(i,1) * overlap_gaussian_x( center_AB(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 1
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + pol_AB(i,2) * overlap_gaussian_x( center_AB(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + pol_AB(i,3) * overlap_gaussian_x( center_AB(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_deriv = int_gauss_deriv + fact_AB * dble(power_B(2)) * cx * cy * cz
|
||||
endif
|
||||
|
||||
! ===============
|
||||
|
||||
power_D(1) = power_B(1)
|
||||
power_D(2) = power_B(2) + 1
|
||||
power_D(3) = power_B(3)
|
||||
|
||||
call give_explicit_poly_and_gaussian( pol_AB, center_AB, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_D, A_center, B_center, dim1)
|
||||
power_C = 0
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + pol_AB(i,1) * overlap_gaussian_x( center_AB(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 1
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + pol_AB(i,2) * overlap_gaussian_x( center_AB(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + pol_AB(i,3) * overlap_gaussian_x( center_AB(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_deriv = int_gauss_deriv - 2.d0 * beta * fact_AB * cx * cy * cz
|
||||
|
||||
! ===============
|
||||
! ===============
|
||||
|
||||
! ===============
|
||||
! term III:
|
||||
! \partial_z
|
||||
! ===============
|
||||
|
||||
if( power_B(3) .ge. 1 ) then
|
||||
|
||||
power_D(1) = power_B(1)
|
||||
power_D(2) = power_B(2)
|
||||
power_D(3) = power_B(3) - 1
|
||||
|
||||
call give_explicit_poly_and_gaussian( pol_AB, center_AB, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_D, A_center, B_center, dim1)
|
||||
power_C = 0
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + pol_AB(i,1) * overlap_gaussian_x( center_AB(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + pol_AB(i,2) * overlap_gaussian_x( center_AB(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 1
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + pol_AB(i,3) * overlap_gaussian_x( center_AB(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_deriv = int_gauss_deriv + fact_AB * dble(power_B(3)) * cx * cy * cz
|
||||
endif
|
||||
|
||||
! ===============
|
||||
|
||||
power_D(1) = power_B(1)
|
||||
power_D(2) = power_B(2)
|
||||
power_D(3) = power_B(3) + 1
|
||||
|
||||
call give_explicit_poly_and_gaussian( pol_AB, center_AB, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_D, A_center, B_center, dim1)
|
||||
power_C = 0
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + pol_AB(i,1) * overlap_gaussian_x( center_AB(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + pol_AB(i,2) * overlap_gaussian_x( center_AB(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 1
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + pol_AB(i,3) * overlap_gaussian_x( center_AB(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_deriv = int_gauss_deriv - 2.d0 * beta * fact_AB * cx * cy * cz
|
||||
|
||||
! ===============
|
||||
! ===============
|
||||
|
||||
return
|
||||
end function int_gauss_deriv
|
||||
!_____________________________________________________________________________________________________________
|
||||
!_____________________________________________________________________________________________________________
|
||||
|
||||
|
335
src/ao_tc_eff_map/potential.irp.f
Normal file
335
src/ao_tc_eff_map/potential.irp.f
Normal file
@ -0,0 +1,335 @@
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [integer, n_gauss_eff_pot]
|
||||
|
||||
BEGIN_DOC
|
||||
! number of gaussians to represent the effective potential :
|
||||
!
|
||||
! V(mu,r12) = -0.25 * (1 - erf(mu*r12))^2 + 1/(\sqrt(pi)mu) * exp(-(mu*r12)^2)
|
||||
!
|
||||
! Here (1 - erf(mu*r12))^2 is expanded in Gaussians as Eqs A11-A20 in JCP 154, 084119 (2021)
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
n_gauss_eff_pot = ng_fit_jast + 1
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [integer, n_gauss_eff_pot_deriv]
|
||||
|
||||
BEGIN_DOC
|
||||
! V(r12) = -(1 - erf(mu*r12))^2 is expanded in Gaussians as Eqs A11-A20 in JCP 154, 084119 (2021)
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
n_gauss_eff_pot_deriv = ng_fit_jast
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, expo_gauss_eff_pot, (n_gauss_eff_pot)]
|
||||
&BEGIN_PROVIDER [double precision, coef_gauss_eff_pot, (n_gauss_eff_pot)]
|
||||
|
||||
BEGIN_DOC
|
||||
! Coefficients and exponents of the Fit on Gaussians of V(X) = -(1 - erf(mu*X))^2 + 1/(\sqrt(pi)mu) * exp(-(mu*X)^2)
|
||||
!
|
||||
! V(X) = \sum_{i=1,n_gauss_eff_pot} coef_gauss_eff_pot(i) * exp(-expo_gauss_eff_pot(i) * X^2)
|
||||
!
|
||||
! Relies on the fit proposed in Eqs A11-A20 in JCP 154, 084119 (2021)
|
||||
END_DOC
|
||||
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
integer :: i
|
||||
|
||||
! fit of the -0.25 * (1 - erf(mu*x))^2 with n_max_fit_slat gaussians
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_eff_pot(i) = expo_gauss_1_erf_x_2(i)
|
||||
coef_gauss_eff_pot(i) = -0.25d0 * coef_gauss_1_erf_x_2(i) ! -1/4 * (1 - erf(mu*x))^2
|
||||
enddo
|
||||
|
||||
! Analytical Gaussian part of the potential: + 1/(\sqrt(pi)mu) * exp(-(mu*x)^2)
|
||||
expo_gauss_eff_pot(ng_fit_jast+1) = mu_erf * mu_erf
|
||||
coef_gauss_eff_pot(ng_fit_jast+1) = 1.d0 * mu_erf * inv_sq_pi
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
double precision function eff_pot_gauss(x, mu)
|
||||
|
||||
BEGIN_DOC
|
||||
! V(mu,r12) = -0.25 * (1 - erf(mu*r12))^2 + 1/(\sqrt(pi)mu) * exp(-(mu*r12)^2)
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: x, mu
|
||||
|
||||
eff_pot_gauss = mu/dsqrt(dacos(-1.d0)) * dexp(-mu*mu*x*x) - 0.25d0 * (1.d0 - derf(mu*x))**2.d0
|
||||
|
||||
end
|
||||
|
||||
! -------------------------------------------------------------------------------------------------
|
||||
! ---
|
||||
|
||||
double precision function eff_pot_fit_gauss(x)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! V(mu,r12) = -0.25 * (1 - erf(mu*r12))^2 + 1/(\sqrt(pi)mu) * exp(-(mu*r12)^2)
|
||||
!
|
||||
! but fitted with gaussians
|
||||
END_DOC
|
||||
double precision, intent(in) :: x
|
||||
integer :: i
|
||||
double precision :: alpha
|
||||
eff_pot_fit_gauss = derf(mu_erf*x)/x
|
||||
do i = 1, n_gauss_eff_pot
|
||||
alpha = expo_gauss_eff_pot(i)
|
||||
eff_pot_fit_gauss += coef_gauss_eff_pot(i) * dexp(-alpha*x*x)
|
||||
enddo
|
||||
end
|
||||
|
||||
BEGIN_PROVIDER [integer, n_fit_1_erf_x]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
!
|
||||
END_DOC
|
||||
n_fit_1_erf_x = 2
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, expos_slat_gauss_1_erf_x, (n_fit_1_erf_x)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! 1 - erf(mu*x) is fitted with a Slater and gaussian as in Eq.A15 of JCP 154, 084119 (2021)
|
||||
!
|
||||
! 1 - erf(mu*x) = e^{-expos_slat_gauss_1_erf_x(1) * mu *x} * e^{-expos_slat_gauss_1_erf_x(2) * mu^2 * x^2}
|
||||
END_DOC
|
||||
expos_slat_gauss_1_erf_x(1) = 1.09529d0
|
||||
expos_slat_gauss_1_erf_x(2) = 0.756023d0
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, expo_gauss_1_erf_x, (n_max_fit_slat)]
|
||||
&BEGIN_PROVIDER [double precision, coef_gauss_1_erf_x, (n_max_fit_slat)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! (1 - erf(mu*x)) = \sum_i coef_gauss_1_erf_x(i) * exp(-expo_gauss_1_erf_x(i) * x^2)
|
||||
!
|
||||
! This is based on a fit of (1 - erf(mu*x)) by exp(-alpha * x) exp(-beta*mu^2x^2)
|
||||
!
|
||||
! and the slater function exp(-alpha * x) is fitted with n_max_fit_slat gaussians
|
||||
!
|
||||
! See Appendix 2 of JCP 154, 084119 (2021)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i
|
||||
double precision :: expos(n_max_fit_slat), alpha, beta
|
||||
|
||||
alpha = expos_slat_gauss_1_erf_x(1) * mu_erf
|
||||
call expo_fit_slater_gam(alpha, expos)
|
||||
beta = expos_slat_gauss_1_erf_x(2) * mu_erf * mu_erf
|
||||
|
||||
do i = 1, n_max_fit_slat
|
||||
expo_gauss_1_erf_x(i) = expos(i) + beta
|
||||
coef_gauss_1_erf_x(i) = coef_fit_slat_gauss(i)
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
double precision function fit_1_erf_x(x)
|
||||
|
||||
BEGIN_DOC
|
||||
! fit_1_erf_x(x) = \sum_i c_i exp (-alpha_i x^2) \approx (1 - erf(mu*x))
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i
|
||||
double precision, intent(in) :: x
|
||||
|
||||
fit_1_erf_x = 0.d0
|
||||
do i = 1, n_max_fit_slat
|
||||
fit_1_erf_x += dexp(-expo_gauss_1_erf_x(i) *x*x) * coef_gauss_1_erf_x(i)
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, expo_gauss_1_erf_x_2, (ng_fit_jast)]
|
||||
&BEGIN_PROVIDER [double precision, coef_gauss_1_erf_x_2, (ng_fit_jast)]
|
||||
|
||||
BEGIN_DOC
|
||||
! (1 - erf(mu*x))^2 = \sum_i coef_gauss_1_erf_x_2(i) * exp(-expo_gauss_1_erf_x_2(i) * x^2)
|
||||
!
|
||||
! This is based on a fit of (1 - erf(mu*x)) by exp(-alpha * x) exp(-beta*mu^2x^2)
|
||||
!
|
||||
! and the slater function exp(-alpha * x) is fitted with n_max_fit_slat gaussians
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i
|
||||
double precision :: expos(ng_fit_jast), alpha, beta, tmp
|
||||
|
||||
if(ng_fit_jast .eq. 1) then
|
||||
|
||||
coef_gauss_1_erf_x_2 = (/ 0.85345277d0 /)
|
||||
expo_gauss_1_erf_x_2 = (/ 6.23519457d0 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_1_erf_x_2(i) = tmp * expo_gauss_1_erf_x_2(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 2) then
|
||||
|
||||
coef_gauss_1_erf_x_2 = (/ 0.31030624d0 , 0.64364964d0 /)
|
||||
expo_gauss_1_erf_x_2 = (/ 55.39184787d0, 3.92151407d0 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_1_erf_x_2(i) = tmp * expo_gauss_1_erf_x_2(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 3) then
|
||||
|
||||
coef_gauss_1_erf_x_2 = (/ 0.33206082d0 , 0.52347449d0, 0.12605012d0 /)
|
||||
expo_gauss_1_erf_x_2 = (/ 19.90272209d0, 3.2671671d0 , 336.47320445d0 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_1_erf_x_2(i) = tmp * expo_gauss_1_erf_x_2(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 5) then
|
||||
|
||||
coef_gauss_1_erf_x_2 = (/ 0.02956716d0, 0.17025555d0, 0.32774114d0, 0.39034764d0, 0.07822781d0 /)
|
||||
expo_gauss_1_erf_x_2 = (/ 6467.28126d0, 46.9071990d0, 9.09617721d0, 2.76883328d0, 360.367093d0 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_1_erf_x_2(i) = tmp * expo_gauss_1_erf_x_2(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 6) then
|
||||
|
||||
coef_gauss_1_erf_x_2 = (/ 0.18331042d0 , 0.10971118d0 , 0.29949169d0 , 0.34853132d0 , 0.0394275d0 , 0.01874444d0 /)
|
||||
expo_gauss_1_erf_x_2 = (/ 2.54293498d+01, 1.40317872d+02, 7.14630801d+00, 2.65517675d+00, 1.45142619d+03, 1.00000000d+04 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_1_erf_x_2(i) = tmp * expo_gauss_1_erf_x_2(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 7) then
|
||||
|
||||
coef_gauss_1_erf_x_2 = (/ 0.0213619d0 , 0.03221511d0 , 0.29966689d0 , 0.19178934d0 , 0.06154732d0 , 0.28214555d0 , 0.11125985d0 /)
|
||||
expo_gauss_1_erf_x_2 = (/ 1.34727067d+04, 1.27166613d+03, 5.52584567d+00, 1.67753218d+01, 2.46145691d+02, 2.47971820d+00, 5.95141293d+01 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_1_erf_x_2(i) = tmp * expo_gauss_1_erf_x_2(i)
|
||||
enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 8) then
|
||||
|
||||
coef_gauss_1_erf_x_2 = (/ 0.28189124d0 , 0.19518669d0 , 0.12161735d0 , 0.24257438d0 , 0.07309656d0 , 0.042435d0 , 0.01926109d0 , 0.02393415d0 /)
|
||||
expo_gauss_1_erf_x_2 = (/ 4.69795903d+00, 1.21379451d+01, 3.55527053d+01, 2.39227172d+00, 1.14827721d+02, 4.16320213d+02, 1.52813587d+04, 1.78516557d+03 /)
|
||||
|
||||
tmp = mu_erf * mu_erf
|
||||
do i = 1, ng_fit_jast
|
||||
expo_gauss_1_erf_x_2(i) = tmp * expo_gauss_1_erf_x_2(i)
|
||||
enddo
|
||||
|
||||
!elseif(ng_fit_jast .eq. 9) then
|
||||
|
||||
! coef_gauss_1_erf_x_2 = (/ /)
|
||||
! expo_gauss_1_erf_x_2 = (/ /)
|
||||
|
||||
! tmp = mu_erf * mu_erf
|
||||
! do i = 1, ng_fit_jast
|
||||
! expo_gauss_1_erf_x_2(i) = tmp * expo_gauss_1_erf_x_2(i)
|
||||
! enddo
|
||||
|
||||
elseif(ng_fit_jast .eq. 20) then
|
||||
|
||||
ASSERT(n_max_fit_slat == 20)
|
||||
|
||||
alpha = 2.d0 * expos_slat_gauss_1_erf_x(1) * mu_erf
|
||||
call expo_fit_slater_gam(alpha, expos)
|
||||
beta = 2.d0 * expos_slat_gauss_1_erf_x(2) * mu_erf * mu_erf
|
||||
do i = 1, n_max_fit_slat
|
||||
expo_gauss_1_erf_x_2(i) = expos(i) + beta
|
||||
coef_gauss_1_erf_x_2(i) = coef_fit_slat_gauss(i)
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
print *, ' not implemented yet'
|
||||
stop
|
||||
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
double precision function fit_1_erf_x_2(x)
|
||||
implicit none
|
||||
double precision, intent(in) :: x
|
||||
BEGIN_DOC
|
||||
! fit_1_erf_x_2(x) = \sum_i c_i exp (-alpha_i x^2) \approx (1 - erf(mu*x))^2
|
||||
END_DOC
|
||||
integer :: i
|
||||
fit_1_erf_x_2 = 0.d0
|
||||
do i = 1, n_max_fit_slat
|
||||
fit_1_erf_x_2 += dexp(-expo_gauss_1_erf_x_2(i) *x*x) * coef_gauss_1_erf_x_2(i)
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
subroutine inv_r_times_poly(r, dist_r, dist_vec, poly)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! returns
|
||||
!
|
||||
! poly(1) = x / sqrt(x^2+y^2+z^2), poly(2) = y / sqrt(x^2+y^2+z^2), poly(3) = z / sqrt(x^2+y^2+z^2)
|
||||
!
|
||||
! with the arguments
|
||||
!
|
||||
! r(1) = x, r(2) = y, r(3) = z, dist_r = sqrt(x^2+y^2+z^2)
|
||||
!
|
||||
! dist_vec(1) = sqrt(y^2+z^2), dist_vec(2) = sqrt(x^2+z^2), dist_vec(3) = sqrt(x^2+y^2)
|
||||
END_DOC
|
||||
double precision, intent(in) :: r(3), dist_r, dist_vec(3)
|
||||
double precision, intent(out):: poly(3)
|
||||
double precision :: inv_dist
|
||||
integer :: i
|
||||
if (dist_r.gt. 1.d-8)then
|
||||
inv_dist = 1.d0/dist_r
|
||||
do i = 1, 3
|
||||
poly(i) = r(i) * inv_dist
|
||||
enddo
|
||||
else
|
||||
do i = 1, 3
|
||||
if(dabs(r(i)).lt.dist_vec(i))then
|
||||
inv_dist = 1.d0/dist_r
|
||||
poly(i) = r(i) * inv_dist
|
||||
else !if(dabs(r(i)))then
|
||||
poly(i) = 1.d0
|
||||
! poly(i) = 0.d0
|
||||
endif
|
||||
enddo
|
||||
endif
|
||||
end
|
86
src/ao_tc_eff_map/providers_ao_eff_pot.irp.f
Normal file
86
src/ao_tc_eff_map/providers_ao_eff_pot.irp.f
Normal file
@ -0,0 +1,86 @@
|
||||
|
||||
BEGIN_PROVIDER [ logical, ao_tc_sym_two_e_pot_in_map ]
|
||||
implicit none
|
||||
use f77_zmq
|
||||
use map_module
|
||||
BEGIN_DOC
|
||||
! Map of Atomic integrals
|
||||
! i(r1) j(r2) 1/r12 k(r1) l(r2)
|
||||
END_DOC
|
||||
|
||||
integer :: i,j,k,l
|
||||
double precision :: ao_tc_sym_two_e_pot,cpu_1,cpu_2, wall_1, wall_2
|
||||
double precision :: integral, wall_0
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
! For integrals file
|
||||
integer(key_kind),allocatable :: buffer_i(:)
|
||||
integer,parameter :: size_buffer = 1024*64
|
||||
real(integral_kind),allocatable :: buffer_value(:)
|
||||
|
||||
integer :: n_integrals, rc
|
||||
integer :: kk, m, j1, i1, lmax
|
||||
character*(64) :: fmt
|
||||
|
||||
!double precision :: j1b_gauss_coul_debug
|
||||
!integral = j1b_gauss_coul_debug(1,1,1,1)
|
||||
|
||||
integral = ao_tc_sym_two_e_pot(1,1,1,1)
|
||||
|
||||
double precision :: map_mb
|
||||
|
||||
print*, 'Providing the ao_tc_sym_two_e_pot_map integrals'
|
||||
call wall_time(wall_0)
|
||||
call wall_time(wall_1)
|
||||
call cpu_time(cpu_1)
|
||||
|
||||
integer(ZMQ_PTR) :: zmq_to_qp_run_socket, zmq_socket_pull
|
||||
call new_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,'ao_tc_sym_two_e_pot')
|
||||
|
||||
character(len=:), allocatable :: task
|
||||
allocate(character(len=ao_num*12) :: task)
|
||||
write(fmt,*) '(', ao_num, '(I5,X,I5,''|''))'
|
||||
do l=1,ao_num
|
||||
write(task,fmt) (i,l, i=1,l)
|
||||
integer, external :: add_task_to_taskserver
|
||||
if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task)) == -1) then
|
||||
stop 'Unable to add task to server'
|
||||
endif
|
||||
enddo
|
||||
deallocate(task)
|
||||
|
||||
integer, external :: zmq_set_running
|
||||
if (zmq_set_running(zmq_to_qp_run_socket) == -1) then
|
||||
print *, irp_here, ': Failed in zmq_set_running'
|
||||
endif
|
||||
|
||||
PROVIDE nproc
|
||||
!$OMP PARALLEL DEFAULT(shared) private(i) num_threads(nproc+1)
|
||||
i = omp_get_thread_num()
|
||||
if (i==0) then
|
||||
call ao_tc_sym_two_e_pot_in_map_collector(zmq_socket_pull)
|
||||
else
|
||||
call ao_tc_sym_two_e_pot_in_map_slave_inproc(i)
|
||||
endif
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call end_parallel_job(zmq_to_qp_run_socket, zmq_socket_pull, 'ao_tc_sym_two_e_pot')
|
||||
|
||||
|
||||
print*, 'Sorting the map'
|
||||
call map_sort(ao_tc_sym_two_e_pot_map)
|
||||
call cpu_time(cpu_2)
|
||||
call wall_time(wall_2)
|
||||
integer(map_size_kind) :: get_ao_tc_sym_two_e_pot_map_size, ao_eff_pot_map_size
|
||||
ao_eff_pot_map_size = get_ao_tc_sym_two_e_pot_map_size()
|
||||
|
||||
print*, 'AO eff_pot integrals provided:'
|
||||
print*, ' Size of AO eff_pot map : ', map_mb(ao_tc_sym_two_e_pot_map) ,'MB'
|
||||
print*, ' Number of AO eff_pot integrals :', ao_eff_pot_map_size
|
||||
print*, ' cpu time :',cpu_2 - cpu_1, 's'
|
||||
print*, ' wall time :',wall_2 - wall_1, 's ( x ', (cpu_2-cpu_1)/(wall_2-wall_1+tiny(1.d0)), ' )'
|
||||
|
||||
ao_tc_sym_two_e_pot_in_map = .True.
|
||||
|
||||
|
||||
END_PROVIDER
|
728
src/ao_tc_eff_map/two_e_1bgauss_j1.irp.f
Normal file
728
src/ao_tc_eff_map/two_e_1bgauss_j1.irp.f
Normal file
@ -0,0 +1,728 @@
|
||||
! ---
|
||||
|
||||
double precision function j1b_gauss_2e_j1(i, j, k, l)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! integral in the AO basis:
|
||||
! i(r1) j(r1) f(r12) k(r2) l(r2)
|
||||
!
|
||||
! with:
|
||||
! f(r12) = - [ (0.5 - 0.5 erf(mu r12)) / r12 ] (r1-r2) \cdot \sum_A (-2 a_A) [ r1A exp(-aA r1A^2) - r2A exp(-aA r2A^2) ]
|
||||
! = [ (1 - erf(mu r12) / r12 ] \sum_A a_A [ (r1-RA)^2 exp(-aA r1A^2)
|
||||
! + (r2-RA)^2 exp(-aA r2A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r1A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r2A^2) ]
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, k, l
|
||||
|
||||
integer :: p, q, r, s
|
||||
integer :: num_i, num_j, num_k, num_l, num_ii
|
||||
integer :: I_power(3), J_power(3), K_power(3), L_power(3)
|
||||
integer :: iorder_p(3), iorder_q(3)
|
||||
integer :: shift_P(3), shift_Q(3)
|
||||
integer :: dim1
|
||||
|
||||
double precision :: coef1, coef2, coef3, coef4
|
||||
double precision :: expo1, expo2, expo3, expo4
|
||||
double precision :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv
|
||||
double precision :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv
|
||||
double precision :: I_center(3), J_center(3), K_center(3), L_center(3)
|
||||
double precision :: ff, gg, cx, cy, cz
|
||||
|
||||
double precision :: j1b_gauss_2e_j1_schwartz
|
||||
|
||||
if( ao_prim_num(i) * ao_prim_num(j) * ao_prim_num(k) * ao_prim_num(l) > 1024 ) then
|
||||
j1b_gauss_2e_j1 = j1b_gauss_2e_j1_schwartz(i, j, k, l)
|
||||
return
|
||||
endif
|
||||
|
||||
num_i = ao_nucl(i)
|
||||
num_j = ao_nucl(j)
|
||||
num_k = ao_nucl(k)
|
||||
num_l = ao_nucl(l)
|
||||
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
I_center(p) = nucl_coord(num_i,p)
|
||||
J_center(p) = nucl_coord(num_j,p)
|
||||
K_center(p) = nucl_coord(num_k,p)
|
||||
L_center(p) = nucl_coord(num_l,p)
|
||||
enddo
|
||||
|
||||
j1b_gauss_2e_j1 = 0.d0
|
||||
|
||||
do p = 1, ao_prim_num(i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p, i)
|
||||
expo1 = ao_expo_ordered_transp(p, i)
|
||||
|
||||
do q = 1, ao_prim_num(j)
|
||||
coef2 = coef1 * ao_coef_normalized_ordered_transp(q, j)
|
||||
expo2 = ao_expo_ordered_transp(q, j)
|
||||
|
||||
call give_explicit_poly_and_gaussian( P1_new, P1_center, pp1, fact_p1, iorder_p, expo1, expo2 &
|
||||
, I_power, J_power, I_center, J_center, dim1 )
|
||||
p1_inv = 1.d0 / pp1
|
||||
|
||||
do r = 1, ao_prim_num(k)
|
||||
coef3 = coef2 * ao_coef_normalized_ordered_transp(r, k)
|
||||
expo3 = ao_expo_ordered_transp(r, k)
|
||||
|
||||
do s = 1, ao_prim_num(l)
|
||||
coef4 = coef3 * ao_coef_normalized_ordered_transp(s, l)
|
||||
expo4 = ao_expo_ordered_transp(s, l)
|
||||
|
||||
call give_explicit_poly_and_gaussian( Q1_new, Q1_center, qq1, fact_q1, iorder_q, expo3, expo4 &
|
||||
, K_power, L_power, K_center, L_center, dim1 )
|
||||
q1_inv = 1.d0 / qq1
|
||||
|
||||
call get_cxcycz_j1( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
j1b_gauss_2e_j1 = j1b_gauss_2e_j1 + coef4 * ( cx + cy + cz )
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
|
||||
return
|
||||
end function j1b_gauss_2e_j1
|
||||
|
||||
! ---
|
||||
|
||||
double precision function j1b_gauss_2e_j1_schwartz(i, j, k, l)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! integral in the AO basis:
|
||||
! i(r1) j(r1) f(r12) k(r2) l(r2)
|
||||
!
|
||||
! with:
|
||||
! f(r12) = - [ (0.5 - 0.5 erf(mu r12)) / r12 ] (r1-r2) \cdot \sum_A (-2 a_A) [ r1A exp(-aA r1A^2) - r2A exp(-aA r2A^2) ]
|
||||
! = [ (1 - erf(mu r12) / r12 ] \sum_A a_A [ (r1-RA)^2 exp(-aA r1A^2)
|
||||
! + (r2-RA)^2 exp(-aA r2A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r1A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r2A^2) ]
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, k, l
|
||||
|
||||
integer :: p, q, r, s
|
||||
integer :: num_i, num_j, num_k, num_l, num_ii
|
||||
integer :: I_power(3), J_power(3), K_power(3), L_power(3)
|
||||
integer :: iorder_p(3), iorder_q(3)
|
||||
integer :: dim1
|
||||
|
||||
double precision :: coef1, coef2, coef3, coef4
|
||||
double precision :: expo1, expo2, expo3, expo4
|
||||
double precision :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv
|
||||
double precision :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv
|
||||
double precision :: I_center(3), J_center(3), K_center(3), L_center(3)
|
||||
double precision :: cx, cy, cz
|
||||
double precision :: schwartz_ij, thr
|
||||
double precision, allocatable :: schwartz_kl(:,:)
|
||||
|
||||
PROVIDE j1b_pen
|
||||
|
||||
dim1 = n_pt_max_integrals
|
||||
thr = ao_integrals_threshold * ao_integrals_threshold
|
||||
|
||||
num_i = ao_nucl(i)
|
||||
num_j = ao_nucl(j)
|
||||
num_k = ao_nucl(k)
|
||||
num_l = ao_nucl(l)
|
||||
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
I_center(p) = nucl_coord(num_i,p)
|
||||
J_center(p) = nucl_coord(num_j,p)
|
||||
K_center(p) = nucl_coord(num_k,p)
|
||||
L_center(p) = nucl_coord(num_l,p)
|
||||
enddo
|
||||
|
||||
|
||||
allocate( schwartz_kl(0:ao_prim_num(l) , 0:ao_prim_num(k)) )
|
||||
|
||||
schwartz_kl(0,0) = 0.d0
|
||||
do r = 1, ao_prim_num(k)
|
||||
expo3 = ao_expo_ordered_transp(r,k)
|
||||
coef3 = ao_coef_normalized_ordered_transp(r,k) * ao_coef_normalized_ordered_transp(r,k)
|
||||
|
||||
schwartz_kl(0,r) = 0.d0
|
||||
do s = 1, ao_prim_num(l)
|
||||
expo4 = ao_expo_ordered_transp(s,l)
|
||||
coef4 = coef3 * ao_coef_normalized_ordered_transp(s,l) * ao_coef_normalized_ordered_transp(s,l)
|
||||
|
||||
call give_explicit_poly_and_gaussian( Q1_new, Q1_center, qq1, fact_q1, iorder_q, expo3, expo4 &
|
||||
, K_power, L_power, K_center, L_center, dim1 )
|
||||
q1_inv = 1.d0 / qq1
|
||||
|
||||
call get_cxcycz_j1( dim1, cx, cy, cz &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
schwartz_kl(s,r) = coef4 * dabs( cx + cy + cz )
|
||||
schwartz_kl(0,r) = max( schwartz_kl(0,r) , schwartz_kl(s,r) )
|
||||
enddo
|
||||
|
||||
schwartz_kl(0,0) = max( schwartz_kl(0,r) , schwartz_kl(0,0) )
|
||||
enddo
|
||||
|
||||
|
||||
j1b_gauss_2e_j1_schwartz = 0.d0
|
||||
|
||||
do p = 1, ao_prim_num(i)
|
||||
expo1 = ao_expo_ordered_transp(p, i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p, i)
|
||||
|
||||
do q = 1, ao_prim_num(j)
|
||||
expo2 = ao_expo_ordered_transp(q, j)
|
||||
coef2 = coef1 * ao_coef_normalized_ordered_transp(q, j)
|
||||
|
||||
call give_explicit_poly_and_gaussian( P1_new, P1_center, pp1, fact_p1, iorder_p, expo1, expo2 &
|
||||
, I_power, J_power, I_center, J_center, dim1 )
|
||||
p1_inv = 1.d0 / pp1
|
||||
|
||||
call get_cxcycz_j1( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p )
|
||||
|
||||
schwartz_ij = coef2 * coef2 * dabs( cx + cy + cz )
|
||||
if( schwartz_kl(0,0) * schwartz_ij < thr ) cycle
|
||||
|
||||
do r = 1, ao_prim_num(k)
|
||||
if( schwartz_kl(0,r) * schwartz_ij < thr ) cycle
|
||||
coef3 = coef2 * ao_coef_normalized_ordered_transp(r, k)
|
||||
expo3 = ao_expo_ordered_transp(r, k)
|
||||
|
||||
do s = 1, ao_prim_num(l)
|
||||
if( schwartz_kl(s,r) * schwartz_ij < thr ) cycle
|
||||
coef4 = coef3 * ao_coef_normalized_ordered_transp(s, l)
|
||||
expo4 = ao_expo_ordered_transp(s, l)
|
||||
|
||||
call give_explicit_poly_and_gaussian( Q1_new, Q1_center, qq1, fact_q1, iorder_q, expo3, expo4 &
|
||||
, K_power, L_power, K_center, L_center, dim1 )
|
||||
q1_inv = 1.d0 / qq1
|
||||
|
||||
call get_cxcycz_j1( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
j1b_gauss_2e_j1_schwartz = j1b_gauss_2e_j1_schwartz + coef4 * ( cx + cy + cz )
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
|
||||
deallocate( schwartz_kl )
|
||||
|
||||
return
|
||||
end function j1b_gauss_2e_j1_schwartz
|
||||
|
||||
! ---
|
||||
|
||||
subroutine get_cxcycz_j1( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: dim1
|
||||
integer, intent(in) :: iorder_p(3), iorder_q(3)
|
||||
double precision, intent(in) :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv
|
||||
double precision, intent(in) :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv
|
||||
double precision, intent(out) :: cx, cy, cz
|
||||
|
||||
integer :: ii
|
||||
integer :: shift_P(3), shift_Q(3)
|
||||
double precision :: expoii, factii, Centerii(3)
|
||||
double precision :: P2_new(0:max_dim,3), P2_center(3), fact_p2, pp2, p2_inv
|
||||
double precision :: Q2_new(0:max_dim,3), Q2_center(3), fact_q2, qq2, q2_inv
|
||||
double precision :: ff, gg
|
||||
|
||||
double precision :: general_primitive_integral_erf_shifted
|
||||
double precision :: general_primitive_integral_coul_shifted
|
||||
|
||||
PROVIDE j1b_pen
|
||||
|
||||
cx = 0.d0
|
||||
cy = 0.d0
|
||||
cz = 0.d0
|
||||
do ii = 1, nucl_num
|
||||
|
||||
expoii = j1b_pen(ii)
|
||||
Centerii(1:3) = nucl_coord(ii, 1:3)
|
||||
|
||||
call gaussian_product(pp1, P1_center, expoii, Centerii, factii, pp2, P2_center)
|
||||
fact_p2 = fact_p1 * factii
|
||||
p2_inv = 1.d0 / pp2
|
||||
call pol_modif_center( P1_center, P2_center, iorder_p, P1_new, P2_new )
|
||||
|
||||
call gaussian_product(qq1, Q1_center, expoii, Centerii, factii, qq2, Q2_center)
|
||||
fact_q2 = fact_q1 * factii
|
||||
q2_inv = 1.d0 / qq2
|
||||
call pol_modif_center( Q1_center, Q2_center, iorder_q, Q1_new, Q2_new )
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! [ (1-erf(mu r12)) / r12 ] \sum_A a_A [ (r1-RA)^2 exp(-aA r1A^2)
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
|
||||
! x term:
|
||||
ff = P2_center(1) - Centerii(1)
|
||||
|
||||
shift_P = (/ 2, 0, 0 /)
|
||||
cx = cx + expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 1, 0, 0 /)
|
||||
cx = cx + expoii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
cx = cx + expoii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = P2_center(2) - Centerii(2)
|
||||
|
||||
shift_P = (/ 0, 2, 0 /)
|
||||
cy = cy + expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 1, 0 /)
|
||||
cy = cy + expoii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
cy = cy + expoii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = P2_center(3) - Centerii(3)
|
||||
|
||||
shift_P = (/ 0, 0, 2 /)
|
||||
cz = cz + expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 1 /)
|
||||
cz = cz + expoii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
cz = cz + expoii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! [ (1-erf(mu r12)) / r12 ] \sum_A a_A [ (r2-RA)^2 exp(-aA r2A^2)
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
|
||||
! x term:
|
||||
ff = Q2_center(1) - Centerii(1)
|
||||
|
||||
shift_Q = (/ 2, 0, 0 /)
|
||||
cx = cx + expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx + expoii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx + expoii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = Q2_center(2) - Centerii(2)
|
||||
|
||||
shift_Q = (/ 0, 2, 0 /)
|
||||
cy = cy + expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy + expoii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy + expoii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = Q2_center(3) - Centerii(3)
|
||||
|
||||
shift_Q = (/ 0, 0, 2 /)
|
||||
cz = cz + expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz + expoii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz + expoii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! - [ (1-erf(mu r12)) / r12 ] \sum_A a_A [ (r1-RA) \cdot (r2-RA) exp(-aA r1A^2) ]
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
! x term:
|
||||
ff = P2_center(1) - Centerii(1)
|
||||
gg = Q1_center(1) - Centerii(1)
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = P2_center(2) - Centerii(2)
|
||||
gg = Q1_center(2) - Centerii(2)
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = P2_center(3) - Centerii(3)
|
||||
gg = Q1_center(3) - Centerii(3)
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! - [ (1-erf(mu r12)) / r12 ] \sum_A a_A [ (r1-RA) \cdot (r2-RA) exp(-aA r2A^2) ]
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
! x term:
|
||||
ff = P1_center(1) - Centerii(1)
|
||||
gg = Q2_center(1) - Centerii(1)
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = P1_center(2) - Centerii(2)
|
||||
gg = Q2_center(2) - Centerii(2)
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = P1_center(3) - Centerii(3)
|
||||
gg = Q2_center(3) - Centerii(3)
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine get_cxcycz_j1
|
||||
|
||||
! ---
|
||||
|
729
src/ao_tc_eff_map/two_e_1bgauss_j2.irp.f
Normal file
729
src/ao_tc_eff_map/two_e_1bgauss_j2.irp.f
Normal file
@ -0,0 +1,729 @@
|
||||
! ---
|
||||
|
||||
double precision function j1b_gauss_2e_j2(i, j, k, l)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! integral in the AO basis:
|
||||
! i(r1) j(r1) f(r12) k(r2) l(r2)
|
||||
!
|
||||
! with:
|
||||
! f(r12) = - [ (0.5 - 0.5 erf(mu r12)) / r12 ] (r1-r2) \cdot \sum_A (-2 a_A c_A) [ r1A exp(-aA r1A^2) - r2A exp(-aA r2A^2) ]
|
||||
! = [ (1 - erf(mu r12) / r12 ] \sum_A a_A c_A [ (r1-RA)^2 exp(-aA r1A^2)
|
||||
! + (r2-RA)^2 exp(-aA r2A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r1A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r2A^2) ]
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, k, l
|
||||
|
||||
integer :: p, q, r, s
|
||||
integer :: num_i, num_j, num_k, num_l, num_ii
|
||||
integer :: I_power(3), J_power(3), K_power(3), L_power(3)
|
||||
integer :: iorder_p(3), iorder_q(3)
|
||||
integer :: shift_P(3), shift_Q(3)
|
||||
integer :: dim1
|
||||
|
||||
double precision :: coef1, coef2, coef3, coef4
|
||||
double precision :: expo1, expo2, expo3, expo4
|
||||
double precision :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv
|
||||
double precision :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv
|
||||
double precision :: I_center(3), J_center(3), K_center(3), L_center(3)
|
||||
double precision :: ff, gg, cx, cy, cz
|
||||
|
||||
double precision :: j1b_gauss_2e_j2_schwartz
|
||||
|
||||
dim1 = n_pt_max_integrals
|
||||
|
||||
if( ao_prim_num(i) * ao_prim_num(j) * ao_prim_num(k) * ao_prim_num(l) > 1024 ) then
|
||||
j1b_gauss_2e_j2 = j1b_gauss_2e_j2_schwartz(i, j, k, l)
|
||||
return
|
||||
endif
|
||||
|
||||
num_i = ao_nucl(i)
|
||||
num_j = ao_nucl(j)
|
||||
num_k = ao_nucl(k)
|
||||
num_l = ao_nucl(l)
|
||||
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
I_center(p) = nucl_coord(num_i,p)
|
||||
J_center(p) = nucl_coord(num_j,p)
|
||||
K_center(p) = nucl_coord(num_k,p)
|
||||
L_center(p) = nucl_coord(num_l,p)
|
||||
enddo
|
||||
|
||||
j1b_gauss_2e_j2 = 0.d0
|
||||
|
||||
do p = 1, ao_prim_num(i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p, i)
|
||||
expo1 = ao_expo_ordered_transp(p, i)
|
||||
|
||||
do q = 1, ao_prim_num(j)
|
||||
coef2 = coef1 * ao_coef_normalized_ordered_transp(q, j)
|
||||
expo2 = ao_expo_ordered_transp(q, j)
|
||||
|
||||
call give_explicit_poly_and_gaussian( P1_new, P1_center, pp1, fact_p1, iorder_p, expo1, expo2 &
|
||||
, I_power, J_power, I_center, J_center, dim1 )
|
||||
p1_inv = 1.d0 / pp1
|
||||
|
||||
do r = 1, ao_prim_num(k)
|
||||
coef3 = coef2 * ao_coef_normalized_ordered_transp(r, k)
|
||||
expo3 = ao_expo_ordered_transp(r, k)
|
||||
|
||||
do s = 1, ao_prim_num(l)
|
||||
coef4 = coef3 * ao_coef_normalized_ordered_transp(s, l)
|
||||
expo4 = ao_expo_ordered_transp(s, l)
|
||||
|
||||
call give_explicit_poly_and_gaussian( Q1_new, Q1_center, qq1, fact_q1, iorder_q, expo3, expo4 &
|
||||
, K_power, L_power, K_center, L_center, dim1 )
|
||||
q1_inv = 1.d0 / qq1
|
||||
|
||||
call get_cxcycz_j2( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
j1b_gauss_2e_j2 = j1b_gauss_2e_j2 + coef4 * ( cx + cy + cz )
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
|
||||
return
|
||||
end function j1b_gauss_2e_j2
|
||||
|
||||
! ---
|
||||
|
||||
double precision function j1b_gauss_2e_j2_schwartz(i, j, k, l)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! integral in the AO basis:
|
||||
! i(r1) j(r1) f(r12) k(r2) l(r2)
|
||||
!
|
||||
! with:
|
||||
! f(r12) = - [ (0.5 - 0.5 erf(mu r12)) / r12 ] (r1-r2) \cdot \sum_A (-2 a_A c_A) [ r1A exp(-aA r1A^2) - r2A exp(-aA r2A^2) ]
|
||||
! = [ (1 - erf(mu r12) / r12 ] \sum_A a_A c_A [ (r1-RA)^2 exp(-aA r1A^2)
|
||||
! + (r2-RA)^2 exp(-aA r2A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r1A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r2A^2) ]
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, k, l
|
||||
|
||||
integer :: p, q, r, s
|
||||
integer :: num_i, num_j, num_k, num_l, num_ii
|
||||
integer :: I_power(3), J_power(3), K_power(3), L_power(3)
|
||||
integer :: iorder_p(3), iorder_q(3)
|
||||
integer :: dim1
|
||||
|
||||
double precision :: coef1, coef2, coef3, coef4
|
||||
double precision :: expo1, expo2, expo3, expo4
|
||||
double precision :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv
|
||||
double precision :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv
|
||||
double precision :: I_center(3), J_center(3), K_center(3), L_center(3)
|
||||
double precision :: cx, cy, cz
|
||||
double precision :: schwartz_ij, thr
|
||||
double precision, allocatable :: schwartz_kl(:,:)
|
||||
|
||||
dim1 = n_pt_max_integrals
|
||||
thr = ao_integrals_threshold * ao_integrals_threshold
|
||||
|
||||
num_i = ao_nucl(i)
|
||||
num_j = ao_nucl(j)
|
||||
num_k = ao_nucl(k)
|
||||
num_l = ao_nucl(l)
|
||||
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
I_center(p) = nucl_coord(num_i,p)
|
||||
J_center(p) = nucl_coord(num_j,p)
|
||||
K_center(p) = nucl_coord(num_k,p)
|
||||
L_center(p) = nucl_coord(num_l,p)
|
||||
enddo
|
||||
|
||||
|
||||
allocate( schwartz_kl(0:ao_prim_num(l) , 0:ao_prim_num(k)) )
|
||||
|
||||
schwartz_kl(0,0) = 0.d0
|
||||
do r = 1, ao_prim_num(k)
|
||||
expo3 = ao_expo_ordered_transp(r,k)
|
||||
coef3 = ao_coef_normalized_ordered_transp(r,k) * ao_coef_normalized_ordered_transp(r,k)
|
||||
|
||||
schwartz_kl(0,r) = 0.d0
|
||||
do s = 1, ao_prim_num(l)
|
||||
expo4 = ao_expo_ordered_transp(s,l)
|
||||
coef4 = coef3 * ao_coef_normalized_ordered_transp(s,l) * ao_coef_normalized_ordered_transp(s,l)
|
||||
|
||||
call give_explicit_poly_and_gaussian( Q1_new, Q1_center, qq1, fact_q1, iorder_q, expo3, expo4 &
|
||||
, K_power, L_power, K_center, L_center, dim1 )
|
||||
q1_inv = 1.d0 / qq1
|
||||
|
||||
call get_cxcycz_j2( dim1, cx, cy, cz &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
schwartz_kl(s,r) = coef4 * dabs( cx + cy + cz )
|
||||
schwartz_kl(0,r) = max( schwartz_kl(0,r) , schwartz_kl(s,r) )
|
||||
enddo
|
||||
|
||||
schwartz_kl(0,0) = max( schwartz_kl(0,r) , schwartz_kl(0,0) )
|
||||
enddo
|
||||
|
||||
|
||||
j1b_gauss_2e_j2_schwartz = 0.d0
|
||||
|
||||
do p = 1, ao_prim_num(i)
|
||||
expo1 = ao_expo_ordered_transp(p, i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p, i)
|
||||
|
||||
do q = 1, ao_prim_num(j)
|
||||
expo2 = ao_expo_ordered_transp(q, j)
|
||||
coef2 = coef1 * ao_coef_normalized_ordered_transp(q, j)
|
||||
|
||||
call give_explicit_poly_and_gaussian( P1_new, P1_center, pp1, fact_p1, iorder_p, expo1, expo2 &
|
||||
, I_power, J_power, I_center, J_center, dim1 )
|
||||
p1_inv = 1.d0 / pp1
|
||||
|
||||
call get_cxcycz_j2( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p )
|
||||
|
||||
schwartz_ij = coef2 * coef2 * dabs( cx + cy + cz )
|
||||
if( schwartz_kl(0,0) * schwartz_ij < thr ) cycle
|
||||
|
||||
do r = 1, ao_prim_num(k)
|
||||
if( schwartz_kl(0,r) * schwartz_ij < thr ) cycle
|
||||
coef3 = coef2 * ao_coef_normalized_ordered_transp(r, k)
|
||||
expo3 = ao_expo_ordered_transp(r, k)
|
||||
|
||||
do s = 1, ao_prim_num(l)
|
||||
if( schwartz_kl(s,r) * schwartz_ij < thr ) cycle
|
||||
coef4 = coef3 * ao_coef_normalized_ordered_transp(s, l)
|
||||
expo4 = ao_expo_ordered_transp(s, l)
|
||||
|
||||
call give_explicit_poly_and_gaussian( Q1_new, Q1_center, qq1, fact_q1, iorder_q, expo3, expo4 &
|
||||
, K_power, L_power, K_center, L_center, dim1 )
|
||||
q1_inv = 1.d0 / qq1
|
||||
|
||||
call get_cxcycz_j2( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
j1b_gauss_2e_j2_schwartz = j1b_gauss_2e_j2_schwartz + coef4 * ( cx + cy + cz )
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
|
||||
deallocate( schwartz_kl )
|
||||
|
||||
return
|
||||
end function j1b_gauss_2e_j2_schwartz
|
||||
|
||||
! ---
|
||||
|
||||
subroutine get_cxcycz_j2( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: dim1
|
||||
integer, intent(in) :: iorder_p(3), iorder_q(3)
|
||||
double precision, intent(in) :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv
|
||||
double precision, intent(in) :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv
|
||||
double precision, intent(out) :: cx, cy, cz
|
||||
|
||||
integer :: ii
|
||||
integer :: shift_P(3), shift_Q(3)
|
||||
double precision :: coefii, expoii, factii, Centerii(3)
|
||||
double precision :: P2_new(0:max_dim,3), P2_center(3), fact_p2, pp2, p2_inv
|
||||
double precision :: Q2_new(0:max_dim,3), Q2_center(3), fact_q2, qq2, q2_inv
|
||||
double precision :: ff, gg
|
||||
|
||||
double precision :: general_primitive_integral_erf_shifted
|
||||
double precision :: general_primitive_integral_coul_shifted
|
||||
|
||||
PROVIDE j1b_pen j1b_coeff
|
||||
|
||||
cx = 0.d0
|
||||
cy = 0.d0
|
||||
cz = 0.d0
|
||||
do ii = 1, nucl_num
|
||||
|
||||
expoii = j1b_pen (ii)
|
||||
coefii = j1b_coeff(ii)
|
||||
Centerii(1:3) = nucl_coord(ii, 1:3)
|
||||
|
||||
call gaussian_product(pp1, P1_center, expoii, Centerii, factii, pp2, P2_center)
|
||||
fact_p2 = fact_p1 * factii
|
||||
p2_inv = 1.d0 / pp2
|
||||
call pol_modif_center( P1_center, P2_center, iorder_p, P1_new, P2_new )
|
||||
|
||||
call gaussian_product(qq1, Q1_center, expoii, Centerii, factii, qq2, Q2_center)
|
||||
fact_q2 = fact_q1 * factii
|
||||
q2_inv = 1.d0 / qq2
|
||||
call pol_modif_center( Q1_center, Q2_center, iorder_q, Q1_new, Q2_new )
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! [ (1-erf(mu r12)) / r12 ] \sum_A a_A c_A [ (r1-RA)^2 exp(-aA r1A^2)
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
|
||||
! x term:
|
||||
ff = P2_center(1) - Centerii(1)
|
||||
|
||||
shift_P = (/ 2, 0, 0 /)
|
||||
cx = cx + expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 1, 0, 0 /)
|
||||
cx = cx + expoii * coefii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * coefii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
cx = cx + expoii * coefii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * coefii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = P2_center(2) - Centerii(2)
|
||||
|
||||
shift_P = (/ 0, 2, 0 /)
|
||||
cy = cy + expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 1, 0 /)
|
||||
cy = cy + expoii * coefii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * coefii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
cy = cy + expoii * coefii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * coefii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = P2_center(3) - Centerii(3)
|
||||
|
||||
shift_P = (/ 0, 0, 2 /)
|
||||
cz = cz + expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 1 /)
|
||||
cz = cz + expoii * coefii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * coefii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
cz = cz + expoii * coefii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * coefii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! [ (1-erf(mu r12)) / r12 ] \sum_A a_A c_A [ (r2-RA)^2 exp(-aA r2A^2)
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
|
||||
! x term:
|
||||
ff = Q2_center(1) - Centerii(1)
|
||||
|
||||
shift_Q = (/ 2, 0, 0 /)
|
||||
cx = cx + expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx + expoii * coefii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * coefii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx + expoii * coefii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * coefii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = Q2_center(2) - Centerii(2)
|
||||
|
||||
shift_Q = (/ 0, 2, 0 /)
|
||||
cy = cy + expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy + expoii * coefii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * coefii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy + expoii * coefii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * coefii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = Q2_center(3) - Centerii(3)
|
||||
|
||||
shift_Q = (/ 0, 0, 2 /)
|
||||
cz = cz + expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz + expoii * coefii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * coefii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz + expoii * coefii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * coefii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! - [ (1-erf(mu r12)) / r12 ] \sum_A a_A c_A [ (r1-RA) \cdot (r2-RA) exp(-aA r1A^2) ]
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
! x term:
|
||||
ff = P2_center(1) - Centerii(1)
|
||||
gg = Q1_center(1) - Centerii(1)
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * coefii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * coefii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * coefii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = P2_center(2) - Centerii(2)
|
||||
gg = Q1_center(2) - Centerii(2)
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * coefii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * coefii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * coefii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = P2_center(3) - Centerii(3)
|
||||
gg = Q1_center(3) - Centerii(3)
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * coefii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * coefii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * coefii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! - [ (1-erf(mu r12)) / r12 ] \sum_A a_A c_A [ (r1-RA) \cdot (r2-RA) exp(-aA r2A^2) ]
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
! x term:
|
||||
ff = P1_center(1) - Centerii(1)
|
||||
gg = Q2_center(1) - Centerii(1)
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * coefii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * coefii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * coefii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = P1_center(2) - Centerii(2)
|
||||
gg = Q2_center(2) - Centerii(2)
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * coefii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * coefii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * coefii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = P1_center(3) - Centerii(3)
|
||||
gg = Q2_center(3) - Centerii(3)
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * coefii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * coefii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * coefii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine get_cxcycz_j2
|
||||
|
||||
! ---
|
||||
|
327
src/ao_tc_eff_map/two_e_ints_gauss.irp.f
Normal file
327
src/ao_tc_eff_map/two_e_ints_gauss.irp.f
Normal file
@ -0,0 +1,327 @@
|
||||
double precision function ao_tc_sym_two_e_pot(i,j,k,l)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! integral of the AO basis <ik|jl> or (ij|kl)
|
||||
! i(r1) j(r1) (tc_pot(r12,mu)) k(r2) l(r2)
|
||||
!
|
||||
! where (tc_pot(r12,mu)) is the scalar part of the potential EXCLUDING the term erf(mu r12)/r12.
|
||||
!
|
||||
! See Eq. (32) of JCP 154, 084119 (2021).
|
||||
END_DOC
|
||||
integer,intent(in) :: i,j,k,l
|
||||
integer :: p,q,r,s
|
||||
double precision :: I_center(3),J_center(3),K_center(3),L_center(3)
|
||||
integer :: num_i,num_j,num_k,num_l,dim1,I_power(3),J_power(3),K_power(3),L_power(3)
|
||||
double precision :: integral
|
||||
include 'utils/constants.include.F'
|
||||
double precision :: P_new(0:max_dim,3),P_center(3),fact_p,pp
|
||||
double precision :: Q_new(0:max_dim,3),Q_center(3),fact_q,qq
|
||||
integer :: iorder_p(3), iorder_q(3)
|
||||
double precision, allocatable :: schwartz_kl(:,:)
|
||||
double precision :: schwartz_ij
|
||||
double precision :: scw_gauss_int,general_primitive_integral_gauss
|
||||
|
||||
dim1 = n_pt_max_integrals
|
||||
|
||||
num_i = ao_nucl(i)
|
||||
num_j = ao_nucl(j)
|
||||
num_k = ao_nucl(k)
|
||||
num_l = ao_nucl(l)
|
||||
ao_tc_sym_two_e_pot = 0.d0
|
||||
double precision :: thr
|
||||
thr = ao_integrals_threshold*ao_integrals_threshold
|
||||
|
||||
allocate(schwartz_kl(0:ao_prim_num(l),0:ao_prim_num(k)))
|
||||
|
||||
double precision :: coef3
|
||||
double precision :: coef2
|
||||
double precision :: p_inv,q_inv
|
||||
double precision :: coef1
|
||||
double precision :: coef4
|
||||
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
I_center(p) = nucl_coord(num_i,p)
|
||||
J_center(p) = nucl_coord(num_j,p)
|
||||
K_center(p) = nucl_coord(num_k,p)
|
||||
L_center(p) = nucl_coord(num_l,p)
|
||||
enddo
|
||||
|
||||
schwartz_kl(0,0) = 0.d0
|
||||
do r = 1, ao_prim_num(k)
|
||||
coef1 = ao_coef_normalized_ordered_transp(r,k)*ao_coef_normalized_ordered_transp(r,k)
|
||||
schwartz_kl(0,r) = 0.d0
|
||||
do s = 1, ao_prim_num(l)
|
||||
coef2 = coef1 * ao_coef_normalized_ordered_transp(s,l) * ao_coef_normalized_ordered_transp(s,l)
|
||||
call give_explicit_poly_and_gaussian(Q_new,Q_center,qq,fact_q,iorder_q,&
|
||||
ao_expo_ordered_transp(r,k),ao_expo_ordered_transp(s,l), &
|
||||
K_power,L_power,K_center,L_center,dim1)
|
||||
q_inv = 1.d0/qq
|
||||
scw_gauss_int = general_primitive_integral_gauss(dim1, &
|
||||
Q_new,Q_center,fact_q,qq,q_inv,iorder_q, &
|
||||
Q_new,Q_center,fact_q,qq,q_inv,iorder_q)
|
||||
|
||||
schwartz_kl(s,r) = dabs(scw_gauss_int * coef2)
|
||||
schwartz_kl(0,r) = max(schwartz_kl(0,r),schwartz_kl(s,r))
|
||||
enddo
|
||||
schwartz_kl(0,0) = max(schwartz_kl(0,r),schwartz_kl(0,0))
|
||||
enddo
|
||||
do p = 1, ao_prim_num(i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p,i)
|
||||
do q = 1, ao_prim_num(j)
|
||||
coef2 = coef1*ao_coef_normalized_ordered_transp(q,j)
|
||||
call give_explicit_poly_and_gaussian(P_new,P_center,pp,fact_p,iorder_p,&
|
||||
ao_expo_ordered_transp(p,i),ao_expo_ordered_transp(q,j), &
|
||||
I_power,J_power,I_center,J_center,dim1)
|
||||
p_inv = 1.d0/pp
|
||||
scw_gauss_int = general_primitive_integral_gauss(dim1, &
|
||||
P_new,P_center,fact_p,pp,p_inv,iorder_p, &
|
||||
P_new,P_center,fact_p,pp,p_inv,iorder_p)
|
||||
schwartz_ij = dabs(scw_gauss_int * coef2*coef2)
|
||||
if (schwartz_kl(0,0)*schwartz_ij < thr) then
|
||||
cycle
|
||||
endif
|
||||
do r = 1, ao_prim_num(k)
|
||||
if (schwartz_kl(0,r)*schwartz_ij < thr) then
|
||||
cycle
|
||||
endif
|
||||
coef3 = coef2*ao_coef_normalized_ordered_transp(r,k)
|
||||
do s = 1, ao_prim_num(l)
|
||||
if (schwartz_kl(s,r)*schwartz_ij < thr) then
|
||||
cycle
|
||||
endif
|
||||
coef4 = coef3*ao_coef_normalized_ordered_transp(s,l)
|
||||
call give_explicit_poly_and_gaussian(Q_new,Q_center,qq,fact_q,iorder_q, &
|
||||
ao_expo_ordered_transp(r,k),ao_expo_ordered_transp(s,l), &
|
||||
K_power,L_power,K_center,L_center,dim1)
|
||||
q_inv = 1.d0/qq
|
||||
integral = general_primitive_integral_gauss(dim1, &
|
||||
P_new,P_center,fact_p,pp,p_inv,iorder_p, &
|
||||
Q_new,Q_center,fact_q,qq,q_inv,iorder_q)
|
||||
ao_tc_sym_two_e_pot = ao_tc_sym_two_e_pot + coef4 * integral
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
|
||||
deallocate (schwartz_kl)
|
||||
|
||||
end
|
||||
|
||||
|
||||
double precision function general_primitive_integral_gauss(dim, &
|
||||
P_new,P_center,fact_p,p,p_inv,iorder_p, &
|
||||
Q_new,Q_center,fact_q,q,q_inv,iorder_q)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Computes the integral <pq|rs> where p,q,r,s are Gaussian primitives
|
||||
END_DOC
|
||||
integer,intent(in) :: dim
|
||||
include 'utils/constants.include.F'
|
||||
double precision, intent(in) :: P_new(0:max_dim,3),P_center(3),fact_p,p,p_inv
|
||||
double precision, intent(in) :: Q_new(0:max_dim,3),Q_center(3),fact_q,q,q_inv
|
||||
integer, intent(in) :: iorder_p(3)
|
||||
integer, intent(in) :: iorder_q(3)
|
||||
|
||||
double precision :: r_cut,gama_r_cut,rho,dist
|
||||
double precision :: dx(0:max_dim),Ix_pol(0:max_dim),dy(0:max_dim),Iy_pol(0:max_dim),dz(0:max_dim),Iz_pol(0:max_dim)
|
||||
integer :: n_Ix,n_Iy,n_Iz,nx,ny,nz
|
||||
double precision :: bla
|
||||
integer :: ix,iy,iz,jx,jy,jz,i
|
||||
double precision :: a,b,c,d,e,f,accu,pq,const
|
||||
double precision :: pq_inv, p10_1, p10_2, p01_1, p01_2,pq_inv_2
|
||||
integer :: n_pt_tmp,n_pt_out, iorder
|
||||
double precision :: d1(0:max_dim),d_poly(0:max_dim),rint,d1_screened(0:max_dim)
|
||||
double precision :: thr
|
||||
|
||||
thr = ao_integrals_threshold
|
||||
|
||||
general_primitive_integral_gauss = 0.d0
|
||||
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: dx,Ix_pol,dy,Iy_pol,dz,Iz_pol
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: d1, d_poly
|
||||
|
||||
! Gaussian Product
|
||||
! ----------------
|
||||
|
||||
pq = p_inv*0.5d0*q_inv
|
||||
pq_inv = 0.5d0/(p+q)
|
||||
p10_1 = q*pq ! 1/(2p)
|
||||
p01_1 = p*pq ! 1/(2q)
|
||||
pq_inv_2 = pq_inv+pq_inv
|
||||
p10_2 = pq_inv_2 * p10_1*q !0.5d0*q/(pq + p*p)
|
||||
p01_2 = pq_inv_2 * p01_1*p !0.5d0*p/(q*q + pq)
|
||||
|
||||
|
||||
accu = 0.d0
|
||||
iorder = iorder_p(1)+iorder_q(1)+iorder_p(1)+iorder_q(1)
|
||||
do ix=0,iorder
|
||||
Ix_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Ix = 0
|
||||
do ix = 0, iorder_p(1)
|
||||
if (abs(P_new(ix,1)) < thr) cycle
|
||||
a = P_new(ix,1)
|
||||
do jx = 0, iorder_q(1)
|
||||
d = a*Q_new(jx,1)
|
||||
if (abs(d) < thr) cycle
|
||||
!DIR$ FORCEINLINE
|
||||
call give_polynom_mult_center_x(P_center(1),Q_center(1),ix,jx,p,q,iorder,pq_inv,pq_inv_2,p10_1,p01_1,p10_2,p01_2,dx,nx)
|
||||
!DIR$ FORCEINLINE
|
||||
call add_poly_multiply(dx,nx,d,Ix_pol,n_Ix)
|
||||
enddo
|
||||
enddo
|
||||
if (n_Ix == -1) then
|
||||
return
|
||||
endif
|
||||
iorder = iorder_p(2)+iorder_q(2)+iorder_p(2)+iorder_q(2)
|
||||
do ix=0, iorder
|
||||
Iy_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Iy = 0
|
||||
do iy = 0, iorder_p(2)
|
||||
if (abs(P_new(iy,2)) > thr) then
|
||||
b = P_new(iy,2)
|
||||
do jy = 0, iorder_q(2)
|
||||
e = b*Q_new(jy,2)
|
||||
if (abs(e) < thr) cycle
|
||||
!DIR$ FORCEINLINE
|
||||
call give_polynom_mult_center_x(P_center(2),Q_center(2),iy,jy,p,q,iorder,pq_inv,pq_inv_2,p10_1,p01_1,p10_2,p01_2,dy,ny)
|
||||
!DIR$ FORCEINLINE
|
||||
call add_poly_multiply(dy,ny,e,Iy_pol,n_Iy)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
if (n_Iy == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
iorder = iorder_p(3)+iorder_q(3)+iorder_p(3)+iorder_q(3)
|
||||
do ix=0,iorder
|
||||
Iz_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Iz = 0
|
||||
do iz = 0, iorder_p(3)
|
||||
if (abs(P_new(iz,3)) > thr) then
|
||||
c = P_new(iz,3)
|
||||
do jz = 0, iorder_q(3)
|
||||
f = c*Q_new(jz,3)
|
||||
if (abs(f) < thr) cycle
|
||||
!DIR$ FORCEINLINE
|
||||
call give_polynom_mult_center_x(P_center(3),Q_center(3),iz,jz,p,q,iorder,pq_inv,pq_inv_2,p10_1,p01_1,p10_2,p01_2,dz,nz)
|
||||
!DIR$ FORCEINLINE
|
||||
call add_poly_multiply(dz,nz,f,Iz_pol,n_Iz)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
if (n_Iz == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
rho = p*q *pq_inv_2
|
||||
dist = (P_center(1) - Q_center(1))*(P_center(1) - Q_center(1)) + &
|
||||
(P_center(2) - Q_center(2))*(P_center(2) - Q_center(2)) + &
|
||||
(P_center(3) - Q_center(3))*(P_center(3) - Q_center(3))
|
||||
const = dist*rho
|
||||
|
||||
n_pt_tmp = n_Ix+n_Iy
|
||||
do i=0,n_pt_tmp
|
||||
d_poly(i)=0.d0
|
||||
enddo
|
||||
|
||||
!DIR$ FORCEINLINE
|
||||
call multiply_poly(Ix_pol,n_Ix,Iy_pol,n_Iy,d_poly,n_pt_tmp)
|
||||
if (n_pt_tmp == -1) then
|
||||
return
|
||||
endif
|
||||
n_pt_out = n_pt_tmp+n_Iz
|
||||
do i=0,n_pt_out
|
||||
d1(i)=0.d0
|
||||
enddo
|
||||
|
||||
!DIR$ FORCEINLINE
|
||||
call multiply_poly(d_poly ,n_pt_tmp ,Iz_pol,n_Iz,d1,n_pt_out)
|
||||
|
||||
double precision :: aa,c_a,t_a,rho_old,w_a,pi_3,prefactor,inv_pq_3_2
|
||||
double precision :: gauss_int
|
||||
integer :: m
|
||||
gauss_int = 0.d0
|
||||
pi_3 = pi*pi*pi
|
||||
inv_pq_3_2 = (p_inv * q_inv)**(1.5d0)
|
||||
rho_old = (p*q)/(p+q)
|
||||
prefactor = pi_3 * inv_pq_3_2 * fact_p * fact_q
|
||||
do i = 1, n_gauss_eff_pot ! browse the gaussians with different expo/coef
|
||||
!do i = 1, n_gauss_eff_pot-1
|
||||
aa = expo_gauss_eff_pot(i)
|
||||
c_a = coef_gauss_eff_pot(i)
|
||||
t_a = dsqrt( aa /(rho_old + aa) )
|
||||
w_a = dexp(-t_a*t_a*rho_old*dist)
|
||||
accu = 0.d0
|
||||
! evaluation of the polynom Ix(t_a) * Iy(t_a) * Iz(t_a)
|
||||
do m = 0, n_pt_out,2
|
||||
accu += d1(m) * (t_a)**(dble(m))
|
||||
enddo
|
||||
! equation A8 of PRA-70-062505 (2004) of Toul. Col. Sav.
|
||||
gauss_int = gauss_int + c_a * prefactor * (1.d0 - t_a*t_a)**(1.5d0) * w_a * accu
|
||||
enddo
|
||||
|
||||
general_primitive_integral_gauss = gauss_int
|
||||
end
|
||||
|
||||
subroutine compute_ao_integrals_gauss_jl(j,l,n_integrals,buffer_i,buffer_value)
|
||||
implicit none
|
||||
use map_module
|
||||
BEGIN_DOC
|
||||
! Parallel client for AO integrals
|
||||
END_DOC
|
||||
|
||||
integer, intent(in) :: j,l
|
||||
integer,intent(out) :: n_integrals
|
||||
integer(key_kind),intent(out) :: buffer_i(ao_num*ao_num)
|
||||
real(integral_kind),intent(out) :: buffer_value(ao_num*ao_num)
|
||||
|
||||
integer :: i,k
|
||||
double precision :: cpu_1,cpu_2, wall_1, wall_2
|
||||
double precision :: integral, wall_0
|
||||
double precision :: thr,ao_tc_sym_two_e_pot
|
||||
integer :: kk, m, j1, i1
|
||||
logical, external :: ao_two_e_integral_zero
|
||||
|
||||
thr = ao_integrals_threshold
|
||||
|
||||
n_integrals = 0
|
||||
|
||||
j1 = j+ishft(l*l-l,-1)
|
||||
do k = 1, ao_num ! r1
|
||||
i1 = ishft(k*k-k,-1)
|
||||
if (i1 > j1) then
|
||||
exit
|
||||
endif
|
||||
do i = 1, k
|
||||
i1 += 1
|
||||
if (i1 > j1) then
|
||||
exit
|
||||
endif
|
||||
! if (ao_two_e_integral_zero(i,j,k,l)) then
|
||||
if (.False.) then
|
||||
cycle
|
||||
endif
|
||||
if (ao_two_e_integral_erf_schwartz(i,k)*ao_two_e_integral_erf_schwartz(j,l) < thr ) then
|
||||
cycle
|
||||
endif
|
||||
!DIR$ FORCEINLINE
|
||||
integral = ao_tc_sym_two_e_pot(i,k,j,l) ! i,k : r1 j,l : r2
|
||||
if (abs(integral) < thr) then
|
||||
cycle
|
||||
endif
|
||||
n_integrals += 1
|
||||
!DIR$ FORCEINLINE
|
||||
call two_e_integrals_index(i,j,k,l,buffer_i(n_integrals))
|
||||
buffer_value(n_integrals) = integral
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end
|
364
src/ao_tc_eff_map/useful_sub.irp.f
Normal file
364
src/ao_tc_eff_map/useful_sub.irp.f
Normal file
@ -0,0 +1,364 @@
|
||||
! ---
|
||||
|
||||
!______________________________________________________________________________________________________________________
|
||||
!______________________________________________________________________________________________________________________
|
||||
|
||||
double precision function general_primitive_integral_coul_shifted( dim &
|
||||
, P_new, P_center, fact_p, p, p_inv, iorder_p, shift_P &
|
||||
, Q_new, Q_center, fact_q, q, q_inv, iorder_q, shift_Q )
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: dim
|
||||
integer, intent(in) :: iorder_p(3), shift_P(3)
|
||||
integer, intent(in) :: iorder_q(3), shift_Q(3)
|
||||
double precision, intent(in) :: P_new(0:max_dim,3), P_center(3), fact_p, p, p_inv
|
||||
double precision, intent(in) :: Q_new(0:max_dim,3), Q_center(3), fact_q, q, q_inv
|
||||
|
||||
integer :: n_Ix, n_Iy, n_Iz, nx, ny, nz
|
||||
integer :: ix, iy, iz, jx, jy, jz, i
|
||||
integer :: n_pt_tmp, n_pt_out, iorder
|
||||
integer :: ii, jj
|
||||
double precision :: rho, dist
|
||||
double precision :: dx(0:max_dim), Ix_pol(0:max_dim)
|
||||
double precision :: dy(0:max_dim), Iy_pol(0:max_dim)
|
||||
double precision :: dz(0:max_dim), Iz_pol(0:max_dim)
|
||||
double precision :: a, b, c, d, e, f, accu, pq, const
|
||||
double precision :: pq_inv, p10_1, p10_2, p01_1, p01_2, pq_inv_2
|
||||
double precision :: d1(0:max_dim), d_poly(0:max_dim)
|
||||
double precision :: p_plus_q
|
||||
|
||||
double precision :: rint_sum
|
||||
|
||||
general_primitive_integral_coul_shifted = 0.d0
|
||||
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: dx, Ix_pol, dy, Iy_pol, dz, Iz_pol
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: d1, d_poly
|
||||
|
||||
! Gaussian Product
|
||||
! ----------------
|
||||
p_plus_q = (p+q)
|
||||
pq = p_inv * 0.5d0 * q_inv
|
||||
pq_inv = 0.5d0 / p_plus_q
|
||||
p10_1 = q * pq ! 1/(2p)
|
||||
p01_1 = p * pq ! 1/(2q)
|
||||
pq_inv_2 = pq_inv + pq_inv
|
||||
p10_2 = pq_inv_2 * p10_1 * q ! 0.5d0 * q / (pq + p*p)
|
||||
p01_2 = pq_inv_2 * p01_1 * p ! 0.5d0 * p / (q*q + pq)
|
||||
|
||||
accu = 0.d0
|
||||
|
||||
iorder = iorder_p(1) + iorder_q(1) + iorder_p(1) + iorder_q(1)
|
||||
iorder = iorder + shift_P(1) + shift_Q(1)
|
||||
iorder = iorder + shift_P(1) + shift_Q(1)
|
||||
!DIR$ VECTOR ALIGNED
|
||||
do ix = 0, iorder
|
||||
Ix_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Ix = 0
|
||||
do ix = 0, iorder_p(1)
|
||||
|
||||
ii = ix + shift_P(1)
|
||||
a = P_new(ix,1)
|
||||
if(abs(a) < thresh) cycle
|
||||
|
||||
do jx = 0, iorder_q(1)
|
||||
|
||||
jj = jx + shift_Q(1)
|
||||
d = a * Q_new(jx,1)
|
||||
if(abs(d) < thresh) cycle
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call give_polynom_mult_center_x( P_center(1), Q_center(1), ii, jj &
|
||||
, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dx, nx )
|
||||
!DEC$ FORCEINLINE
|
||||
call add_poly_multiply(dx, nx, d, Ix_pol, n_Ix)
|
||||
enddo
|
||||
enddo
|
||||
if(n_Ix == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
iorder = iorder_p(2) + iorder_q(2) + iorder_p(2) + iorder_q(2)
|
||||
iorder = iorder + shift_P(2) + shift_Q(2)
|
||||
iorder = iorder + shift_P(2) + shift_Q(2)
|
||||
!DIR$ VECTOR ALIGNED
|
||||
do ix = 0, iorder
|
||||
Iy_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Iy = 0
|
||||
do iy = 0, iorder_p(2)
|
||||
|
||||
if(abs(P_new(iy,2)) > thresh) then
|
||||
|
||||
ii = iy + shift_P(2)
|
||||
b = P_new(iy,2)
|
||||
|
||||
do jy = 0, iorder_q(2)
|
||||
|
||||
jj = jy + shift_Q(2)
|
||||
e = b * Q_new(jy,2)
|
||||
if(abs(e) < thresh) cycle
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call give_polynom_mult_center_x( P_center(2), Q_center(2), ii, jj &
|
||||
, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dy, ny )
|
||||
!DEC$ FORCEINLINE
|
||||
call add_poly_multiply(dy, ny, e, Iy_pol, n_Iy)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
if(n_Iy == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
iorder = iorder_p(3) + iorder_q(3) + iorder_p(3) + iorder_q(3)
|
||||
iorder = iorder + shift_P(3) + shift_Q(3)
|
||||
iorder = iorder + shift_P(3) + shift_Q(3)
|
||||
do ix = 0, iorder
|
||||
Iz_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Iz = 0
|
||||
do iz = 0, iorder_p(3)
|
||||
|
||||
if( abs(P_new(iz,3)) > thresh ) then
|
||||
|
||||
ii = iz + shift_P(3)
|
||||
c = P_new(iz,3)
|
||||
|
||||
do jz = 0, iorder_q(3)
|
||||
|
||||
jj = jz + shift_Q(3)
|
||||
f = c * Q_new(jz,3)
|
||||
if(abs(f) < thresh) cycle
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call give_polynom_mult_center_x( P_center(3), Q_center(3), ii, jj &
|
||||
, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dz, nz )
|
||||
!DEC$ FORCEINLINE
|
||||
call add_poly_multiply(dz, nz, f, Iz_pol, n_Iz)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
if(n_Iz == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
rho = p * q * pq_inv_2
|
||||
dist = (P_center(1) - Q_center(1)) * (P_center(1) - Q_center(1)) &
|
||||
+ (P_center(2) - Q_center(2)) * (P_center(2) - Q_center(2)) &
|
||||
+ (P_center(3) - Q_center(3)) * (P_center(3) - Q_center(3))
|
||||
const = dist*rho
|
||||
|
||||
n_pt_tmp = n_Ix + n_Iy
|
||||
do i = 0, n_pt_tmp
|
||||
d_poly(i) = 0.d0
|
||||
enddo
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call multiply_poly(Ix_pol, n_Ix, Iy_pol, n_Iy, d_poly, n_pt_tmp)
|
||||
if(n_pt_tmp == -1) then
|
||||
return
|
||||
endif
|
||||
n_pt_out = n_pt_tmp + n_Iz
|
||||
do i = 0, n_pt_out
|
||||
d1(i) = 0.d0
|
||||
enddo
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call multiply_poly(d_poly, n_pt_tmp, Iz_pol, n_Iz, d1, n_pt_out)
|
||||
accu = accu + rint_sum(n_pt_out, const, d1)
|
||||
|
||||
general_primitive_integral_coul_shifted = fact_p * fact_q * accu * pi_5_2 * p_inv * q_inv / dsqrt(p_plus_q)
|
||||
|
||||
return
|
||||
end function general_primitive_integral_coul_shifted
|
||||
!______________________________________________________________________________________________________________________
|
||||
!______________________________________________________________________________________________________________________
|
||||
|
||||
|
||||
|
||||
!______________________________________________________________________________________________________________________
|
||||
!______________________________________________________________________________________________________________________
|
||||
|
||||
double precision function general_primitive_integral_erf_shifted( dim &
|
||||
, P_new, P_center, fact_p, p, p_inv, iorder_p, shift_P &
|
||||
, Q_new, Q_center, fact_q, q, q_inv, iorder_q, shift_Q )
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: dim
|
||||
integer, intent(in) :: iorder_p(3), shift_P(3)
|
||||
integer, intent(in) :: iorder_q(3), shift_Q(3)
|
||||
double precision, intent(in) :: P_new(0:max_dim,3), P_center(3), fact_p, p, p_inv
|
||||
double precision, intent(in) :: Q_new(0:max_dim,3), Q_center(3), fact_q, q, q_inv
|
||||
|
||||
integer :: n_Ix, n_Iy, n_Iz, nx, ny, nz
|
||||
integer :: ix, iy, iz, jx, jy, jz, i
|
||||
integer :: n_pt_tmp, n_pt_out, iorder
|
||||
integer :: ii, jj
|
||||
double precision :: rho, dist
|
||||
double precision :: dx(0:max_dim), Ix_pol(0:max_dim)
|
||||
double precision :: dy(0:max_dim), Iy_pol(0:max_dim)
|
||||
double precision :: dz(0:max_dim), Iz_pol(0:max_dim)
|
||||
double precision :: a, b, c, d, e, f, accu, pq, const
|
||||
double precision :: pq_inv, p10_1, p10_2, p01_1, p01_2, pq_inv_2
|
||||
double precision :: d1(0:max_dim), d_poly(0:max_dim)
|
||||
double precision :: p_plus_q
|
||||
|
||||
double precision :: rint_sum
|
||||
|
||||
general_primitive_integral_erf_shifted = 0.d0
|
||||
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: dx, Ix_pol, dy, Iy_pol, dz, Iz_pol
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: d1, d_poly
|
||||
|
||||
! Gaussian Product
|
||||
! ----------------
|
||||
p_plus_q = (p+q) * ( (p*q)/(p+q) + mu_erf*mu_erf ) / (mu_erf*mu_erf)
|
||||
pq = p_inv * 0.5d0 * q_inv
|
||||
pq_inv = 0.5d0 / p_plus_q
|
||||
p10_1 = q * pq ! 1/(2p)
|
||||
p01_1 = p * pq ! 1/(2q)
|
||||
pq_inv_2 = pq_inv + pq_inv
|
||||
p10_2 = pq_inv_2 * p10_1 * q ! 0.5d0 * q / (pq + p*p)
|
||||
p01_2 = pq_inv_2 * p01_1 * p ! 0.5d0 * p / (q*q + pq)
|
||||
|
||||
accu = 0.d0
|
||||
|
||||
iorder = iorder_p(1) + iorder_q(1) + iorder_p(1) + iorder_q(1)
|
||||
iorder = iorder + shift_P(1) + shift_Q(1)
|
||||
iorder = iorder + shift_P(1) + shift_Q(1)
|
||||
!DIR$ VECTOR ALIGNED
|
||||
do ix = 0, iorder
|
||||
Ix_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Ix = 0
|
||||
do ix = 0, iorder_p(1)
|
||||
|
||||
ii = ix + shift_P(1)
|
||||
a = P_new(ix,1)
|
||||
if(abs(a) < thresh) cycle
|
||||
|
||||
do jx = 0, iorder_q(1)
|
||||
|
||||
jj = jx + shift_Q(1)
|
||||
d = a * Q_new(jx,1)
|
||||
if(abs(d) < thresh) cycle
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call give_polynom_mult_center_x( P_center(1), Q_center(1), ii, jj &
|
||||
, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dx, nx )
|
||||
!DEC$ FORCEINLINE
|
||||
call add_poly_multiply(dx, nx, d, Ix_pol, n_Ix)
|
||||
enddo
|
||||
enddo
|
||||
if(n_Ix == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
iorder = iorder_p(2) + iorder_q(2) + iorder_p(2) + iorder_q(2)
|
||||
iorder = iorder + shift_P(2) + shift_Q(2)
|
||||
iorder = iorder + shift_P(2) + shift_Q(2)
|
||||
!DIR$ VECTOR ALIGNED
|
||||
do ix = 0, iorder
|
||||
Iy_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Iy = 0
|
||||
do iy = 0, iorder_p(2)
|
||||
|
||||
if(abs(P_new(iy,2)) > thresh) then
|
||||
|
||||
ii = iy + shift_P(2)
|
||||
b = P_new(iy,2)
|
||||
|
||||
do jy = 0, iorder_q(2)
|
||||
|
||||
jj = jy + shift_Q(2)
|
||||
e = b * Q_new(jy,2)
|
||||
if(abs(e) < thresh) cycle
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call give_polynom_mult_center_x( P_center(2), Q_center(2), ii, jj &
|
||||
, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dy, ny )
|
||||
!DEC$ FORCEINLINE
|
||||
call add_poly_multiply(dy, ny, e, Iy_pol, n_Iy)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
if(n_Iy == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
iorder = iorder_p(3) + iorder_q(3) + iorder_p(3) + iorder_q(3)
|
||||
iorder = iorder + shift_P(3) + shift_Q(3)
|
||||
iorder = iorder + shift_P(3) + shift_Q(3)
|
||||
do ix = 0, iorder
|
||||
Iz_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Iz = 0
|
||||
do iz = 0, iorder_p(3)
|
||||
|
||||
if( abs(P_new(iz,3)) > thresh ) then
|
||||
|
||||
ii = iz + shift_P(3)
|
||||
c = P_new(iz,3)
|
||||
|
||||
do jz = 0, iorder_q(3)
|
||||
|
||||
jj = jz + shift_Q(3)
|
||||
f = c * Q_new(jz,3)
|
||||
if(abs(f) < thresh) cycle
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call give_polynom_mult_center_x( P_center(3), Q_center(3), ii, jj &
|
||||
, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dz, nz )
|
||||
!DEC$ FORCEINLINE
|
||||
call add_poly_multiply(dz, nz, f, Iz_pol, n_Iz)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
if(n_Iz == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
rho = p * q * pq_inv_2
|
||||
dist = (P_center(1) - Q_center(1)) * (P_center(1) - Q_center(1)) &
|
||||
+ (P_center(2) - Q_center(2)) * (P_center(2) - Q_center(2)) &
|
||||
+ (P_center(3) - Q_center(3)) * (P_center(3) - Q_center(3))
|
||||
const = dist*rho
|
||||
|
||||
n_pt_tmp = n_Ix + n_Iy
|
||||
do i = 0, n_pt_tmp
|
||||
d_poly(i) = 0.d0
|
||||
enddo
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call multiply_poly(Ix_pol, n_Ix, Iy_pol, n_Iy, d_poly, n_pt_tmp)
|
||||
if(n_pt_tmp == -1) then
|
||||
return
|
||||
endif
|
||||
n_pt_out = n_pt_tmp + n_Iz
|
||||
do i = 0, n_pt_out
|
||||
d1(i) = 0.d0
|
||||
enddo
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call multiply_poly(d_poly, n_pt_tmp, Iz_pol, n_Iz, d1, n_pt_out)
|
||||
accu = accu + rint_sum(n_pt_out, const, d1)
|
||||
|
||||
general_primitive_integral_erf_shifted = fact_p * fact_q * accu * pi_5_2 * p_inv * q_inv / dsqrt(p_plus_q)
|
||||
|
||||
return
|
||||
end function general_primitive_integral_erf_shifted
|
||||
!______________________________________________________________________________________________________________________
|
||||
!______________________________________________________________________________________________________________________
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -169,4 +169,43 @@
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER[double precision, aos_in_r_array_extra, (ao_num,n_points_extra_final_grid)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_in_r_array_extra(i,j) = value of the ith ao on the jth grid point
|
||||
END_DOC
|
||||
integer :: i,j
|
||||
double precision :: aos_array(ao_num), r(3)
|
||||
!$OMP PARALLEL DO &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,r,aos_array,j) &
|
||||
!$OMP SHARED(aos_in_r_array_extra,n_points_extra_final_grid,ao_num,final_grid_points_extra)
|
||||
do i = 1, n_points_extra_final_grid
|
||||
r(1) = final_grid_points_extra(1,i)
|
||||
r(2) = final_grid_points_extra(2,i)
|
||||
r(3) = final_grid_points_extra(3,i)
|
||||
call give_all_aos_at_r(r,aos_array)
|
||||
do j = 1, ao_num
|
||||
aos_in_r_array_extra(j,i) = aos_array(j)
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END PARALLEL DO
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER[double precision, aos_in_r_array_extra_transp, (n_points_extra_final_grid,ao_num)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_in_r_array_extra_transp(i,j) = value of the jth ao on the ith grid point
|
||||
END_DOC
|
||||
integer :: i,j
|
||||
double precision :: aos_array(ao_num), r(3)
|
||||
do i = 1, n_points_extra_final_grid
|
||||
do j = 1, ao_num
|
||||
aos_in_r_array_extra_transp(i,j) = aos_in_r_array_extra(j,i)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
155
src/dft_utils_in_r/ao_prod_mlti_pl.irp.f
Normal file
155
src/dft_utils_in_r/ao_prod_mlti_pl.irp.f
Normal file
@ -0,0 +1,155 @@
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_abs_int_grid, (ao_num)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! ao_abs_int_grid(i) = \int dr |phi_i(r) |
|
||||
END_DOC
|
||||
integer :: i,j,ipoint
|
||||
double precision :: contrib, weight,r(3)
|
||||
ao_abs_int_grid = 0.D0
|
||||
do ipoint = 1,n_points_final_grid
|
||||
r(:) = final_grid_points(:,ipoint)
|
||||
weight = final_weight_at_r_vector(ipoint)
|
||||
do i = 1, ao_num
|
||||
contrib = dabs(aos_in_r_array(i,ipoint)) * weight
|
||||
ao_abs_int_grid(i) += contrib
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_overlap_abs_grid, (ao_num, ao_num)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! ao_overlap_abs_grid(j,i) = \int dr |phi_i(r) phi_j(r)|
|
||||
END_DOC
|
||||
integer :: i,j,ipoint
|
||||
double precision :: contrib, weight,r(3)
|
||||
ao_overlap_abs_grid = 0.D0
|
||||
do ipoint = 1,n_points_final_grid
|
||||
r(:) = final_grid_points(:,ipoint)
|
||||
weight = final_weight_at_r_vector(ipoint)
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
contrib = dabs(aos_in_r_array(j,ipoint) * aos_in_r_array(i,ipoint)) * weight
|
||||
ao_overlap_abs_grid(j,i) += contrib
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_prod_center, (3, ao_num, ao_num)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! ao_prod_center(1:3,j,i) = \int dr |phi_i(r) phi_j(r)| x/y/z / \int |phi_i(r) phi_j(r)|
|
||||
!
|
||||
! if \int |phi_i(r) phi_j(r)| < 1.d-10 then ao_prod_center = 10000.
|
||||
END_DOC
|
||||
integer :: i,j,m,ipoint
|
||||
double precision :: contrib, weight,r(3)
|
||||
ao_prod_center = 0.D0
|
||||
do ipoint = 1,n_points_final_grid
|
||||
r(:) = final_grid_points(:,ipoint)
|
||||
weight = final_weight_at_r_vector(ipoint)
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
contrib = dabs(aos_in_r_array(j,ipoint) * aos_in_r_array(i,ipoint)) * weight
|
||||
do m = 1, 3
|
||||
ao_prod_center(m,j,i) += contrib * r(m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
if(dabs(ao_overlap_abs_grid(j,i)).gt.1.d-10)then
|
||||
do m = 1, 3
|
||||
ao_prod_center(m,j,i) *= 1.d0/ao_overlap_abs_grid(j,i)
|
||||
enddo
|
||||
else
|
||||
do m = 1, 3
|
||||
ao_prod_center(m,j,i) = 10000.d0
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_prod_abs_r, (ao_num, ao_num)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! ao_prod_abs_r(i,j) = \int |phi_i(r) phi_j(r)| dsqrt((x - <|i|x|j|>)^2 + (y - <|i|y|j|>)^2 +(z - <|i|z|j|>)^2) / \int |phi_i(r) phi_j(r)|
|
||||
!
|
||||
END_DOC
|
||||
ao_prod_abs_r = 0.d0
|
||||
integer :: i,j,m,ipoint
|
||||
double precision :: contrib, weight,r(3),contrib_x2
|
||||
do ipoint = 1,n_points_final_grid
|
||||
r(:) = final_grid_points(:,ipoint)
|
||||
weight = final_weight_at_r_vector(ipoint)
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
contrib = dabs(aos_in_r_array(j,ipoint) * aos_in_r_array(i,ipoint)) * weight
|
||||
contrib_x2 = 0.d0
|
||||
do m = 1, 3
|
||||
contrib_x2 += (r(m) - ao_prod_center(m,j,i)) * (r(m) - ao_prod_center(m,j,i))
|
||||
enddo
|
||||
contrib_x2 = dsqrt(contrib_x2)
|
||||
ao_prod_abs_r(j,i) += contrib * contrib_x2
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, ao_prod_sigma, (ao_num, ao_num)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Gaussian exponent reproducing the product |chi_i(r) chi_j(r)|
|
||||
!
|
||||
! Therefore |chi_i(r) chi_j(r)| \approx e^{-ao_prod_sigma(j,i) (r - ao_prod_center(1:3,j,i))**2}
|
||||
END_DOC
|
||||
integer :: i,j
|
||||
double precision :: pi,alpha
|
||||
pi = dacos(-1.d0)
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
! if(dabs(ao_overlap_abs_grid(j,i)).gt.1.d-5)then
|
||||
alpha = 1.d0/pi * (2.d0*ao_overlap_abs_grid(j,i)/ao_prod_abs_r(j,i))**2
|
||||
ao_prod_sigma(j,i) = alpha
|
||||
! endif
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_prod_dist_grid, (ao_num, ao_num, n_points_final_grid)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! ao_prod_dist_grid(j,i,ipoint) = distance between the center of |phi_i(r) phi_j(r)| and the grid point r(ipoint)
|
||||
END_DOC
|
||||
integer :: i,j,m,ipoint
|
||||
double precision :: distance,r(3)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(:) = final_grid_points(:,ipoint)
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
distance = 0.d0
|
||||
do m = 1, 3
|
||||
distance += (ao_prod_center(m,j,i) - r(m))*(ao_prod_center(m,j,i) - r(m))
|
||||
enddo
|
||||
distance = dsqrt(distance)
|
||||
ao_prod_dist_grid(j,i,ipoint) = distance
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
!BEGIN_PROVIDER [ double precision, ao_abs_prod_j1b, (ao_num, ao_num)]
|
||||
! implicit none
|
||||
!
|
||||
!END_PROVIDER
|
2
src/non_h_ints_mu/NEED
Normal file
2
src/non_h_ints_mu/NEED
Normal file
@ -0,0 +1,2 @@
|
||||
ao_tc_eff_map
|
||||
bi_ortho_mos
|
11
src/non_h_ints_mu/README.rst
Normal file
11
src/non_h_ints_mu/README.rst
Normal file
@ -0,0 +1,11 @@
|
||||
=============
|
||||
non_h_ints_mu
|
||||
=============
|
||||
|
||||
Computes the non hermitian potential of the mu-TC Hamiltonian on the AO and BI-ORTHO MO basis.
|
||||
The operator is defined in Eq. 33 of JCP 154, 084119 (2021)
|
||||
|
||||
The two providers are :
|
||||
+) ao_non_hermit_term_chemist which returns the non hermitian part of the two-electron TC Hamiltonian on the MO basis.
|
||||
+) mo_non_hermit_term_chemist which returns the non hermitian part of the two-electron TC Hamiltonian on the BI-ORTHO MO basis.
|
||||
|
512
src/non_h_ints_mu/debug_fit.irp.f
Normal file
512
src/non_h_ints_mu/debug_fit.irp.f
Normal file
@ -0,0 +1,512 @@
|
||||
|
||||
! --
|
||||
|
||||
program debug_fit
|
||||
|
||||
implicit none
|
||||
|
||||
my_grid_becke = .True.
|
||||
|
||||
my_n_pt_r_grid = 30
|
||||
my_n_pt_a_grid = 50
|
||||
!my_n_pt_r_grid = 100
|
||||
!my_n_pt_a_grid = 170
|
||||
!my_n_pt_r_grid = 150
|
||||
!my_n_pt_a_grid = 194
|
||||
touch my_grid_becke my_n_pt_r_grid my_n_pt_a_grid
|
||||
|
||||
PROVIDE mu_erf j1b_pen
|
||||
|
||||
!call test_j1b_nucl()
|
||||
call test_grad_j1b_nucl()
|
||||
!call test_lapl_j1b_nucl()
|
||||
|
||||
!call test_list_b2()
|
||||
!call test_list_b3()
|
||||
|
||||
call test_fit_u()
|
||||
!call test_fit_u2()
|
||||
!call test_fit_ugradu()
|
||||
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_j1b_nucl()
|
||||
|
||||
implicit none
|
||||
integer :: ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision :: r(3)
|
||||
double precision, external :: j1b_nucl
|
||||
|
||||
print*, ' test_j1b_nucl ...'
|
||||
|
||||
PROVIDE v_1b
|
||||
|
||||
eps_ij = 1d-7
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
i_exc = v_1b(ipoint)
|
||||
i_num = j1b_nucl(r)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in v_1b on', ipoint
|
||||
print *, ' analyt = ', i_exc
|
||||
print *, ' numeri = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_j1b_nucl
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_grad_j1b_nucl()
|
||||
|
||||
implicit none
|
||||
integer :: ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision :: r(3)
|
||||
double precision, external :: grad_x_j1b_nucl
|
||||
double precision, external :: grad_y_j1b_nucl
|
||||
double precision, external :: grad_z_j1b_nucl
|
||||
|
||||
print*, ' test_grad_j1b_nucl ...'
|
||||
|
||||
PROVIDE v_1b_grad
|
||||
|
||||
eps_ij = 1d-7
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
i_exc = v_1b_grad(1,ipoint)
|
||||
i_num = grad_x_j1b_nucl(r)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in x of v_1b_grad on', ipoint
|
||||
print *, ' analyt = ', i_exc
|
||||
print *, ' numeri = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
i_exc = v_1b_grad(2,ipoint)
|
||||
i_num = grad_y_j1b_nucl(r)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in y of v_1b_grad on', ipoint
|
||||
print *, ' analyt = ', i_exc
|
||||
print *, ' numeri = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
i_exc = v_1b_grad(3,ipoint)
|
||||
i_num = grad_z_j1b_nucl(r)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in z of v_1b_grad on', ipoint
|
||||
print *, ' analyt = ', i_exc
|
||||
print *, ' numeri = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_grad_j1b_nucl
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_lapl_j1b_nucl()
|
||||
|
||||
implicit none
|
||||
integer :: ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision :: r(3)
|
||||
double precision, external :: lapl_j1b_nucl
|
||||
|
||||
print*, ' test_lapl_j1b_nucl ...'
|
||||
|
||||
PROVIDE v_1b_lapl
|
||||
|
||||
eps_ij = 1d-5
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
i_exc = v_1b_lapl(ipoint)
|
||||
i_num = lapl_j1b_nucl(r)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in v_1b_lapl on', ipoint
|
||||
print *, ' analyt = ', i_exc
|
||||
print *, ' numeri = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_lapl_j1b_nucl
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_list_b2()
|
||||
|
||||
implicit none
|
||||
integer :: ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision :: r(3)
|
||||
double precision, external :: j1b_nucl
|
||||
|
||||
print*, ' test_list_b2 ...'
|
||||
|
||||
PROVIDE v_1b_list_b2
|
||||
|
||||
eps_ij = 1d-7
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
i_exc = v_1b_list_b2(ipoint)
|
||||
i_num = j1b_nucl(r)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in list_b2 on', ipoint
|
||||
print *, ' analyt = ', i_exc
|
||||
print *, ' numeri = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_list_b2
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_list_b3()
|
||||
|
||||
implicit none
|
||||
integer :: ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_tmp, i_num, normalz
|
||||
double precision :: r(3)
|
||||
double precision, external :: j1b_nucl
|
||||
|
||||
print*, ' test_list_b3 ...'
|
||||
|
||||
PROVIDE v_1b_list_b3
|
||||
|
||||
eps_ij = 1d-7
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
i_exc = v_1b_list_b3(ipoint)
|
||||
i_tmp = j1b_nucl(r)
|
||||
i_num = i_tmp * i_tmp
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in list_b3 on', ipoint
|
||||
print *, ' analyt = ', i_exc
|
||||
print *, ' numeri = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_list_b3
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_fit_ugradu()
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: jpoint, ipoint, i
|
||||
double precision :: i_exc, i_fit, i_num, x2, tmp, dx, dy, dz
|
||||
double precision :: r1(3), r2(3), grad(3)
|
||||
double precision :: eps_ij, acc_tot, acc_ij, normalz, coef, expo
|
||||
|
||||
double precision, external :: j12_mu
|
||||
|
||||
print*, ' test_fit_ugradu ...'
|
||||
|
||||
eps_ij = 1d-3
|
||||
|
||||
do jpoint = 1, n_points_final_grid
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
dx = r1(1) - r2(1)
|
||||
dy = r1(2) - r2(2)
|
||||
dz = r1(3) - r2(3)
|
||||
x2 = dx * dx + dy * dy + dz * dz
|
||||
if(x2 .lt. 1d-10) cycle
|
||||
|
||||
i_fit = 0.d0
|
||||
do i = 1, n_max_fit_slat
|
||||
expo = expo_gauss_j_mu_1_erf(i)
|
||||
coef = coef_gauss_j_mu_1_erf(i)
|
||||
i_fit += coef * dexp(-expo*x2)
|
||||
enddo
|
||||
i_fit = i_fit / dsqrt(x2)
|
||||
|
||||
tmp = j12_mu(r1, r2)
|
||||
call grad1_j12_mu_exc(r1, r2, grad)
|
||||
|
||||
! ---
|
||||
|
||||
i_exc = tmp * grad(1)
|
||||
i_num = i_fit * dx
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem on x in test_fit_ugradu on', ipoint
|
||||
print *, ' analyt = ', i_exc
|
||||
print *, ' numeri = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_exc)
|
||||
|
||||
! ---
|
||||
|
||||
i_exc = tmp * grad(2)
|
||||
i_num = i_fit * dy
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem on y in test_fit_ugradu on', ipoint
|
||||
print *, ' analyt = ', i_exc
|
||||
print *, ' numeri = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_exc)
|
||||
|
||||
! ---
|
||||
|
||||
i_exc = tmp * grad(3)
|
||||
i_num = i_fit * dz
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem on z in test_fit_ugradu on', ipoint
|
||||
print *, ' analyt = ', i_exc
|
||||
print *, ' numeri = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_exc)
|
||||
|
||||
! ---
|
||||
|
||||
enddo
|
||||
|
||||
if( (acc_tot/normalz) .gt. 1d-3 ) then
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
endif
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine test_fit_ugradu
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_fit_u()
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: jpoint, ipoint, i
|
||||
double precision :: i_exc, i_fit, i_num, x2
|
||||
double precision :: r1(3), r2(3), dx, dy, dz
|
||||
double precision :: eps_ij, acc_tot, acc_ij, normalz, coef, expo
|
||||
|
||||
double precision, external :: j12_mu
|
||||
|
||||
print*, ' test_fit_u ...'
|
||||
|
||||
eps_ij = 1d-3
|
||||
|
||||
do jpoint = 1, n_points_final_grid
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
dx = r1(1) - r2(1)
|
||||
dy = r1(2) - r2(2)
|
||||
dz = r1(3) - r2(3)
|
||||
x2 = dx * dx + dy * dy + dz * dz
|
||||
if(x2 .lt. 1d-10) cycle
|
||||
|
||||
i_fit = 0.d0
|
||||
do i = 1, n_max_fit_slat
|
||||
expo = expo_gauss_j_mu_x(i)
|
||||
coef = coef_gauss_j_mu_x(i)
|
||||
i_fit += coef * dexp(-expo*x2)
|
||||
enddo
|
||||
|
||||
i_exc = j12_mu(r1, r2)
|
||||
i_num = i_fit
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in test_fit_u on', ipoint
|
||||
print *, ' analyt = ', i_exc
|
||||
print *, ' numeri = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_exc)
|
||||
enddo
|
||||
|
||||
if( (acc_tot/normalz) .gt. 1d-3 ) then
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
endif
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine test_fit_u
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_fit_u2()
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: jpoint, ipoint, i
|
||||
double precision :: i_exc, i_fit, i_num, x2
|
||||
double precision :: r1(3), r2(3), dx, dy, dz, tmp
|
||||
double precision :: eps_ij, acc_tot, acc_ij, normalz, coef, expo
|
||||
|
||||
double precision, external :: j12_mu
|
||||
|
||||
print*, ' test_fit_u2 ...'
|
||||
|
||||
eps_ij = 1d-3
|
||||
|
||||
do jpoint = 1, n_points_final_grid
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
dx = r1(1) - r2(1)
|
||||
dy = r1(2) - r2(2)
|
||||
dz = r1(3) - r2(3)
|
||||
x2 = dx * dx + dy * dy + dz * dz
|
||||
if(x2 .lt. 1d-10) cycle
|
||||
|
||||
i_fit = 0.d0
|
||||
do i = 1, n_max_fit_slat
|
||||
expo = expo_gauss_j_mu_x_2(i)
|
||||
coef = coef_gauss_j_mu_x_2(i)
|
||||
i_fit += coef * dexp(-expo*x2)
|
||||
enddo
|
||||
|
||||
tmp = j12_mu(r1, r2)
|
||||
i_exc = tmp * tmp
|
||||
i_num = i_fit
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in test_fit_u2 on', ipoint
|
||||
print *, ' analyt = ', i_exc
|
||||
print *, ' numeri = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_exc)
|
||||
enddo
|
||||
|
||||
if( (acc_tot/normalz) .gt. 1d-3 ) then
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
endif
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine test_fit_u2
|
||||
|
||||
! ---
|
||||
|
||||
|
780
src/non_h_ints_mu/debug_integ_jmu_modif.irp.f
Normal file
780
src/non_h_ints_mu/debug_integ_jmu_modif.irp.f
Normal file
@ -0,0 +1,780 @@
|
||||
|
||||
! --
|
||||
|
||||
program debug_integ_jmu_modif
|
||||
|
||||
implicit none
|
||||
|
||||
my_grid_becke = .True.
|
||||
|
||||
!my_n_pt_r_grid = 30
|
||||
!my_n_pt_a_grid = 50
|
||||
!my_n_pt_r_grid = 100
|
||||
!my_n_pt_a_grid = 170
|
||||
my_n_pt_r_grid = 150
|
||||
my_n_pt_a_grid = 194
|
||||
touch my_grid_becke my_n_pt_r_grid my_n_pt_a_grid
|
||||
|
||||
PROVIDE mu_erf j1b_pen
|
||||
|
||||
! call test_v_ij_u_cst_mu_j1b()
|
||||
! call test_v_ij_erf_rk_cst_mu_j1b()
|
||||
! call test_x_v_ij_erf_rk_cst_mu_j1b()
|
||||
! call test_int2_u2_j1b2()
|
||||
! call test_int2_grad1u2_grad2u2_j1b2()
|
||||
! call test_int2_u_grad1u_total_j1b2()
|
||||
!
|
||||
! call test_int2_grad1_u12_ao()
|
||||
!
|
||||
! call test_grad12_j12()
|
||||
! call test_u12sq_j1bsq()
|
||||
! call test_u12_grad1_u12_j1b_grad1_j1b()
|
||||
! !call test_gradu_squared_u_ij_mu()
|
||||
|
||||
!call test_vect_overlap_gauss_r12_ao()
|
||||
call test_vect_overlap_gauss_r12_ao_with1s()
|
||||
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_v_ij_u_cst_mu_j1b()
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision, external :: num_v_ij_u_cst_mu_j1b
|
||||
|
||||
print*, ' test_v_ij_u_cst_mu_j1b ...'
|
||||
|
||||
PROVIDE v_ij_u_cst_mu_j1b
|
||||
|
||||
eps_ij = 1d-3
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
!do ipoint = 1, 10
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
i_exc = v_ij_u_cst_mu_j1b(i,j,ipoint)
|
||||
i_num = num_v_ij_u_cst_mu_j1b(i,j,ipoint)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in v_ij_u_cst_mu_j1b on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_v_ij_u_cst_mu_j1b
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_v_ij_erf_rk_cst_mu_j1b()
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision, external :: num_v_ij_erf_rk_cst_mu_j1b
|
||||
|
||||
print*, ' test_v_ij_erf_rk_cst_mu_j1b ...'
|
||||
|
||||
PROVIDE v_ij_erf_rk_cst_mu_j1b
|
||||
|
||||
eps_ij = 1d-3
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
!do ipoint = 1, 10
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
i_exc = v_ij_erf_rk_cst_mu_j1b(i,j,ipoint)
|
||||
i_num = num_v_ij_erf_rk_cst_mu_j1b(i,j,ipoint)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in v_ij_erf_rk_cst_mu_j1b on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_v_ij_erf_rk_cst_mu_j1b
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_x_v_ij_erf_rk_cst_mu_j1b()
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision :: integ(3)
|
||||
|
||||
print*, ' test_x_v_ij_erf_rk_cst_mu_j1b ...'
|
||||
|
||||
PROVIDE x_v_ij_erf_rk_cst_mu_j1b
|
||||
|
||||
eps_ij = 1d-3
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
!do ipoint = 1, 10
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
call num_x_v_ij_erf_rk_cst_mu_j1b(i, j, ipoint, integ)
|
||||
|
||||
i_exc = x_v_ij_erf_rk_cst_mu_j1b(i,j,ipoint,1)
|
||||
i_num = integ(1)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in x part of x_v_ij_erf_rk_cst_mu_j1b on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
|
||||
i_exc = x_v_ij_erf_rk_cst_mu_j1b(i,j,ipoint,2)
|
||||
i_num = integ(2)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in y part of x_v_ij_erf_rk_cst_mu_j1b on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
|
||||
i_exc = x_v_ij_erf_rk_cst_mu_j1b(i,j,ipoint,3)
|
||||
i_num = integ(3)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in z part of x_v_ij_erf_rk_cst_mu_j1b on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_x_v_ij_erf_rk_cst_mu_j1b
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_int2_u2_j1b2()
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision, external :: num_int2_u2_j1b2
|
||||
|
||||
print*, ' test_int2_u2_j1b2 ...'
|
||||
|
||||
PROVIDE int2_u2_j1b2
|
||||
|
||||
eps_ij = 1d-3
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
!do ipoint = 1, 10
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
i_exc = int2_u2_j1b2(i,j,ipoint)
|
||||
i_num = num_int2_u2_j1b2(i,j,ipoint)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in int2_u2_j1b2 on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
acc_tot = acc_tot / normalz
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_int2_u2_j1b2
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_int2_grad1u2_grad2u2_j1b2()
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision, external :: num_int2_grad1u2_grad2u2_j1b2
|
||||
|
||||
print*, ' test_int2_grad1u2_grad2u2_j1b2 ...'
|
||||
|
||||
PROVIDE int2_grad1u2_grad2u2_j1b2
|
||||
|
||||
eps_ij = 1d-3
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
!do ipoint = 1, 10
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
i_exc = int2_grad1u2_grad2u2_j1b2(i,j,ipoint)
|
||||
i_num = num_int2_grad1u2_grad2u2_j1b2(i,j,ipoint)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in int2_grad1u2_grad2u2_j1b2 on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_int2_grad1u2_grad2u2_j1b2
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_int2_grad1_u12_ao()
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision :: integ(3)
|
||||
|
||||
print*, ' test_int2_grad1_u12_ao ...'
|
||||
|
||||
PROVIDE int2_grad1_u12_ao
|
||||
|
||||
eps_ij = 1d-3
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
call num_int2_grad1_u12_ao(i, j, ipoint, integ)
|
||||
|
||||
i_exc = int2_grad1_u12_ao(i,j,ipoint,1)
|
||||
i_num = integ(1)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in x part of int2_grad1_u12_ao on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
|
||||
i_exc = int2_grad1_u12_ao(i,j,ipoint,2)
|
||||
i_num = integ(2)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in y part of int2_grad1_u12_ao on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
|
||||
i_exc = int2_grad1_u12_ao(i,j,ipoint,3)
|
||||
i_num = integ(3)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in z part of int2_grad1_u12_ao on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_int2_grad1_u12_ao
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_int2_u_grad1u_total_j1b2()
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision :: x, y, z
|
||||
double precision :: integ(3)
|
||||
|
||||
print*, ' test_int2_u_grad1u_total_j1b2 ...'
|
||||
|
||||
PROVIDE int2_u_grad1u_j1b2
|
||||
PROVIDE int2_u_grad1u_x_j1b2
|
||||
|
||||
eps_ij = 1d-3
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
!do ipoint = 1, 10
|
||||
do ipoint = 1, n_points_final_grid
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
call num_int2_u_grad1u_total_j1b2(i, j, ipoint, integ)
|
||||
|
||||
i_exc = x * int2_u_grad1u_j1b2(i,j,ipoint) - int2_u_grad1u_x_j1b2(i,j,ipoint,1)
|
||||
i_num = integ(1)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in x part of int2_u_grad1u_total_j1b2 on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
|
||||
i_exc = y * int2_u_grad1u_j1b2(i,j,ipoint) - int2_u_grad1u_x_j1b2(i,j,ipoint,2)
|
||||
i_num = integ(2)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in y part of int2_u_grad1u_total_j1b2 on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
|
||||
i_exc = z * int2_u_grad1u_j1b2(i,j,ipoint) - int2_u_grad1u_x_j1b2(i,j,ipoint,3)
|
||||
i_num = integ(3)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in z part of int2_u_grad1u_total_j1b2 on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_int2_u_grad1u_total_j1b2
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_gradu_squared_u_ij_mu()
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision, external :: num_gradu_squared_u_ij_mu
|
||||
|
||||
print*, ' test_gradu_squared_u_ij_mu ...'
|
||||
|
||||
PROVIDE gradu_squared_u_ij_mu
|
||||
|
||||
eps_ij = 1d-3
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
i_exc = gradu_squared_u_ij_mu(i,j,ipoint)
|
||||
i_num = num_gradu_squared_u_ij_mu(i, j, ipoint)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in gradu_squared_u_ij_mu on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_gradu_squared_u_ij_mu
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_grad12_j12()
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision, external :: num_grad12_j12
|
||||
|
||||
print*, ' test_grad12_j12 ...'
|
||||
|
||||
PROVIDE grad12_j12
|
||||
|
||||
eps_ij = 1d-3
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
i_exc = grad12_j12(i,j,ipoint)
|
||||
i_num = num_grad12_j12(i, j, ipoint)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in grad12_j12 on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_grad12_j12
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_u12sq_j1bsq()
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision, external :: num_u12sq_j1bsq
|
||||
|
||||
print*, ' test_u12sq_j1bsq ...'
|
||||
|
||||
PROVIDE u12sq_j1bsq
|
||||
|
||||
eps_ij = 1d-3
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
i_exc = u12sq_j1bsq(i,j,ipoint)
|
||||
i_num = num_u12sq_j1bsq(i, j, ipoint)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in u12sq_j1bsq on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_u12sq_j1bsq
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_u12_grad1_u12_j1b_grad1_j1b()
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision, external :: num_u12_grad1_u12_j1b_grad1_j1b
|
||||
|
||||
print*, ' test_u12_grad1_u12_j1b_grad1_j1b ...'
|
||||
|
||||
PROVIDE u12_grad1_u12_j1b_grad1_j1b
|
||||
|
||||
eps_ij = 1d-3
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
i_exc = u12_grad1_u12_j1b_grad1_j1b(i,j,ipoint)
|
||||
i_num = num_u12_grad1_u12_j1b_grad1_j1b(i, j, ipoint)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in u12_grad1_u12_j1b_grad1_j1b on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_u12_grad1_u12_j1b_grad1_j1b
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_vect_overlap_gauss_r12_ao()
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: i, j, ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision :: expo_fit, r(3)
|
||||
double precision, allocatable :: I_vec(:,:,:), I_ref(:,:,:), int_fit_v(:)
|
||||
|
||||
double precision, external :: overlap_gauss_r12_ao
|
||||
|
||||
print *, ' test_vect_overlap_gauss_r12_ao ...'
|
||||
|
||||
provide mu_erf final_grid_points_transp j1b_pen
|
||||
|
||||
expo_fit = expo_gauss_j_mu_x_2(1)
|
||||
|
||||
! ---
|
||||
|
||||
allocate(int_fit_v(n_points_final_grid))
|
||||
allocate(I_vec(ao_num,ao_num,n_points_final_grid))
|
||||
|
||||
I_vec = 0.d0
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
|
||||
call overlap_gauss_r12_ao_v(final_grid_points_transp, n_points_final_grid, expo_fit, i, j, int_fit_v, n_points_final_grid, n_points_final_grid)
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
I_vec(j,i,ipoint) = int_fit_v(ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! ---
|
||||
|
||||
allocate(I_ref(ao_num,ao_num,n_points_final_grid))
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
|
||||
I_ref(j,i,ipoint) = overlap_gauss_r12_ao(r, expo_fit, i, j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! ---
|
||||
|
||||
eps_ij = 1d-3
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
i_exc = I_ref(i,j,ipoint)
|
||||
i_num = I_vec(i,j,ipoint)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
!acc_ij = dabs(i_exc - i_num) / dabs(i_exc)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in overlap_gauss_r12_ao_v on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
stop
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_vect_overlap_gauss_r12_ao
|
||||
|
||||
! ---
|
||||
|
||||
subroutine test_vect_overlap_gauss_r12_ao_with1s()
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: i, j, ipoint
|
||||
double precision :: acc_ij, acc_tot, eps_ij, i_exc, i_num, normalz
|
||||
double precision :: expo_fit, r(3), beta, B_center(3)
|
||||
double precision, allocatable :: I_vec(:,:,:), I_ref(:,:,:), int_fit_v(:)
|
||||
|
||||
double precision, external :: overlap_gauss_r12_ao_with1s
|
||||
|
||||
print *, ' test_vect_overlap_gauss_r12_ao_with1s ...'
|
||||
|
||||
provide mu_erf final_grid_points_transp j1b_pen
|
||||
|
||||
expo_fit = expo_gauss_j_mu_x_2(1)
|
||||
beta = List_all_comb_b3_expo (2)
|
||||
B_center(1) = List_all_comb_b3_cent(1,2)
|
||||
B_center(2) = List_all_comb_b3_cent(2,2)
|
||||
B_center(3) = List_all_comb_b3_cent(3,2)
|
||||
|
||||
! ---
|
||||
|
||||
allocate(int_fit_v(n_points_final_grid))
|
||||
allocate(I_vec(ao_num,ao_num,n_points_final_grid))
|
||||
|
||||
I_vec = 0.d0
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
|
||||
call overlap_gauss_r12_ao_with1s_v(B_center, beta, final_grid_points_transp, n_points_final_grid, expo_fit, i, j, int_fit_v, n_points_final_grid, n_points_final_grid)
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
I_vec(j,i,ipoint) = int_fit_v(ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! ---
|
||||
|
||||
allocate(I_ref(ao_num,ao_num,n_points_final_grid))
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
|
||||
I_ref(j,i,ipoint) = overlap_gauss_r12_ao_with1s(B_center, beta, r, expo_fit, i, j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! ---
|
||||
|
||||
eps_ij = 1d-3
|
||||
acc_tot = 0.d0
|
||||
normalz = 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
i_exc = I_ref(i,j,ipoint)
|
||||
i_num = I_vec(i,j,ipoint)
|
||||
acc_ij = dabs(i_exc - i_num)
|
||||
!acc_ij = dabs(i_exc - i_num) / dabs(i_exc)
|
||||
if(acc_ij .gt. eps_ij) then
|
||||
print *, ' problem in overlap_gauss_r12_ao_v on', i, j, ipoint
|
||||
print *, ' analyt integ = ', i_exc
|
||||
print *, ' numeri integ = ', i_num
|
||||
print *, ' diff = ', acc_ij
|
||||
stop
|
||||
endif
|
||||
|
||||
acc_tot += acc_ij
|
||||
normalz += dabs(i_num)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
print*, ' acc_tot = ', acc_tot
|
||||
print*, ' normalz = ', normalz
|
||||
|
||||
return
|
||||
end subroutine test_vect_overlap_gauss_r12_ao
|
||||
|
437
src/non_h_ints_mu/grad_squared.irp.f
Normal file
437
src/non_h_ints_mu/grad_squared.irp.f
Normal file
@ -0,0 +1,437 @@
|
||||
|
||||
! ---
|
||||
|
||||
! TODO : strong optmization : write the loops in a different way
|
||||
! : for each couple of AO, the gaussian product are done once for all
|
||||
|
||||
BEGIN_PROVIDER [ double precision, gradu_squared_u_ij_mu, (ao_num, ao_num, n_points_final_grid) ]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! if J(r1,r2) = u12:
|
||||
!
|
||||
! gradu_squared_u_ij_mu = -0.50 x \int r2 [ (grad_1 u12)^2 + (grad_2 u12^2)] \phi_i(2) \phi_j(2)
|
||||
! = -0.25 x \int r2 (1 - erf(mu*r12))^2 \phi_i(2) \phi_j(2)
|
||||
! and
|
||||
! (1 - erf(mu*r12))^2 = \sum_i coef_gauss_1_erf_x_2(i) * exp(-expo_gauss_1_erf_x_2(i) * r12^2)
|
||||
!
|
||||
! if J(r1,r2) = u12 x v1 x v2
|
||||
!
|
||||
! gradu_squared_u_ij_mu = -0.50 x \int r2 \phi_i(2) \phi_j(2) [ v1^2 v2^2 ((grad_1 u12)^2 + (grad_2 u12^2)]) + u12^2 v2^2 (grad_1 v1)^2 + 2 u12 v1 v2^2 (grad_1 u12) . (grad_1 v1) ]
|
||||
! = -0.25 x v1^2 \int r2 \phi_i(2) \phi_j(2) [1 - erf(mu r12)]^2 v2^2
|
||||
! + -0.50 x (grad_1 v1)^2 \int r2 \phi_i(2) \phi_j(2) u12^2 v2^2
|
||||
! + -1.00 x v1 (grad_1 v1) \int r2 \phi_i(2) \phi_j(2) (grad_1 u12) v2^2
|
||||
! = v1^2 x int2_grad1u2_grad2u2_j1b2
|
||||
! + -0.5 x (grad_1 v1)^2 x int2_u2_j1b2
|
||||
! + -1.0 X V1 x (grad_1 v1) \cdot [ int2_u_grad1u_j1b2 x r - int2_u_grad1u_x_j1b ]
|
||||
!
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, m, igauss
|
||||
double precision :: x, y, z, r(3), delta, coef
|
||||
double precision :: tmp_v, tmp_x, tmp_y, tmp_z
|
||||
double precision :: tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9
|
||||
double precision :: time0, time1
|
||||
double precision, external :: overlap_gauss_r12_ao
|
||||
|
||||
print*, ' providing gradu_squared_u_ij_mu ...'
|
||||
call wall_time(time0)
|
||||
|
||||
PROVIDE j1b_type
|
||||
|
||||
if(j1b_type .eq. 3) then
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
tmp_v = v_1b (ipoint)
|
||||
tmp_x = v_1b_grad(1,ipoint)
|
||||
tmp_y = v_1b_grad(2,ipoint)
|
||||
tmp_z = v_1b_grad(3,ipoint)
|
||||
|
||||
tmp1 = tmp_v * tmp_v
|
||||
tmp2 = -0.5d0 * (tmp_x * tmp_x + tmp_y * tmp_y + tmp_z * tmp_z)
|
||||
tmp3 = tmp_v * tmp_x
|
||||
tmp4 = tmp_v * tmp_y
|
||||
tmp5 = tmp_v * tmp_z
|
||||
|
||||
tmp6 = -x * tmp3
|
||||
tmp7 = -y * tmp4
|
||||
tmp8 = -z * tmp5
|
||||
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
tmp9 = int2_u_grad1u_j1b2(i,j,ipoint)
|
||||
|
||||
gradu_squared_u_ij_mu(i,j,ipoint) = tmp1 * int2_grad1u2_grad2u2_j1b2(i,j,ipoint) &
|
||||
+ tmp2 * int2_u2_j1b2 (i,j,ipoint) &
|
||||
+ tmp6 * tmp9 + tmp3 * int2_u_grad1u_x_j1b2(i,j,ipoint,1) &
|
||||
+ tmp7 * tmp9 + tmp4 * int2_u_grad1u_x_j1b2(i,j,ipoint,2) &
|
||||
+ tmp8 * tmp9 + tmp5 * int2_u_grad1u_x_j1b2(i,j,ipoint,3)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
gradu_squared_u_ij_mu = 0.d0
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do igauss = 1, n_max_fit_slat
|
||||
delta = expo_gauss_1_erf_x_2(igauss)
|
||||
coef = coef_gauss_1_erf_x_2(igauss)
|
||||
gradu_squared_u_ij_mu(i,j,ipoint) += -0.25d0 * coef * overlap_gauss_r12_ao(r, delta, i, j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
endif
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for gradu_squared_u_ij_mu = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
!BEGIN_PROVIDER [double precision, tc_grad_square_ao_loop, (ao_num, ao_num, ao_num, ao_num)]
|
||||
!
|
||||
! BEGIN_DOC
|
||||
! !
|
||||
! ! tc_grad_square_ao_loop(k,i,l,j) = -1/2 <kl | |\grad_1 u(r1,r2)|^2 + |\grad_1 u(r1,r2)|^2 | ij>
|
||||
! !
|
||||
! END_DOC
|
||||
!
|
||||
! implicit none
|
||||
! integer :: ipoint, i, j, k, l
|
||||
! double precision :: weight1, ao_ik_r, ao_i_r
|
||||
! double precision, allocatable :: ac_mat(:,:,:,:)
|
||||
!
|
||||
! allocate(ac_mat(ao_num,ao_num,ao_num,ao_num))
|
||||
! ac_mat = 0.d0
|
||||
!
|
||||
! do ipoint = 1, n_points_final_grid
|
||||
! weight1 = final_weight_at_r_vector(ipoint)
|
||||
!
|
||||
! do i = 1, ao_num
|
||||
! ao_i_r = weight1 * aos_in_r_array_transp(ipoint,i)
|
||||
!
|
||||
! do k = 1, ao_num
|
||||
! ao_ik_r = ao_i_r * aos_in_r_array_transp(ipoint,k)
|
||||
!
|
||||
! do j = 1, ao_num
|
||||
! do l = 1, ao_num
|
||||
! ac_mat(k,i,l,j) += ao_ik_r * gradu_squared_u_ij_mu(l,j,ipoint)
|
||||
! enddo
|
||||
! enddo
|
||||
! enddo
|
||||
! enddo
|
||||
! enddo
|
||||
!
|
||||
! do j = 1, ao_num
|
||||
! do l = 1, ao_num
|
||||
! do i = 1, ao_num
|
||||
! do k = 1, ao_num
|
||||
! tc_grad_square_ao_loop(k,i,l,j) = ac_mat(k,i,l,j) + ac_mat(l,j,k,i)
|
||||
! !write(11,*) tc_grad_square_ao_loop(k,i,l,j)
|
||||
! enddo
|
||||
! enddo
|
||||
! enddo
|
||||
! enddo
|
||||
!
|
||||
! deallocate(ac_mat)
|
||||
!
|
||||
!END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, tc_grad_square_ao_loop, (ao_num, ao_num, ao_num, ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! tc_grad_square_ao_loop(k,i,l,j) = 1/2 <kl | |\grad_1 u(r1,r2)|^2 + |\grad_2 u(r1,r2)|^2 | ij>
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, k, l
|
||||
double precision :: weight1, ao_ik_r, ao_i_r
|
||||
double precision :: time0, time1
|
||||
double precision, allocatable :: ac_mat(:,:,:,:), bc_mat(:,:,:,:)
|
||||
|
||||
print*, ' providing tc_grad_square_ao_loop ...'
|
||||
call wall_time(time0)
|
||||
|
||||
allocate(ac_mat(ao_num,ao_num,ao_num,ao_num))
|
||||
ac_mat = 0.d0
|
||||
allocate(bc_mat(ao_num,ao_num,ao_num,ao_num))
|
||||
bc_mat = 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
weight1 = final_weight_at_r_vector(ipoint)
|
||||
|
||||
do i = 1, ao_num
|
||||
!ao_i_r = weight1 * aos_in_r_array_transp(ipoint,i)
|
||||
ao_i_r = weight1 * aos_in_r_array(i,ipoint)
|
||||
|
||||
do k = 1, ao_num
|
||||
!ao_ik_r = ao_i_r * aos_in_r_array_transp(ipoint,k)
|
||||
ao_ik_r = ao_i_r * aos_in_r_array(k,ipoint)
|
||||
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
ac_mat(k,i,l,j) += ao_ik_r * ( u12sq_j1bsq(l,j,ipoint) + u12_grad1_u12_j1b_grad1_j1b(l,j,ipoint) )
|
||||
bc_mat(k,i,l,j) += ao_ik_r * grad12_j12(l,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
tc_grad_square_ao_loop(k,i,l,j) = ac_mat(k,i,l,j) + ac_mat(l,j,k,i) + bc_mat(k,i,l,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
deallocate(ac_mat)
|
||||
deallocate(bc_mat)
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for tc_grad_square_ao_loop = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, grad12_j12, (ao_num, ao_num, n_points_final_grid) ]
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, m, igauss
|
||||
double precision :: r(3), delta, coef
|
||||
double precision :: tmp1
|
||||
double precision :: time0, time1
|
||||
double precision, external :: overlap_gauss_r12_ao
|
||||
|
||||
print*, ' providing grad12_j12 ...'
|
||||
call wall_time(time0)
|
||||
|
||||
PROVIDE j1b_type
|
||||
|
||||
if(j1b_type .eq. 3) then
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
tmp1 = v_1b(ipoint)
|
||||
tmp1 = tmp1 * tmp1
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
grad12_j12(i,j,ipoint) = tmp1 * int2_grad1u2_grad2u2_j1b2(i,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
grad12_j12 = 0.d0
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do igauss = 1, n_max_fit_slat
|
||||
delta = expo_gauss_1_erf_x_2(igauss)
|
||||
coef = coef_gauss_1_erf_x_2(igauss)
|
||||
grad12_j12(i,j,ipoint) += -0.25d0 * coef * overlap_gauss_r12_ao(r, delta, i, j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
endif
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for grad12_j12 = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, u12sq_j1bsq, (ao_num, ao_num, n_points_final_grid) ]
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j
|
||||
double precision :: tmp_x, tmp_y, tmp_z
|
||||
double precision :: tmp1
|
||||
double precision :: time0, time1
|
||||
|
||||
print*, ' providing u12sq_j1bsq ...'
|
||||
call wall_time(time0)
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
tmp_x = v_1b_grad(1,ipoint)
|
||||
tmp_y = v_1b_grad(2,ipoint)
|
||||
tmp_z = v_1b_grad(3,ipoint)
|
||||
tmp1 = -0.5d0 * (tmp_x * tmp_x + tmp_y * tmp_y + tmp_z * tmp_z)
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
u12sq_j1bsq(i,j,ipoint) = tmp1 * int2_u2_j1b2(i,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for u12sq_j1bsq = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, u12_grad1_u12_j1b_grad1_j1b, (ao_num, ao_num, n_points_final_grid) ]
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, m, igauss
|
||||
double precision :: x, y, z
|
||||
double precision :: tmp_v, tmp_x, tmp_y, tmp_z
|
||||
double precision :: tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9
|
||||
double precision :: time0, time1
|
||||
double precision, external :: overlap_gauss_r12_ao
|
||||
|
||||
print*, ' providing u12_grad1_u12_j1b_grad1_j1b ...'
|
||||
call wall_time(time0)
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
tmp_v = v_1b (ipoint)
|
||||
tmp_x = v_1b_grad(1,ipoint)
|
||||
tmp_y = v_1b_grad(2,ipoint)
|
||||
tmp_z = v_1b_grad(3,ipoint)
|
||||
|
||||
tmp3 = tmp_v * tmp_x
|
||||
tmp4 = tmp_v * tmp_y
|
||||
tmp5 = tmp_v * tmp_z
|
||||
|
||||
tmp6 = -x * tmp3
|
||||
tmp7 = -y * tmp4
|
||||
tmp8 = -z * tmp5
|
||||
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
tmp9 = int2_u_grad1u_j1b2(i,j,ipoint)
|
||||
|
||||
u12_grad1_u12_j1b_grad1_j1b(i,j,ipoint) = tmp6 * tmp9 + tmp3 * int2_u_grad1u_x_j1b2(i,j,ipoint,1) &
|
||||
+ tmp7 * tmp9 + tmp4 * int2_u_grad1u_x_j1b2(i,j,ipoint,2) &
|
||||
+ tmp8 * tmp9 + tmp5 * int2_u_grad1u_x_j1b2(i,j,ipoint,3)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for u12_grad1_u12_j1b_grad1_j1b = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, tc_grad_square_ao, (ao_num, ao_num, ao_num, ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! tc_grad_square_ao(k,i,l,j) = 1/2 <kl | |\grad_1 u(r1,r2)|^2 + |\grad_2 u(r1,r2)|^2 | ij>
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, k, l
|
||||
double precision :: weight1, ao_ik_r, ao_i_r
|
||||
double precision :: time0, time1
|
||||
double precision, allocatable :: ac_mat(:,:,:,:), b_mat(:,:,:), tmp(:,:,:)
|
||||
|
||||
print*, ' providing tc_grad_square_ao ...'
|
||||
call wall_time(time0)
|
||||
|
||||
allocate(ac_mat(ao_num,ao_num,ao_num,ao_num), b_mat(n_points_final_grid,ao_num,ao_num), tmp(ao_num,ao_num,n_points_final_grid))
|
||||
|
||||
b_mat = 0.d0
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, k, ipoint) &
|
||||
!$OMP SHARED (aos_in_r_array_transp, b_mat, ao_num, n_points_final_grid, final_weight_at_r_vector)
|
||||
!$OMP DO SCHEDULE (static)
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
do ipoint = 1, n_points_final_grid
|
||||
b_mat(ipoint,k,i) = final_weight_at_r_vector(ipoint) * aos_in_r_array_transp(ipoint,i) * aos_in_r_array_transp(ipoint,k)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
tmp = 0.d0
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (j, l, ipoint) &
|
||||
!$OMP SHARED (tmp, ao_num, n_points_final_grid, u12sq_j1bsq, u12_grad1_u12_j1b_grad1_j1b, grad12_j12)
|
||||
!$OMP DO SCHEDULE (static)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
tmp(l,j,ipoint) = u12sq_j1bsq(l,j,ipoint) + u12_grad1_u12_j1b_grad1_j1b(l,j,ipoint) + 0.5d0 * grad12_j12(l,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
|
||||
ac_mat = 0.d0
|
||||
call dgemm( "N", "N", ao_num*ao_num, ao_num*ao_num, n_points_final_grid, 1.d0 &
|
||||
, tmp(1,1,1), ao_num*ao_num, b_mat(1,1,1), n_points_final_grid &
|
||||
, 1.d0, ac_mat, ao_num*ao_num)
|
||||
deallocate(tmp, b_mat)
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k, l) &
|
||||
!$OMP SHARED (ac_mat, tc_grad_square_ao, ao_num)
|
||||
!$OMP DO SCHEDULE (static)
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
tc_grad_square_ao(k,i,l,j) = ac_mat(k,i,l,j) + ac_mat(l,j,k,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
deallocate(ac_mat)
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for tc_grad_square_ao = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
221
src/non_h_ints_mu/grad_squared_manu.irp.f
Normal file
221
src/non_h_ints_mu/grad_squared_manu.irp.f
Normal file
@ -0,0 +1,221 @@
|
||||
|
||||
BEGIN_PROVIDER [double precision, tc_grad_square_ao_test, (ao_num, ao_num, ao_num, ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! tc_grad_square_ao_test(k,i,l,j) = -1/2 <kl | |\grad_1 u(r1,r2)|^2 + |\grad_1 u(r1,r2)|^2 | ij>
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, k, l
|
||||
double precision :: weight1, ao_ik_r, ao_i_r,contrib,contrib2
|
||||
double precision :: time0, time1
|
||||
double precision, allocatable :: ac_mat(:,:,:,:), b_mat(:,:,:), tmp(:,:,:)
|
||||
|
||||
print*, ' providing tc_grad_square_ao_test ...'
|
||||
call wall_time(time0)
|
||||
|
||||
provide u12sq_j1bsq_test u12_grad1_u12_j1b_grad1_j1b_test grad12_j12_test
|
||||
|
||||
allocate(ac_mat(ao_num,ao_num,ao_num,ao_num), b_mat(n_points_final_grid,ao_num,ao_num), tmp(ao_num,ao_num,n_points_final_grid))
|
||||
|
||||
b_mat = 0.d0
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, k, ipoint) &
|
||||
!$OMP SHARED (aos_in_r_array_transp, b_mat, ao_num, n_points_final_grid, final_weight_at_r_vector)
|
||||
!$OMP DO SCHEDULE (static)
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
do ipoint = 1, n_points_final_grid
|
||||
b_mat(ipoint,k,i) = final_weight_at_r_vector(ipoint) * aos_in_r_array_transp(ipoint,i) * aos_in_r_array_transp(ipoint,k)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
tmp = 0.d0
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (j, l, ipoint) &
|
||||
!$OMP SHARED (tmp, ao_num, n_points_final_grid, u12sq_j1bsq_test, u12_grad1_u12_j1b_grad1_j1b_test, grad12_j12_test)
|
||||
!$OMP DO SCHEDULE (static)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
tmp(l,j,ipoint) = u12sq_j1bsq_test(l,j,ipoint) + u12_grad1_u12_j1b_grad1_j1b_test(l,j,ipoint) + 0.5d0 * grad12_j12_test(l,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
ac_mat = 0.d0
|
||||
call dgemm( "N", "N", ao_num*ao_num, ao_num*ao_num, n_points_final_grid, 1.d0 &
|
||||
, tmp(1,1,1), ao_num*ao_num, b_mat(1,1,1), n_points_final_grid &
|
||||
, 1.d0, ac_mat, ao_num*ao_num)
|
||||
deallocate(tmp, b_mat)
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k, l) &
|
||||
!$OMP SHARED (ac_mat, tc_grad_square_ao_test, ao_num)
|
||||
!$OMP DO SCHEDULE (static)
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
tc_grad_square_ao_test(k,i,l,j) = ac_mat(k,i,l,j) + ac_mat(l,j,k,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
deallocate(ac_mat)
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for tc_grad_square_ao_test = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, u12sq_j1bsq_test, (ao_num, ao_num, n_points_final_grid) ]
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j
|
||||
double precision :: tmp_x, tmp_y, tmp_z
|
||||
double precision :: tmp1
|
||||
double precision :: time0, time1
|
||||
|
||||
print*, ' providing u12sq_j1bsq_test ...'
|
||||
call wall_time(time0)
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
tmp_x = v_1b_grad(1,ipoint)
|
||||
tmp_y = v_1b_grad(2,ipoint)
|
||||
tmp_z = v_1b_grad(3,ipoint)
|
||||
tmp1 = -0.5d0 * (tmp_x * tmp_x + tmp_y * tmp_y + tmp_z * tmp_z)
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
u12sq_j1bsq_test(i,j,ipoint) = tmp1 * int2_u2_j1b2_test(i,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for u12sq_j1bsq_test = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, u12_grad1_u12_j1b_grad1_j1b_test, (ao_num, ao_num, n_points_final_grid) ]
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, m, igauss
|
||||
double precision :: x, y, z
|
||||
double precision :: tmp_v, tmp_x, tmp_y, tmp_z
|
||||
double precision :: tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9
|
||||
double precision :: time0, time1
|
||||
double precision, external :: overlap_gauss_r12_ao
|
||||
|
||||
print*, ' providing u12_grad1_u12_j1b_grad1_j1b_test ...'
|
||||
|
||||
provide int2_u_grad1u_x_j1b2_test
|
||||
call wall_time(time0)
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
tmp_v = v_1b (ipoint)
|
||||
tmp_x = v_1b_grad(1,ipoint)
|
||||
tmp_y = v_1b_grad(2,ipoint)
|
||||
tmp_z = v_1b_grad(3,ipoint)
|
||||
|
||||
tmp3 = tmp_v * tmp_x
|
||||
tmp4 = tmp_v * tmp_y
|
||||
tmp5 = tmp_v * tmp_z
|
||||
|
||||
tmp6 = -x * tmp3
|
||||
tmp7 = -y * tmp4
|
||||
tmp8 = -z * tmp5
|
||||
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
tmp9 = int2_u_grad1u_j1b2_test(i,j,ipoint)
|
||||
|
||||
u12_grad1_u12_j1b_grad1_j1b_test(i,j,ipoint) = tmp6 * tmp9 + tmp3 * int2_u_grad1u_x_j1b2_test(i,j,ipoint,1) &
|
||||
+ tmp7 * tmp9 + tmp4 * int2_u_grad1u_x_j1b2_test(i,j,ipoint,2) &
|
||||
+ tmp8 * tmp9 + tmp5 * int2_u_grad1u_x_j1b2_test(i,j,ipoint,3)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for u12_grad1_u12_j1b_grad1_j1b_test = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, grad12_j12_test, (ao_num, ao_num, n_points_final_grid) ]
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, m, igauss
|
||||
double precision :: r(3), delta, coef
|
||||
double precision :: tmp1
|
||||
double precision :: time0, time1
|
||||
double precision, external :: overlap_gauss_r12_ao
|
||||
provide int2_grad1u2_grad2u2_j1b2_test
|
||||
print*, ' providing grad12_j12_test ...'
|
||||
call wall_time(time0)
|
||||
|
||||
PROVIDE j1b_type
|
||||
|
||||
if(j1b_type .eq. 3) then
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
tmp1 = v_1b(ipoint)
|
||||
tmp1 = tmp1 * tmp1
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
grad12_j12_test(i,j,ipoint) = tmp1 * int2_grad1u2_grad2u2_j1b2_test(i,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
grad12_j12_test = 0.d0
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do igauss = 1, n_max_fit_slat
|
||||
delta = expo_gauss_1_erf_x_2(igauss)
|
||||
coef = coef_gauss_1_erf_x_2(igauss)
|
||||
grad12_j12_test(i,j,ipoint) += -0.25d0 * coef * overlap_gauss_r12_ao(r, delta, i, j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
endif
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for grad12_j12_test = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
217
src/non_h_ints_mu/grad_tc_int.irp.f
Normal file
217
src/non_h_ints_mu/grad_tc_int.irp.f
Normal file
@ -0,0 +1,217 @@
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, ao_non_hermit_term_chemist, (ao_num, ao_num, ao_num, ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
! 1 1 2 2 1 2 1 2
|
||||
!
|
||||
! ao_non_hermit_term_chemist(k,i,l,j) = < k l | [erf( mu r12) - 1] d/d_r12 | i j > on the AO basis
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, l, ipoint, m
|
||||
double precision :: weight1, r(3)
|
||||
double precision :: wall1, wall0
|
||||
double precision, allocatable :: b_mat(:,:,:,:), ac_mat(:,:,:,:)
|
||||
|
||||
provide v_ij_erf_rk_cst_mu x_v_ij_erf_rk_cst_mu
|
||||
|
||||
call wall_time(wall0)
|
||||
allocate(b_mat(n_points_final_grid,ao_num,ao_num,3), ac_mat(ao_num,ao_num,ao_num,ao_num))
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,k,m,ipoint,r,weight1) &
|
||||
!$OMP SHARED (aos_in_r_array_transp,aos_grad_in_r_array_transp_bis,b_mat)&
|
||||
!$OMP SHARED (ao_num,n_points_final_grid,final_grid_points,final_weight_at_r_vector)
|
||||
!$OMP DO SCHEDULE (static)
|
||||
do m = 1, 3
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
weight1 = final_weight_at_r_vector(ipoint)
|
||||
b_mat(ipoint,k,i,m) = 0.5d0 * aos_in_r_array_transp(ipoint,k) * r(m) * weight1 * aos_grad_in_r_array_transp_bis(ipoint,i,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
! (A) b_mat(ipoint,k,i,m) X v_ij_erf_rk_cst_mu(j,l,r1)
|
||||
! 1/2 \int dr1 x1 phi_k(1) d/dx1 phi_i(1) \int dr2 (1 - erf(mu_r12))/r12 phi_j(2) phi_l(2)
|
||||
ac_mat = 0.d0
|
||||
do m = 1, 3
|
||||
! A B^T dim(A,1) dim(B,2) dim(A,2) alpha * A LDA
|
||||
|
||||
call dgemm( "N", "N", ao_num*ao_num, ao_num*ao_num, n_points_final_grid, 1.d0 &
|
||||
, v_ij_erf_rk_cst_mu(1,1,1), ao_num*ao_num, b_mat(1,1,1,m), n_points_final_grid &
|
||||
, 1.d0, ac_mat, ao_num*ao_num)
|
||||
|
||||
enddo
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,k,m,ipoint,weight1) &
|
||||
!$OMP SHARED (aos_in_r_array_transp,aos_grad_in_r_array_transp_bis,b_mat,ao_num,n_points_final_grid,final_weight_at_r_vector)
|
||||
!$OMP DO SCHEDULE (static)
|
||||
do m = 1, 3
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
do ipoint = 1, n_points_final_grid
|
||||
weight1 = final_weight_at_r_vector(ipoint)
|
||||
b_mat(ipoint,k,i,m) = 0.5d0 * aos_in_r_array_transp(ipoint,k) * weight1 * aos_grad_in_r_array_transp_bis(ipoint,i,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
! (B) b_mat(ipoint,k,i,m) X x_v_ij_erf_rk_cst_mu(j,l,r1,m)
|
||||
! 1/2 \int dr1 phi_k(1) d/dx1 phi_i(1) \int dr2 x2(1 - erf(mu_r12))/r12 phi_j(2) phi_l(2)
|
||||
do m = 1, 3
|
||||
! A B^T dim(A,1) dim(B,2) dim(A,2) alpha * A LDA
|
||||
|
||||
call dgemm( "N", "N", ao_num*ao_num, ao_num*ao_num, n_points_final_grid, -1.d0 &
|
||||
, x_v_ij_erf_rk_cst_mu(1,1,1,m), ao_num*ao_num, b_mat(1,1,1,m), n_points_final_grid &
|
||||
, 1.d0, ac_mat, ao_num*ao_num)
|
||||
enddo
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,k,j,l) &
|
||||
!$OMP SHARED (ac_mat,ao_non_hermit_term_chemist,ao_num)
|
||||
!$OMP DO SCHEDULE (static)
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
! (ki|lj) (ki|lj) (lj|ki)
|
||||
ao_non_hermit_term_chemist(k,i,l,j) = ac_mat(k,i,l,j) + ac_mat(l,j,k,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time dgemm ', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
! TODO :: optimization :: transform into DGEM
|
||||
|
||||
BEGIN_PROVIDER [double precision, mo_non_hermit_term_chemist, (mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
! 1 1 2 2 1 2 1 2
|
||||
!
|
||||
! mo_non_hermit_term_chemist(k,i,l,j) = < k l | [erf( mu r12) - 1] d/d_r12 | i j > on the MO basis
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, l, m, n, p, q
|
||||
double precision, allocatable :: mo_tmp_1(:,:,:,:), mo_tmp_2(:,:,:,:)
|
||||
|
||||
allocate(mo_tmp_1(mo_num,ao_num,ao_num,ao_num))
|
||||
mo_tmp_1 = 0.d0
|
||||
|
||||
do m = 1, ao_num
|
||||
do p = 1, ao_num
|
||||
do n = 1, ao_num
|
||||
do q = 1, ao_num
|
||||
do k = 1, mo_num
|
||||
! (k n|p m) = sum_q c_qk * (q n|p m)
|
||||
mo_tmp_1(k,n,p,m) += mo_coef_transp(k,q) * ao_non_hermit_term_chemist(q,n,p,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
free ao_non_hermit_term_chemist
|
||||
|
||||
allocate(mo_tmp_2(mo_num,mo_num,ao_num,ao_num))
|
||||
mo_tmp_2 = 0.d0
|
||||
|
||||
do m = 1, ao_num
|
||||
do p = 1, ao_num
|
||||
do n = 1, ao_num
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
! (k i|p m) = sum_n c_ni * (k n|p m)
|
||||
mo_tmp_2(k,i,p,m) += mo_coef_transp(i,n) * mo_tmp_1(k,n,p,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
deallocate(mo_tmp_1)
|
||||
|
||||
allocate(mo_tmp_1(mo_num,mo_num,mo_num,ao_num))
|
||||
mo_tmp_1 = 0.d0
|
||||
|
||||
do m = 1, ao_num
|
||||
do p = 1, ao_num
|
||||
do l = 1, mo_num
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
mo_tmp_1(k,i,l,m) += mo_coef_transp(l,p) * mo_tmp_2(k,i,p,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
deallocate(mo_tmp_2)
|
||||
|
||||
mo_non_hermit_term_chemist = 0.d0
|
||||
do m = 1, ao_num
|
||||
do j = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
mo_non_hermit_term_chemist(k,i,l,j) += mo_coef_transp(j,m) * mo_tmp_1(k,i,l,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
deallocate(mo_tmp_1)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, mo_non_hermit_term, (mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
! 1 2 1 2 1 2 1 2
|
||||
!
|
||||
! mo_non_hermit_term(k,l,i,j) = < k l | [erf( mu r12) - 1] d/d_r12 | i j > on the MO basis
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, l
|
||||
|
||||
do j = 1, mo_num
|
||||
do i = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
mo_non_hermit_term(k,l,i,j) = mo_non_hermit_term_chemist(k,i,l,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
640
src/non_h_ints_mu/j12_nucl_utils.irp.f
Normal file
640
src/non_h_ints_mu/j12_nucl_utils.irp.f
Normal file
@ -0,0 +1,640 @@
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, v_1b, (n_points_final_grid)]
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, phase
|
||||
double precision :: x, y, z, dx, dy, dz
|
||||
double precision :: a, d, e, fact_r
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
|
||||
fact_r = 1.d0
|
||||
do j = 1, nucl_num
|
||||
a = j1b_pen(j)
|
||||
dx = x - nucl_coord(j,1)
|
||||
dy = y - nucl_coord(j,2)
|
||||
dz = z - nucl_coord(j,3)
|
||||
d = dx*dx + dy*dy + dz*dz
|
||||
e = 1.d0 - dexp(-a*d)
|
||||
|
||||
fact_r = fact_r * e
|
||||
enddo
|
||||
|
||||
v_1b(ipoint) = fact_r
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, v_1b_grad, (3, n_points_final_grid)]
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, phase
|
||||
double precision :: x, y, z, dx, dy, dz
|
||||
double precision :: a, d, e
|
||||
double precision :: fact_x, fact_y, fact_z
|
||||
double precision :: ax_der, ay_der, az_der, a_expo
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
|
||||
fact_x = 0.d0
|
||||
fact_y = 0.d0
|
||||
fact_z = 0.d0
|
||||
do i = 1, List_all_comb_b2_size
|
||||
|
||||
phase = 0
|
||||
a_expo = 0.d0
|
||||
ax_der = 0.d0
|
||||
ay_der = 0.d0
|
||||
az_der = 0.d0
|
||||
do j = 1, nucl_num
|
||||
a = dble(List_all_comb_b2(j,i)) * j1b_pen(j)
|
||||
dx = x - nucl_coord(j,1)
|
||||
dy = y - nucl_coord(j,2)
|
||||
dz = z - nucl_coord(j,3)
|
||||
|
||||
phase += List_all_comb_b2(j,i)
|
||||
a_expo += a * (dx*dx + dy*dy + dz*dz)
|
||||
ax_der += a * dx
|
||||
ay_der += a * dy
|
||||
az_der += a * dz
|
||||
enddo
|
||||
e = -2.d0 * (-1.d0)**dble(phase) * dexp(-a_expo)
|
||||
|
||||
fact_x += e * ax_der
|
||||
fact_y += e * ay_der
|
||||
fact_z += e * az_der
|
||||
enddo
|
||||
|
||||
v_1b_grad(1,ipoint) = fact_x
|
||||
v_1b_grad(2,ipoint) = fact_y
|
||||
v_1b_grad(3,ipoint) = fact_z
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, v_1b_lapl, (n_points_final_grid)]
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, phase
|
||||
double precision :: x, y, z, dx, dy, dz
|
||||
double precision :: a, d, e, b
|
||||
double precision :: fact_r
|
||||
double precision :: ax_der, ay_der, az_der, a_expo
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
|
||||
fact_r = 0.d0
|
||||
do i = 1, List_all_comb_b2_size
|
||||
|
||||
phase = 0
|
||||
b = 0.d0
|
||||
a_expo = 0.d0
|
||||
ax_der = 0.d0
|
||||
ay_der = 0.d0
|
||||
az_der = 0.d0
|
||||
do j = 1, nucl_num
|
||||
a = dble(List_all_comb_b2(j,i)) * j1b_pen(j)
|
||||
dx = x - nucl_coord(j,1)
|
||||
dy = y - nucl_coord(j,2)
|
||||
dz = z - nucl_coord(j,3)
|
||||
|
||||
phase += List_all_comb_b2(j,i)
|
||||
b += a
|
||||
a_expo += a * (dx*dx + dy*dy + dz*dz)
|
||||
ax_der += a * dx
|
||||
ay_der += a * dy
|
||||
az_der += a * dz
|
||||
enddo
|
||||
|
||||
fact_r += (-1.d0)**dble(phase) * (-6.d0*b + 4.d0*(ax_der*ax_der + ay_der*ay_der + az_der*az_der) ) * dexp(-a_expo)
|
||||
enddo
|
||||
|
||||
v_1b_lapl(ipoint) = fact_r
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, v_1b_list_b2, (n_points_final_grid)]
|
||||
|
||||
implicit none
|
||||
integer :: i, ipoint
|
||||
double precision :: x, y, z, coef, expo, dx, dy, dz
|
||||
double precision :: fact_r
|
||||
|
||||
PROVIDE List_all_comb_b2_coef List_all_comb_b2_expo List_all_comb_b2_cent
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
|
||||
fact_r = 0.d0
|
||||
do i = 1, List_all_comb_b2_size
|
||||
|
||||
coef = List_all_comb_b2_coef(i)
|
||||
expo = List_all_comb_b2_expo(i)
|
||||
|
||||
dx = x - List_all_comb_b2_cent(1,i)
|
||||
dy = y - List_all_comb_b2_cent(2,i)
|
||||
dz = z - List_all_comb_b2_cent(3,i)
|
||||
|
||||
fact_r += coef * dexp(-expo * (dx*dx + dy*dy + dz*dz))
|
||||
enddo
|
||||
|
||||
v_1b_list_b2(ipoint) = fact_r
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, v_1b_list_b3, (n_points_final_grid)]
|
||||
|
||||
implicit none
|
||||
integer :: i, ipoint
|
||||
double precision :: x, y, z, coef, expo, dx, dy, dz
|
||||
double precision :: fact_r
|
||||
|
||||
PROVIDE List_all_comb_b3_coef List_all_comb_b3_expo List_all_comb_b3_cent
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
|
||||
fact_r = 0.d0
|
||||
do i = 1, List_all_comb_b3_size
|
||||
|
||||
coef = List_all_comb_b3_coef(i)
|
||||
expo = List_all_comb_b3_expo(i)
|
||||
|
||||
dx = x - List_all_comb_b3_cent(1,i)
|
||||
dy = y - List_all_comb_b3_cent(2,i)
|
||||
dz = z - List_all_comb_b3_cent(3,i)
|
||||
|
||||
fact_r += coef * dexp(-expo * (dx*dx + dy*dy + dz*dz))
|
||||
enddo
|
||||
|
||||
v_1b_list_b3(ipoint) = fact_r
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
double precision function jmu_modif(r1, r2)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r1(3), r2(3)
|
||||
double precision, external :: j12_mu, j12_nucl
|
||||
|
||||
jmu_modif = j12_mu(r1, r2) * j12_nucl(r1, r2)
|
||||
|
||||
return
|
||||
end function jmu_modif
|
||||
|
||||
! ---
|
||||
|
||||
double precision function j12_mu(r1, r2)
|
||||
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r1(3), r2(3)
|
||||
double precision :: mu_r12, r12
|
||||
|
||||
r12 = dsqrt( (r1(1) - r2(1)) * (r1(1) - r2(1)) &
|
||||
+ (r1(2) - r2(2)) * (r1(2) - r2(2)) &
|
||||
+ (r1(3) - r2(3)) * (r1(3) - r2(3)) )
|
||||
mu_r12 = mu_erf * r12
|
||||
|
||||
j12_mu = 0.5d0 * r12 * (1.d0 - derf(mu_r12)) - inv_sq_pi_2 * dexp(-mu_r12*mu_r12) / mu_erf
|
||||
|
||||
return
|
||||
end function j12_mu
|
||||
|
||||
! ---
|
||||
|
||||
double precision function j12_mu_r12(r12)
|
||||
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r12
|
||||
double precision :: mu_r12
|
||||
|
||||
mu_r12 = mu_erf * r12
|
||||
|
||||
j12_mu_r12 = 0.5d0 * r12 * (1.d0 - derf(mu_r12)) - inv_sq_pi_2 * dexp(-mu_r12*mu_r12) / mu_erf
|
||||
|
||||
return
|
||||
end function j12_mu_r12
|
||||
|
||||
! ---
|
||||
|
||||
double precision function j12_mu_gauss(r1, r2)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r1(3), r2(3)
|
||||
integer :: i
|
||||
double precision :: r12, coef, expo
|
||||
|
||||
r12 = (r1(1) - r2(1)) * (r1(1) - r2(1)) &
|
||||
+ (r1(2) - r2(2)) * (r1(2) - r2(2)) &
|
||||
+ (r1(3) - r2(3)) * (r1(3) - r2(3))
|
||||
|
||||
j12_mu_gauss = 0.d0
|
||||
do i = 1, n_max_fit_slat
|
||||
expo = expo_gauss_j_mu_x(i)
|
||||
coef = coef_gauss_j_mu_x(i)
|
||||
|
||||
j12_mu_gauss += coef * dexp(-expo*r12)
|
||||
enddo
|
||||
|
||||
return
|
||||
end function j12_mu_gauss
|
||||
|
||||
! ---
|
||||
|
||||
double precision function j1b_nucl(r)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r(3)
|
||||
integer :: i
|
||||
double precision :: a, d, e
|
||||
|
||||
j1b_nucl = 1.d0
|
||||
|
||||
do i = 1, nucl_num
|
||||
a = j1b_pen(i)
|
||||
d = ( (r(1) - nucl_coord(i,1)) * (r(1) - nucl_coord(i,1)) &
|
||||
+ (r(2) - nucl_coord(i,2)) * (r(2) - nucl_coord(i,2)) &
|
||||
+ (r(3) - nucl_coord(i,3)) * (r(3) - nucl_coord(i,3)) )
|
||||
e = 1.d0 - exp(-a*d)
|
||||
|
||||
j1b_nucl = j1b_nucl * e
|
||||
enddo
|
||||
|
||||
return
|
||||
end function j1b_nucl
|
||||
|
||||
! ---
|
||||
|
||||
double precision function j12_nucl(r1, r2)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r1(3), r2(3)
|
||||
double precision, external :: j1b_nucl
|
||||
|
||||
j12_nucl = j1b_nucl(r1) * j1b_nucl(r2)
|
||||
|
||||
return
|
||||
end function j12_nucl
|
||||
|
||||
! ---
|
||||
|
||||
! ---------------------------------------------------------------------------------------
|
||||
|
||||
double precision function grad_x_j1b_nucl(r)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r(3)
|
||||
double precision :: r_eps(3), eps, fp, fm, delta
|
||||
double precision, external :: j1b_nucl
|
||||
|
||||
eps = 1d-6
|
||||
r_eps = r
|
||||
delta = max(eps, dabs(eps*r(1)))
|
||||
|
||||
r_eps(1) = r_eps(1) + delta
|
||||
fp = j1b_nucl(r_eps)
|
||||
r_eps(1) = r_eps(1) - 2.d0 * delta
|
||||
fm = j1b_nucl(r_eps)
|
||||
|
||||
grad_x_j1b_nucl = 0.5d0 * (fp - fm) / delta
|
||||
|
||||
return
|
||||
end function grad_x_j1b_nucl
|
||||
|
||||
double precision function grad_y_j1b_nucl(r)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r(3)
|
||||
double precision :: r_eps(3), eps, fp, fm, delta
|
||||
double precision, external :: j1b_nucl
|
||||
|
||||
eps = 1d-6
|
||||
r_eps = r
|
||||
delta = max(eps, dabs(eps*r(2)))
|
||||
|
||||
r_eps(2) = r_eps(2) + delta
|
||||
fp = j1b_nucl(r_eps)
|
||||
r_eps(2) = r_eps(2) - 2.d0 * delta
|
||||
fm = j1b_nucl(r_eps)
|
||||
|
||||
grad_y_j1b_nucl = 0.5d0 * (fp - fm) / delta
|
||||
|
||||
return
|
||||
end function grad_y_j1b_nucl
|
||||
|
||||
double precision function grad_z_j1b_nucl(r)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r(3)
|
||||
double precision :: r_eps(3), eps, fp, fm, delta
|
||||
double precision, external :: j1b_nucl
|
||||
|
||||
eps = 1d-6
|
||||
r_eps = r
|
||||
delta = max(eps, dabs(eps*r(3)))
|
||||
|
||||
r_eps(3) = r_eps(3) + delta
|
||||
fp = j1b_nucl(r_eps)
|
||||
r_eps(3) = r_eps(3) - 2.d0 * delta
|
||||
fm = j1b_nucl(r_eps)
|
||||
|
||||
grad_z_j1b_nucl = 0.5d0 * (fp - fm) / delta
|
||||
|
||||
return
|
||||
end function grad_z_j1b_nucl
|
||||
|
||||
! ---------------------------------------------------------------------------------------
|
||||
|
||||
! ---
|
||||
|
||||
double precision function lapl_j1b_nucl(r)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r(3)
|
||||
double precision :: r_eps(3), eps, fp, fm, delta
|
||||
double precision, external :: grad_x_j1b_nucl
|
||||
double precision, external :: grad_y_j1b_nucl
|
||||
double precision, external :: grad_z_j1b_nucl
|
||||
|
||||
eps = 1d-5
|
||||
r_eps = r
|
||||
|
||||
lapl_j1b_nucl = 0.d0
|
||||
|
||||
! ---
|
||||
|
||||
delta = max(eps, dabs(eps*r(1)))
|
||||
r_eps(1) = r_eps(1) + delta
|
||||
fp = grad_x_j1b_nucl(r_eps)
|
||||
r_eps(1) = r_eps(1) - 2.d0 * delta
|
||||
fm = grad_x_j1b_nucl(r_eps)
|
||||
r_eps(1) = r_eps(1) + delta
|
||||
|
||||
lapl_j1b_nucl += 0.5d0 * (fp - fm) / delta
|
||||
|
||||
! ---
|
||||
|
||||
delta = max(eps, dabs(eps*r(2)))
|
||||
r_eps(2) = r_eps(2) + delta
|
||||
fp = grad_y_j1b_nucl(r_eps)
|
||||
r_eps(2) = r_eps(2) - 2.d0 * delta
|
||||
fm = grad_y_j1b_nucl(r_eps)
|
||||
r_eps(2) = r_eps(2) + delta
|
||||
|
||||
lapl_j1b_nucl += 0.5d0 * (fp - fm) / delta
|
||||
|
||||
! ---
|
||||
|
||||
delta = max(eps, dabs(eps*r(3)))
|
||||
r_eps(3) = r_eps(3) + delta
|
||||
fp = grad_z_j1b_nucl(r_eps)
|
||||
r_eps(3) = r_eps(3) - 2.d0 * delta
|
||||
fm = grad_z_j1b_nucl(r_eps)
|
||||
r_eps(3) = r_eps(3) + delta
|
||||
|
||||
lapl_j1b_nucl += 0.5d0 * (fp - fm) / delta
|
||||
|
||||
! ---
|
||||
|
||||
return
|
||||
end function lapl_j1b_nucl
|
||||
|
||||
! ---
|
||||
|
||||
! ---------------------------------------------------------------------------------------
|
||||
|
||||
double precision function grad1_x_jmu_modif(r1, r2)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r1(3), r2(3)
|
||||
double precision :: r1_eps(3), eps, fp, fm, delta
|
||||
double precision, external :: jmu_modif
|
||||
|
||||
eps = 1d-7
|
||||
r1_eps = r1
|
||||
delta = max(eps, dabs(eps*r1(1)))
|
||||
|
||||
r1_eps(1) = r1_eps(1) + delta
|
||||
fp = jmu_modif(r1_eps, r2)
|
||||
r1_eps(1) = r1_eps(1) - 2.d0 * delta
|
||||
fm = jmu_modif(r1_eps, r2)
|
||||
|
||||
grad1_x_jmu_modif = 0.5d0 * (fp - fm) / delta
|
||||
|
||||
return
|
||||
end function grad1_x_jmu_modif
|
||||
|
||||
double precision function grad1_y_jmu_modif(r1, r2)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r1(3), r2(3)
|
||||
double precision :: r1_eps(3), eps, fp, fm, delta
|
||||
double precision, external :: jmu_modif
|
||||
|
||||
eps = 1d-7
|
||||
r1_eps = r1
|
||||
delta = max(eps, dabs(eps*r1(2)))
|
||||
|
||||
r1_eps(2) = r1_eps(2) + delta
|
||||
fp = jmu_modif(r1_eps, r2)
|
||||
r1_eps(2) = r1_eps(2) - 2.d0 * delta
|
||||
fm = jmu_modif(r1_eps, r2)
|
||||
|
||||
grad1_y_jmu_modif = 0.5d0 * (fp - fm) / delta
|
||||
|
||||
return
|
||||
end function grad1_y_jmu_modif
|
||||
|
||||
double precision function grad1_z_jmu_modif(r1, r2)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r1(3), r2(3)
|
||||
double precision :: r1_eps(3), eps, fp, fm, delta
|
||||
double precision, external :: jmu_modif
|
||||
|
||||
eps = 1d-7
|
||||
r1_eps = r1
|
||||
delta = max(eps, dabs(eps*r1(3)))
|
||||
|
||||
r1_eps(3) = r1_eps(3) + delta
|
||||
fp = jmu_modif(r1_eps, r2)
|
||||
r1_eps(3) = r1_eps(3) - 2.d0 * delta
|
||||
fm = jmu_modif(r1_eps, r2)
|
||||
|
||||
grad1_z_jmu_modif = 0.5d0 * (fp - fm) / delta
|
||||
|
||||
return
|
||||
end function grad1_z_jmu_modif
|
||||
|
||||
! ---------------------------------------------------------------------------------------
|
||||
|
||||
! ---
|
||||
|
||||
! ---------------------------------------------------------------------------------------
|
||||
|
||||
double precision function grad1_x_j12_mu_num(r1, r2)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r1(3), r2(3)
|
||||
double precision :: r1_eps(3), eps, fp, fm, delta
|
||||
double precision, external :: j12_mu
|
||||
|
||||
eps = 1d-7
|
||||
r1_eps = r1
|
||||
delta = max(eps, dabs(eps*r1(1)))
|
||||
|
||||
r1_eps(1) = r1_eps(1) + delta
|
||||
fp = j12_mu(r1_eps, r2)
|
||||
r1_eps(1) = r1_eps(1) - 2.d0 * delta
|
||||
fm = j12_mu(r1_eps, r2)
|
||||
|
||||
grad1_x_j12_mu_num = 0.5d0 * (fp - fm) / delta
|
||||
|
||||
return
|
||||
end function grad1_x_j12_mu_num
|
||||
|
||||
double precision function grad1_y_j12_mu_num(r1, r2)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r1(3), r2(3)
|
||||
double precision :: r1_eps(3), eps, fp, fm, delta
|
||||
double precision, external :: j12_mu
|
||||
|
||||
eps = 1d-7
|
||||
r1_eps = r1
|
||||
delta = max(eps, dabs(eps*r1(2)))
|
||||
|
||||
r1_eps(2) = r1_eps(2) + delta
|
||||
fp = j12_mu(r1_eps, r2)
|
||||
r1_eps(2) = r1_eps(2) - 2.d0 * delta
|
||||
fm = j12_mu(r1_eps, r2)
|
||||
|
||||
grad1_y_j12_mu_num = 0.5d0 * (fp - fm) / delta
|
||||
|
||||
return
|
||||
end function grad1_y_j12_mu_num
|
||||
|
||||
double precision function grad1_z_j12_mu_num(r1, r2)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r1(3), r2(3)
|
||||
double precision :: r1_eps(3), eps, fp, fm, delta
|
||||
double precision, external :: j12_mu
|
||||
|
||||
eps = 1d-7
|
||||
r1_eps = r1
|
||||
delta = max(eps, dabs(eps*r1(3)))
|
||||
|
||||
r1_eps(3) = r1_eps(3) + delta
|
||||
fp = j12_mu(r1_eps, r2)
|
||||
r1_eps(3) = r1_eps(3) - 2.d0 * delta
|
||||
fm = j12_mu(r1_eps, r2)
|
||||
|
||||
grad1_z_j12_mu_num = 0.5d0 * (fp - fm) / delta
|
||||
|
||||
return
|
||||
end function grad1_z_j12_mu_num
|
||||
|
||||
! ---------------------------------------------------------------------------------------
|
||||
|
||||
! ---
|
||||
|
||||
subroutine grad1_j12_mu_exc(r1, r2, grad)
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r1(3), r2(3)
|
||||
double precision, intent(out) :: grad(3)
|
||||
double precision :: dx, dy, dz, r12, tmp
|
||||
|
||||
grad = 0.d0
|
||||
|
||||
dx = r1(1) - r2(1)
|
||||
dy = r1(2) - r2(2)
|
||||
dz = r1(3) - r2(3)
|
||||
|
||||
r12 = dsqrt( dx * dx + dy * dy + dz * dz )
|
||||
if(r12 .lt. 1d-10) return
|
||||
|
||||
tmp = 0.5d0 * (1.d0 - derf(mu_erf * r12)) / r12
|
||||
|
||||
grad(1) = tmp * dx
|
||||
grad(2) = tmp * dy
|
||||
grad(3) = tmp * dz
|
||||
|
||||
return
|
||||
end subroutine grad1_j12_mu_exc
|
||||
|
||||
! ---
|
||||
|
||||
subroutine grad1_jmu_modif_num(r1, r2, grad)
|
||||
|
||||
implicit none
|
||||
|
||||
double precision, intent(in) :: r1(3), r2(3)
|
||||
double precision, intent(out) :: grad(3)
|
||||
|
||||
double precision :: tmp0, tmp1, tmp2, tmp3, tmp4, grad_u12(3)
|
||||
|
||||
double precision, external :: j12_mu
|
||||
double precision, external :: j1b_nucl
|
||||
double precision, external :: grad_x_j1b_nucl
|
||||
double precision, external :: grad_y_j1b_nucl
|
||||
double precision, external :: grad_z_j1b_nucl
|
||||
|
||||
call grad1_j12_mu_exc(r1, r2, grad_u12)
|
||||
|
||||
tmp0 = j1b_nucl(r1)
|
||||
tmp1 = j1b_nucl(r2)
|
||||
tmp2 = j12_mu(r1, r2)
|
||||
tmp3 = tmp0 * tmp1
|
||||
tmp4 = tmp2 * tmp1
|
||||
|
||||
grad(1) = tmp3 * grad_u12(1) + tmp4 * grad_x_j1b_nucl(r1)
|
||||
grad(2) = tmp3 * grad_u12(2) + tmp4 * grad_y_j1b_nucl(r1)
|
||||
grad(3) = tmp3 * grad_u12(3) + tmp4 * grad_z_j1b_nucl(r1)
|
||||
|
||||
return
|
||||
end subroutine grad1_jmu_modif_num
|
||||
|
||||
! ---
|
||||
|
||||
|
||||
|
||||
|
360
src/non_h_ints_mu/new_grad_tc.irp.f
Normal file
360
src/non_h_ints_mu/new_grad_tc.irp.f
Normal file
@ -0,0 +1,360 @@
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, int2_grad1_u12_ao, (ao_num, ao_num, n_points_final_grid, 3)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! int2_grad1_u12_ao(i,j,ipoint,:) = \int dr2 [-1 * \grad_r1 J(r1,r2)] \phi_i(r2) \phi_j(r2)
|
||||
!
|
||||
! where r1 = r(ipoint)
|
||||
!
|
||||
! if J(r1,r2) = u12:
|
||||
!
|
||||
! int2_grad1_u12_ao(i,j,ipoint,:) = 0.5 x \int dr2 [(r1 - r2) (erf(mu * r12)-1)r_12] \phi_i(r2) \phi_j(r2)
|
||||
! = 0.5 * [ v_ij_erf_rk_cst_mu(i,j,ipoint) * r(:) - x_v_ij_erf_rk_cst_mu(i,j,ipoint,:) ]
|
||||
!
|
||||
! if J(r1,r2) = u12 x v1 x v2
|
||||
!
|
||||
! int2_grad1_u12_ao(i,j,ipoint,:) = v1 x [ 0.5 x \int dr2 [(r1 - r2) (erf(mu * r12)-1)r_12] v2 \phi_i(r2) \phi_j(r2) ]
|
||||
! - \grad_1 v1 x [ \int dr2 u12 v2 \phi_i(r2) \phi_j(r2) ]
|
||||
! = 0.5 v_1b(ipoint) * v_ij_erf_rk_cst_mu_j1b(i,j,ipoint) * r(:)
|
||||
! - 0.5 v_1b(ipoint) * x_v_ij_erf_rk_cst_mu_j1b(i,j,ipoint,:)
|
||||
! - v_1b_grad[:,ipoint] * v_ij_u_cst_mu_j1b(i,j,ipoint)
|
||||
!
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j
|
||||
double precision :: time0, time1
|
||||
double precision :: x, y, z, tmp_x, tmp_y, tmp_z, tmp0, tmp1, tmp2
|
||||
|
||||
print*, ' providing int2_grad1_u12_ao ...'
|
||||
call wall_time(time0)
|
||||
|
||||
PROVIDE j1b_type
|
||||
|
||||
if(j1b_type .eq. 3) then
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
|
||||
tmp0 = 0.5d0 * v_1b(ipoint)
|
||||
tmp_x = v_1b_grad(1,ipoint)
|
||||
tmp_y = v_1b_grad(2,ipoint)
|
||||
tmp_z = v_1b_grad(3,ipoint)
|
||||
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
tmp1 = tmp0 * v_ij_erf_rk_cst_mu_j1b(i,j,ipoint)
|
||||
tmp2 = v_ij_u_cst_mu_j1b(i,j,ipoint)
|
||||
|
||||
int2_grad1_u12_ao(i,j,ipoint,1) = tmp1 * x - tmp0 * x_v_ij_erf_rk_cst_mu_j1b(i,j,ipoint,1) - tmp2 * tmp_x
|
||||
int2_grad1_u12_ao(i,j,ipoint,2) = tmp1 * y - tmp0 * x_v_ij_erf_rk_cst_mu_j1b(i,j,ipoint,2) - tmp2 * tmp_y
|
||||
int2_grad1_u12_ao(i,j,ipoint,3) = tmp1 * z - tmp0 * x_v_ij_erf_rk_cst_mu_j1b(i,j,ipoint,3) - tmp2 * tmp_z
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
tmp1 = v_ij_erf_rk_cst_mu(i,j,ipoint)
|
||||
|
||||
int2_grad1_u12_ao(i,j,ipoint,1) = tmp1 * x - x_v_ij_erf_rk_cst_mu_transp_bis(ipoint,i,j,1)
|
||||
int2_grad1_u12_ao(i,j,ipoint,2) = tmp1 * y - x_v_ij_erf_rk_cst_mu_transp_bis(ipoint,i,j,2)
|
||||
int2_grad1_u12_ao(i,j,ipoint,3) = tmp1 * z - x_v_ij_erf_rk_cst_mu_transp_bis(ipoint,i,j,3)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
int2_grad1_u12_ao *= 0.5d0
|
||||
|
||||
endif
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for int2_grad1_u12_ao = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, int1_grad2_u12_ao, (3, ao_num, ao_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! int1_grad2_u12_ao(:,i,j,ipoint) = \int dr1 [-1 * \grad_r2 J(r1,r2)] \phi_i(r1) \phi_j(r1)
|
||||
!
|
||||
! where r1 = r(ipoint)
|
||||
!
|
||||
! if J(r1,r2) = u12:
|
||||
!
|
||||
! int1_grad2_u12_ao(:,i,j,ipoint) = +0.5 x \int dr1 [-(r1 - r2) (erf(mu * r12)-1)r_12] \phi_i(r1) \phi_j(r1)
|
||||
! = -0.5 * [ v_ij_erf_rk_cst_mu(i,j,ipoint) * r(:) - x_v_ij_erf_rk_cst_mu(i,j,ipoint,:) ]
|
||||
! = -int2_grad1_u12_ao(i,j,ipoint,:)
|
||||
!
|
||||
! if J(r1,r2) = u12 x v1 x v2
|
||||
!
|
||||
! int1_grad2_u12_ao(:,i,j,ipoint) = v2 x [ 0.5 x \int dr1 [-(r1 - r2) (erf(mu * r12)-1)r_12] v1 \phi_i(r1) \phi_j(r1) ]
|
||||
! - \grad_2 v2 x [ \int dr1 u12 v1 \phi_i(r1) \phi_j(r1) ]
|
||||
! = -0.5 v_1b(ipoint) * v_ij_erf_rk_cst_mu_j1b(i,j,ipoint) * r(:)
|
||||
! + 0.5 v_1b(ipoint) * x_v_ij_erf_rk_cst_mu_j1b(i,j,ipoint,:)
|
||||
! - v_1b_grad[:,ipoint] * v_ij_u_cst_mu_j1b(i,j,ipoint)
|
||||
!
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j
|
||||
double precision :: x, y, z, tmp_x, tmp_y, tmp_z, tmp0, tmp1, tmp2
|
||||
|
||||
PROVIDE j1b_type
|
||||
|
||||
if(j1b_type .eq. 3) then
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
|
||||
tmp0 = 0.5d0 * v_1b(ipoint)
|
||||
tmp_x = v_1b_grad(1,ipoint)
|
||||
tmp_y = v_1b_grad(2,ipoint)
|
||||
tmp_z = v_1b_grad(3,ipoint)
|
||||
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
tmp1 = tmp0 * v_ij_erf_rk_cst_mu_j1b(i,j,ipoint)
|
||||
tmp2 = v_ij_u_cst_mu_j1b(i,j,ipoint)
|
||||
|
||||
int1_grad2_u12_ao(1,i,j,ipoint) = -tmp1 * x + tmp0 * x_v_ij_erf_rk_cst_mu_j1b(i,j,ipoint,1) - tmp2 * tmp_x
|
||||
int1_grad2_u12_ao(2,i,j,ipoint) = -tmp1 * y + tmp0 * x_v_ij_erf_rk_cst_mu_j1b(i,j,ipoint,2) - tmp2 * tmp_y
|
||||
int1_grad2_u12_ao(3,i,j,ipoint) = -tmp1 * z + tmp0 * x_v_ij_erf_rk_cst_mu_j1b(i,j,ipoint,3) - tmp2 * tmp_z
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
int1_grad2_u12_ao = -1.d0 * int2_grad1_u12_ao
|
||||
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, tc_grad_and_lapl_ao_loop, (ao_num, ao_num, ao_num, ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! tc_grad_and_lapl_ao_loop(k,i,l,j) = < k l | -1/2 \Delta_1 u(r1,r2) - \grad_1 u(r1,r2) . \grad_1 | ij >
|
||||
!
|
||||
! = 1/2 \int dr1 (phi_k(r1) \grad_r1 phi_i(r1) - phi_i(r1) \grad_r1 phi_k(r1)) . \int dr2 \grad_r1 u(r1,r2) \phi_l(r2) \phi_j(r2)
|
||||
!
|
||||
! This is obtained by integration by parts.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, k, l
|
||||
double precision :: weight1, contrib_x, contrib_y, contrib_z, tmp_x, tmp_y, tmp_z
|
||||
double precision :: ao_k_r, ao_i_r, ao_i_dx, ao_i_dy, ao_i_dz
|
||||
double precision :: ao_j_r, ao_l_r, ao_l_dx, ao_l_dy, ao_l_dz
|
||||
double precision :: time0, time1
|
||||
double precision, allocatable :: ac_mat(:,:,:,:)
|
||||
|
||||
print*, ' providing tc_grad_and_lapl_ao_loop ...'
|
||||
call wall_time(time0)
|
||||
|
||||
allocate(ac_mat(ao_num,ao_num,ao_num,ao_num))
|
||||
ac_mat = 0.d0
|
||||
|
||||
! ---
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
weight1 = 0.5d0 * final_weight_at_r_vector(ipoint)
|
||||
|
||||
do i = 1, ao_num
|
||||
!ao_i_r = weight1 * aos_in_r_array_transp (ipoint,i)
|
||||
!ao_i_dx = weight1 * aos_grad_in_r_array_transp_bis(ipoint,i,1)
|
||||
!ao_i_dy = weight1 * aos_grad_in_r_array_transp_bis(ipoint,i,2)
|
||||
!ao_i_dz = weight1 * aos_grad_in_r_array_transp_bis(ipoint,i,3)
|
||||
ao_i_r = weight1 * aos_in_r_array (i,ipoint)
|
||||
ao_i_dx = weight1 * aos_grad_in_r_array(i,ipoint,1)
|
||||
ao_i_dy = weight1 * aos_grad_in_r_array(i,ipoint,2)
|
||||
ao_i_dz = weight1 * aos_grad_in_r_array(i,ipoint,3)
|
||||
|
||||
do k = 1, ao_num
|
||||
!ao_k_r = aos_in_r_array_transp(ipoint,k)
|
||||
ao_k_r = aos_in_r_array(k,ipoint)
|
||||
|
||||
!tmp_x = ao_k_r * ao_i_dx - ao_i_r * aos_grad_in_r_array_transp_bis(ipoint,k,1)
|
||||
!tmp_y = ao_k_r * ao_i_dy - ao_i_r * aos_grad_in_r_array_transp_bis(ipoint,k,2)
|
||||
!tmp_z = ao_k_r * ao_i_dz - ao_i_r * aos_grad_in_r_array_transp_bis(ipoint,k,3)
|
||||
tmp_x = ao_k_r * ao_i_dx - ao_i_r * aos_grad_in_r_array(k,ipoint,1)
|
||||
tmp_y = ao_k_r * ao_i_dy - ao_i_r * aos_grad_in_r_array(k,ipoint,2)
|
||||
tmp_z = ao_k_r * ao_i_dz - ao_i_r * aos_grad_in_r_array(k,ipoint,3)
|
||||
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
|
||||
contrib_x = int2_grad1_u12_ao(l,j,ipoint,1) * tmp_x
|
||||
contrib_y = int2_grad1_u12_ao(l,j,ipoint,2) * tmp_y
|
||||
contrib_z = int2_grad1_u12_ao(l,j,ipoint,3) * tmp_z
|
||||
|
||||
ac_mat(k,i,l,j) += contrib_x + contrib_y + contrib_z
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! ---
|
||||
|
||||
!do ipoint = 1, n_points_final_grid
|
||||
! weight1 = 0.5d0 * final_weight_at_r_vector(ipoint)
|
||||
|
||||
! do l = 1, ao_num
|
||||
! ao_l_r = weight1 * aos_in_r_array_transp (ipoint,l)
|
||||
! ao_l_dx = weight1 * aos_grad_in_r_array_transp_bis(ipoint,l,1)
|
||||
! ao_l_dy = weight1 * aos_grad_in_r_array_transp_bis(ipoint,l,2)
|
||||
! ao_l_dz = weight1 * aos_grad_in_r_array_transp_bis(ipoint,l,3)
|
||||
|
||||
! do j = 1, ao_num
|
||||
! ao_j_r = aos_in_r_array_transp(ipoint,j)
|
||||
|
||||
! tmp_x = ao_j_r * ao_l_dx - ao_l_r * aos_grad_in_r_array_transp_bis(ipoint,j,1)
|
||||
! tmp_y = ao_j_r * ao_l_dy - ao_l_r * aos_grad_in_r_array_transp_bis(ipoint,j,2)
|
||||
! tmp_z = ao_j_r * ao_l_dz - ao_l_r * aos_grad_in_r_array_transp_bis(ipoint,j,3)
|
||||
|
||||
! do i = 1, ao_num
|
||||
! do k = 1, ao_num
|
||||
|
||||
! contrib_x = int2_grad1_u12_ao(k,i,ipoint,1) * tmp_x
|
||||
! contrib_y = int2_grad1_u12_ao(k,i,ipoint,2) * tmp_y
|
||||
! contrib_z = int2_grad1_u12_ao(k,i,ipoint,3) * tmp_z
|
||||
|
||||
! ac_mat(k,i,l,j) += contrib_x + contrib_y + contrib_z
|
||||
! enddo
|
||||
! enddo
|
||||
! enddo
|
||||
! enddo
|
||||
!enddo
|
||||
|
||||
! ---
|
||||
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
tc_grad_and_lapl_ao_loop(k,i,l,j) = ac_mat(k,i,l,j) + ac_mat(l,j,k,i)
|
||||
!tc_grad_and_lapl_ao_loop(k,i,l,j) = ac_mat(k,i,l,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
deallocate(ac_mat)
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for tc_grad_and_lapl_ao_loop = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, tc_grad_and_lapl_ao, (ao_num, ao_num, ao_num, ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! tc_grad_and_lapl_ao(k,i,l,j) = < k l | -1/2 \Delta_1 u(r1,r2) - \grad_1 u(r1,r2) . \grad_1 | ij >
|
||||
!
|
||||
! = 1/2 \int dr1 (phi_k(r1) \grad_r1 phi_i(r1) - phi_i(r1) \grad_r1 phi_k(r1)) . \int dr2 \grad_r1 u(r1,r2) \phi_l(r2) \phi_j(r2)
|
||||
!
|
||||
! This is obtained by integration by parts.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, k, l, m
|
||||
double precision :: weight1, ao_k_r, ao_i_r
|
||||
double precision :: time0, time1
|
||||
double precision, allocatable :: ac_mat(:,:,:,:), b_mat(:,:,:,:)
|
||||
|
||||
print*, ' providing tc_grad_and_lapl_ao ...'
|
||||
call wall_time(time0)
|
||||
|
||||
allocate(b_mat(n_points_final_grid,ao_num,ao_num,3), ac_mat(ao_num,ao_num,ao_num,ao_num))
|
||||
|
||||
b_mat = 0.d0
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, k, ipoint, weight1, ao_i_r, ao_k_r) &
|
||||
!$OMP SHARED (aos_in_r_array_transp, aos_grad_in_r_array_transp_bis, b_mat, &
|
||||
!$OMP ao_num, n_points_final_grid, final_weight_at_r_vector)
|
||||
!$OMP DO SCHEDULE (static)
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
weight1 = 0.5d0 * final_weight_at_r_vector(ipoint)
|
||||
ao_i_r = aos_in_r_array_transp(ipoint,i)
|
||||
ao_k_r = aos_in_r_array_transp(ipoint,k)
|
||||
|
||||
b_mat(ipoint,k,i,1) = weight1 * (ao_k_r * aos_grad_in_r_array_transp_bis(ipoint,i,1) - ao_i_r * aos_grad_in_r_array_transp_bis(ipoint,k,1))
|
||||
b_mat(ipoint,k,i,2) = weight1 * (ao_k_r * aos_grad_in_r_array_transp_bis(ipoint,i,2) - ao_i_r * aos_grad_in_r_array_transp_bis(ipoint,k,2))
|
||||
b_mat(ipoint,k,i,3) = weight1 * (ao_k_r * aos_grad_in_r_array_transp_bis(ipoint,i,3) - ao_i_r * aos_grad_in_r_array_transp_bis(ipoint,k,3))
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
ac_mat = 0.d0
|
||||
do m = 1, 3
|
||||
call dgemm( "N", "N", ao_num*ao_num, ao_num*ao_num, n_points_final_grid, 1.d0 &
|
||||
, int2_grad1_u12_ao(1,1,1,m), ao_num*ao_num, b_mat(1,1,1,m), n_points_final_grid &
|
||||
, 1.d0, ac_mat, ao_num*ao_num)
|
||||
|
||||
enddo
|
||||
deallocate(b_mat)
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k, l) &
|
||||
!$OMP SHARED (ac_mat, tc_grad_and_lapl_ao, ao_num)
|
||||
!$OMP DO SCHEDULE (static)
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
tc_grad_and_lapl_ao(k,i,l,j) = ac_mat(k,i,l,j) + ac_mat(l,j,k,i)
|
||||
!tc_grad_and_lapl_ao(k,i,l,j) = ac_mat(k,i,l,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
deallocate(ac_mat)
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for tc_grad_and_lapl_ao = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
|
174
src/non_h_ints_mu/new_grad_tc_manu.irp.f
Normal file
174
src/non_h_ints_mu/new_grad_tc_manu.irp.f
Normal file
@ -0,0 +1,174 @@
|
||||
|
||||
BEGIN_PROVIDER [ double precision, int2_grad1_u12_ao_test, (ao_num, ao_num, n_points_final_grid, 3)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! int2_grad1_u12_ao_test(i,j,ipoint,:) = \int dr2 [-1 * \grad_r1 J(r1,r2)] \phi_i(r2) \phi_j(r2)
|
||||
!
|
||||
! where r1 = r(ipoint)
|
||||
!
|
||||
! if J(r1,r2) = u12:
|
||||
!
|
||||
! int2_grad1_u12_ao_test(i,j,ipoint,:) = 0.5 x \int dr2 [(r1 - r2) (erf(mu * r12)-1)r_12] \phi_i(r2) \phi_j(r2)
|
||||
! = 0.5 * [ v_ij_erf_rk_cst_mu(i,j,ipoint) * r(:) - x_v_ij_erf_rk_cst_mu(i,j,ipoint,:) ]
|
||||
!
|
||||
! if J(r1,r2) = u12 x v1 x v2
|
||||
!
|
||||
! int2_grad1_u12_ao_test(i,j,ipoint,:) = v1 x [ 0.5 x \int dr2 [(r1 - r2) (erf(mu * r12)-1)r_12] v2 \phi_i(r2) \phi_j(r2) ]
|
||||
! - \grad_1 v1 x [ \int dr2 u12 v2 \phi_i(r2) \phi_j(r2) ]
|
||||
! = 0.5 v_1b(ipoint) * v_ij_erf_rk_cst_mu_j1b(i,j,ipoint) * r(:)
|
||||
! - 0.5 v_1b(ipoint) * x_v_ij_erf_rk_cst_mu_j1b(i,j,ipoint,:)
|
||||
! - v_1b_grad[:,ipoint] * v_ij_u_cst_mu_j1b(i,j,ipoint)
|
||||
!
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j
|
||||
double precision :: time0, time1
|
||||
double precision :: x, y, z, tmp_x, tmp_y, tmp_z, tmp0, tmp1, tmp2
|
||||
|
||||
print*, ' providing int2_grad1_u12_ao_test ...'
|
||||
call wall_time(time0)
|
||||
|
||||
PROVIDE j1b_type
|
||||
|
||||
if(j1b_type .eq. 3) then
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
|
||||
tmp0 = 0.5d0 * v_1b(ipoint)
|
||||
tmp_x = v_1b_grad(1,ipoint)
|
||||
tmp_y = v_1b_grad(2,ipoint)
|
||||
tmp_z = v_1b_grad(3,ipoint)
|
||||
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
|
||||
tmp1 = tmp0 * v_ij_erf_rk_cst_mu_j1b_test(i,j,ipoint)
|
||||
tmp2 = v_ij_u_cst_mu_j1b_test(i,j,ipoint)
|
||||
|
||||
int2_grad1_u12_ao_test(i,j,ipoint,1) = tmp1 * x - tmp0 * x_v_ij_erf_rk_cst_mu_j1b_test(i,j,ipoint,1) - tmp2 * tmp_x
|
||||
int2_grad1_u12_ao_test(i,j,ipoint,2) = tmp1 * y - tmp0 * x_v_ij_erf_rk_cst_mu_j1b_test(i,j,ipoint,2) - tmp2 * tmp_y
|
||||
int2_grad1_u12_ao_test(i,j,ipoint,3) = tmp1 * z - tmp0 * x_v_ij_erf_rk_cst_mu_j1b_test(i,j,ipoint,3) - tmp2 * tmp_z
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
x = final_grid_points(1,ipoint)
|
||||
y = final_grid_points(2,ipoint)
|
||||
z = final_grid_points(3,ipoint)
|
||||
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
tmp1 = v_ij_erf_rk_cst_mu(i,j,ipoint)
|
||||
|
||||
int2_grad1_u12_ao_test(i,j,ipoint,1) = tmp1 * x - x_v_ij_erf_rk_cst_mu_tmp(i,j,ipoint,1)
|
||||
int2_grad1_u12_ao_test(i,j,ipoint,2) = tmp1 * y - x_v_ij_erf_rk_cst_mu_tmp(i,j,ipoint,2)
|
||||
int2_grad1_u12_ao_test(i,j,ipoint,3) = tmp1 * z - x_v_ij_erf_rk_cst_mu_tmp(i,j,ipoint,3)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
int2_grad1_u12_ao_test *= 0.5d0
|
||||
|
||||
endif
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for int2_grad1_u12_ao_test = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, tc_grad_and_lapl_ao_test, (ao_num, ao_num, ao_num, ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! tc_grad_and_lapl_ao_test(k,i,l,j) = < k l | -1/2 \Delta_1 u(r1,r2) - \grad_1 u(r1,r2) | ij >
|
||||
!
|
||||
! = 1/2 \int dr1 (phi_k(r1) \grad_r1 phi_i(r1) - phi_i(r1) \grad_r1 phi_k(r1)) . \int dr2 \grad_r1 u(r1,r2) \phi_l(r2) \phi_j(r2)
|
||||
!
|
||||
! This is obtained by integration by parts.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j, k, l, m
|
||||
double precision :: weight1, contrib_x, contrib_y, contrib_z, tmp_x, tmp_y, tmp_z
|
||||
double precision :: ao_k_r, ao_i_r, ao_i_dx, ao_i_dy, ao_i_dz
|
||||
double precision :: time0, time1
|
||||
double precision, allocatable :: ac_mat(:,:,:,:), b_mat(:,:,:,:)
|
||||
|
||||
print*, ' providing tc_grad_and_lapl_ao_test ...'
|
||||
call wall_time(time0)
|
||||
|
||||
provide int2_grad1_u12_ao_test
|
||||
|
||||
allocate(b_mat(n_points_final_grid,ao_num,ao_num,3), ac_mat(ao_num,ao_num,ao_num,ao_num))
|
||||
|
||||
b_mat = 0.d0
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, k, ipoint, weight1, ao_i_r, ao_k_r) &
|
||||
!$OMP SHARED (aos_in_r_array_transp, aos_grad_in_r_array_transp_bis, b_mat, &
|
||||
!$OMP ao_num, n_points_final_grid, final_weight_at_r_vector)
|
||||
!$OMP DO SCHEDULE (static)
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
weight1 = 0.5d0 * final_weight_at_r_vector(ipoint)
|
||||
ao_i_r = aos_in_r_array_transp(ipoint,i)
|
||||
ao_k_r = aos_in_r_array_transp(ipoint,k)
|
||||
|
||||
b_mat(ipoint,k,i,1) = weight1 * (ao_k_r * aos_grad_in_r_array_transp_bis(ipoint,i,1) - ao_i_r * aos_grad_in_r_array_transp_bis(ipoint,k,1))
|
||||
b_mat(ipoint,k,i,2) = weight1 * (ao_k_r * aos_grad_in_r_array_transp_bis(ipoint,i,2) - ao_i_r * aos_grad_in_r_array_transp_bis(ipoint,k,2))
|
||||
b_mat(ipoint,k,i,3) = weight1 * (ao_k_r * aos_grad_in_r_array_transp_bis(ipoint,i,3) - ao_i_r * aos_grad_in_r_array_transp_bis(ipoint,k,3))
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
ac_mat = 0.d0
|
||||
do m = 1, 3
|
||||
call dgemm( "N", "N", ao_num*ao_num, ao_num*ao_num, n_points_final_grid, 1.d0 &
|
||||
, int2_grad1_u12_ao_test(1,1,1,m), ao_num*ao_num, b_mat(1,1,1,m), n_points_final_grid &
|
||||
, 1.d0, ac_mat, ao_num*ao_num)
|
||||
|
||||
enddo
|
||||
deallocate(b_mat)
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k, l) &
|
||||
!$OMP SHARED (ac_mat, tc_grad_and_lapl_ao_test, ao_num)
|
||||
!$OMP DO SCHEDULE (static)
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
tc_grad_and_lapl_ao_test(k,i,l,j) = ac_mat(k,i,l,j) + ac_mat(l,j,k,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
deallocate(ac_mat)
|
||||
|
||||
call wall_time(time1)
|
||||
print*, ' Wall time for tc_grad_and_lapl_ao_test = ', time1 - time0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
623
src/non_h_ints_mu/numerical_integ.irp.f
Normal file
623
src/non_h_ints_mu/numerical_integ.irp.f
Normal file
@ -0,0 +1,623 @@
|
||||
|
||||
! ---
|
||||
|
||||
double precision function num_v_ij_u_cst_mu_j1b(i, j, ipoint)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! \int dr2 u12 \phi_i(r2) \phi_j(r2) x v_1b(r2)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, ipoint
|
||||
|
||||
integer :: jpoint
|
||||
double precision :: r1(3), r2(3)
|
||||
|
||||
double precision, external :: ao_value
|
||||
double precision, external :: j12_mu, j1b_nucl, j12_mu_gauss
|
||||
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
num_v_ij_u_cst_mu_j1b = 0.d0
|
||||
do jpoint = 1, n_points_final_grid
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
|
||||
num_v_ij_u_cst_mu_j1b += ao_value(i, r2) * ao_value(j, r2) * j12_mu_gauss(r1, r2) * j1b_nucl(r2) * final_weight_at_r_vector(jpoint)
|
||||
enddo
|
||||
|
||||
return
|
||||
end function num_v_ij_u_cst_mu_j1b
|
||||
|
||||
! ---
|
||||
|
||||
double precision function num_int2_u2_j1b2(i, j, ipoint)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! \int dr2 u12^2 \phi_i(r2) \phi_j(r2) x v_1b(r2)^2
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, ipoint
|
||||
|
||||
integer :: jpoint, i_fit
|
||||
double precision :: r1(3), r2(3)
|
||||
double precision :: dx, dy, dz, r12, x2, tmp1, tmp2, tmp3, coef, expo
|
||||
|
||||
double precision, external :: ao_value
|
||||
double precision, external :: j1b_nucl
|
||||
double precision, external :: j12_mu
|
||||
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
num_int2_u2_j1b2 = 0.d0
|
||||
do jpoint = 1, n_points_final_grid
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
dx = r1(1) - r2(1)
|
||||
dy = r1(2) - r2(2)
|
||||
dz = r1(3) - r2(3)
|
||||
x2 = dx * dx + dy * dy + dz * dz
|
||||
r12 = dsqrt(x2)
|
||||
|
||||
tmp1 = j1b_nucl(r2)
|
||||
tmp2 = tmp1 * tmp1 * ao_value(i, r2) * ao_value(j, r2) * final_weight_at_r_vector(jpoint)
|
||||
|
||||
!tmp3 = 0.d0
|
||||
!do i_fit = 1, n_max_fit_slat
|
||||
! expo = expo_gauss_j_mu_x_2(i_fit)
|
||||
! coef = coef_gauss_j_mu_x_2(i_fit)
|
||||
! tmp3 += coef * dexp(-expo*x2)
|
||||
!enddo
|
||||
tmp3 = j12_mu(r1, r2)
|
||||
tmp3 = tmp3 * tmp3
|
||||
|
||||
num_int2_u2_j1b2 += tmp2 * tmp3
|
||||
enddo
|
||||
|
||||
return
|
||||
end function num_int2_u2_j1b2
|
||||
|
||||
! ---
|
||||
|
||||
double precision function num_int2_grad1u2_grad2u2_j1b2(i, j, ipoint)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! \int dr2 \frac{-[erf(mu r12) -1]^2}{4} \phi_i(r2) \phi_j(r2) x v_1b(r2)^2
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, ipoint
|
||||
|
||||
integer :: jpoint, i_fit
|
||||
double precision :: r1(3), r2(3)
|
||||
double precision :: dx, dy, dz, r12, x2, tmp1, tmp2, tmp3, coef, expo
|
||||
|
||||
double precision, external :: ao_value
|
||||
double precision, external :: j1b_nucl
|
||||
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
num_int2_grad1u2_grad2u2_j1b2 = 0.d0
|
||||
do jpoint = 1, n_points_final_grid
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
dx = r1(1) - r2(1)
|
||||
dy = r1(2) - r2(2)
|
||||
dz = r1(3) - r2(3)
|
||||
x2 = dx * dx + dy * dy + dz * dz
|
||||
r12 = dsqrt(x2)
|
||||
|
||||
tmp1 = j1b_nucl(r2)
|
||||
tmp2 = tmp1 * tmp1 * ao_value(i, r2) * ao_value(j, r2) * final_weight_at_r_vector(jpoint)
|
||||
|
||||
!tmp3 = 0.d0
|
||||
!do i_fit = 1, n_max_fit_slat
|
||||
! expo = expo_gauss_1_erf_x_2(i_fit)
|
||||
! coef = coef_gauss_1_erf_x_2(i_fit)
|
||||
! tmp3 += coef * dexp(-expo*x2)
|
||||
!enddo
|
||||
tmp3 = derf(mu_erf*r12) - 1.d0
|
||||
tmp3 = tmp3 * tmp3
|
||||
|
||||
tmp3 = -0.25d0 * tmp3
|
||||
|
||||
num_int2_grad1u2_grad2u2_j1b2 += tmp2 * tmp3
|
||||
enddo
|
||||
|
||||
return
|
||||
end function num_int2_grad1u2_grad2u2_j1b2
|
||||
|
||||
! ---
|
||||
|
||||
double precision function num_v_ij_erf_rk_cst_mu_j1b(i, j, ipoint)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! \int dr2 [erf(mu r12) -1]/r12 \phi_i(r2) \phi_j(r2) x v_1b(r2)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, ipoint
|
||||
|
||||
integer :: jpoint
|
||||
double precision :: r1(3), r2(3)
|
||||
double precision :: dx, dy, dz, r12, tmp1, tmp2
|
||||
|
||||
double precision, external :: ao_value
|
||||
double precision, external :: j1b_nucl
|
||||
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
num_v_ij_erf_rk_cst_mu_j1b = 0.d0
|
||||
do jpoint = 1, n_points_final_grid
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
dx = r1(1) - r2(1)
|
||||
dy = r1(2) - r2(2)
|
||||
dz = r1(3) - r2(3)
|
||||
r12 = dsqrt( dx * dx + dy * dy + dz * dz )
|
||||
if(r12 .lt. 1d-10) cycle
|
||||
|
||||
tmp1 = (derf(mu_erf * r12) - 1.d0) / r12
|
||||
tmp2 = tmp1 * ao_value(i, r2) * ao_value(j, r2) * j1b_nucl(r2) * final_weight_at_r_vector(jpoint)
|
||||
|
||||
num_v_ij_erf_rk_cst_mu_j1b += tmp2
|
||||
enddo
|
||||
|
||||
return
|
||||
end function num_v_ij_erf_rk_cst_mu_j1b
|
||||
|
||||
! ---
|
||||
|
||||
subroutine num_x_v_ij_erf_rk_cst_mu_j1b(i, j, ipoint, integ)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! \int dr2 [erf(mu r12) -1]/r12 \phi_i(r2) \phi_j(r2) x v_1b(r2) x r2
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, ipoint
|
||||
double precision, intent(out) :: integ(3)
|
||||
|
||||
integer :: jpoint
|
||||
double precision :: r1(3), r2(3), grad(3)
|
||||
double precision :: dx, dy, dz, r12, tmp1, tmp2
|
||||
double precision :: tmp_x, tmp_y, tmp_z
|
||||
|
||||
double precision, external :: ao_value
|
||||
double precision, external :: j1b_nucl
|
||||
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
tmp_x = 0.d0
|
||||
tmp_y = 0.d0
|
||||
tmp_z = 0.d0
|
||||
do jpoint = 1, n_points_final_grid
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
dx = r1(1) - r2(1)
|
||||
dy = r1(2) - r2(2)
|
||||
dz = r1(3) - r2(3)
|
||||
r12 = dsqrt( dx * dx + dy * dy + dz * dz )
|
||||
if(r12 .lt. 1d-10) cycle
|
||||
|
||||
tmp1 = (derf(mu_erf * r12) - 1.d0) / r12
|
||||
tmp2 = tmp1 * ao_value(i, r2) * ao_value(j, r2) * j1b_nucl(r2) * final_weight_at_r_vector(jpoint)
|
||||
|
||||
tmp_x += tmp2 * r2(1)
|
||||
tmp_y += tmp2 * r2(2)
|
||||
tmp_z += tmp2 * r2(3)
|
||||
enddo
|
||||
|
||||
integ(1) = tmp_x
|
||||
integ(2) = tmp_y
|
||||
integ(3) = tmp_z
|
||||
|
||||
return
|
||||
end subroutine num_x_v_ij_erf_rk_cst_mu_j1b
|
||||
|
||||
! ---
|
||||
|
||||
subroutine num_int2_grad1_u12_ao(i, j, ipoint, integ)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! \int dr2 [-grad_1 u12] \phi_i(r2) \phi_j(r2) x v12_1b(r1, r2)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, ipoint
|
||||
double precision, intent(out) :: integ(3)
|
||||
|
||||
integer :: jpoint
|
||||
double precision :: tmp, r1(3), r2(3), grad(3)
|
||||
double precision :: tmp_x, tmp_y, tmp_z
|
||||
|
||||
double precision, external :: ao_value
|
||||
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
tmp_x = 0.d0
|
||||
tmp_y = 0.d0
|
||||
tmp_z = 0.d0
|
||||
do jpoint = 1, n_points_final_grid
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
tmp = ao_value(i, r2) * ao_value(j, r2) * final_weight_at_r_vector(jpoint)
|
||||
|
||||
call grad1_jmu_modif_num(r1, r2, grad)
|
||||
|
||||
tmp_x += tmp * (-1.d0 * grad(1))
|
||||
tmp_y += tmp * (-1.d0 * grad(2))
|
||||
tmp_z += tmp * (-1.d0 * grad(3))
|
||||
enddo
|
||||
|
||||
integ(1) = tmp_x
|
||||
integ(2) = tmp_y
|
||||
integ(3) = tmp_z
|
||||
|
||||
return
|
||||
end subroutine num_int2_grad1_u12_ao
|
||||
|
||||
! ---
|
||||
|
||||
double precision function num_gradu_squared_u_ij_mu(i, j, ipoint)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! -0.50 x \int r2 \phi_i(2) \phi_j(2) x v2^2
|
||||
! [ v1^2 ((grad_1 u12)^2 + (grad_2 u12^2)])
|
||||
! + u12^2 (grad_1 v1)^2
|
||||
! + 2 u12 v1 (grad_1 u12) . (grad_1 v1)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, ipoint
|
||||
|
||||
integer :: jpoint
|
||||
double precision :: r1(3), r2(3)
|
||||
double precision :: tmp_x, tmp_y, tmp_z, r12
|
||||
double precision :: dx1_v1, dy1_v1, dz1_v1, grad_u12(3)
|
||||
double precision :: tmp1, v1_tmp, v2_tmp, u12_tmp
|
||||
double precision :: fst_term, scd_term, thd_term, tmp
|
||||
|
||||
double precision, external :: ao_value
|
||||
double precision, external :: j1b_nucl
|
||||
double precision, external :: j12_mu
|
||||
double precision, external :: grad_x_j1b_nucl
|
||||
double precision, external :: grad_y_j1b_nucl
|
||||
double precision, external :: grad_z_j1b_nucl
|
||||
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
num_gradu_squared_u_ij_mu = 0.d0
|
||||
do jpoint = 1, n_points_final_grid
|
||||
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
|
||||
tmp_x = r1(1) - r2(1)
|
||||
tmp_y = r1(2) - r2(2)
|
||||
tmp_z = r1(3) - r2(3)
|
||||
r12 = dsqrt(tmp_x*tmp_x + tmp_y*tmp_y + tmp_z*tmp_z)
|
||||
|
||||
dx1_v1 = grad_x_j1b_nucl(r1)
|
||||
dy1_v1 = grad_y_j1b_nucl(r1)
|
||||
dz1_v1 = grad_z_j1b_nucl(r1)
|
||||
|
||||
call grad1_j12_mu_exc(r1, r2, grad_u12)
|
||||
|
||||
tmp1 = 1.d0 - derf(mu_erf * r12)
|
||||
v1_tmp = j1b_nucl(r1)
|
||||
v2_tmp = j1b_nucl(r2)
|
||||
u12_tmp = j12_mu(r1, r2)
|
||||
|
||||
fst_term = 0.5d0 * tmp1 * tmp1 * v1_tmp * v1_tmp
|
||||
scd_term = u12_tmp * u12_tmp * (dx1_v1*dx1_v1 + dy1_v1*dy1_v1 + dz1_v1*dz1_v1)
|
||||
thd_term = 2.d0 * v1_tmp * u12_tmp * (dx1_v1*grad_u12(1) + dy1_v1*grad_u12(2) + dz1_v1*grad_u12(3))
|
||||
|
||||
tmp = -0.5d0 * ao_value(i, r2) * ao_value(j, r2) * final_weight_at_r_vector(jpoint) * (fst_term + scd_term + thd_term) * v2_tmp * v2_tmp
|
||||
|
||||
num_gradu_squared_u_ij_mu += tmp
|
||||
enddo
|
||||
|
||||
return
|
||||
end function num_gradu_squared_u_ij_mu
|
||||
|
||||
! ---
|
||||
|
||||
double precision function num_grad12_j12(i, j, ipoint)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! -0.50 x \int r2 \phi_i(2) \phi_j(2) x v2^2 [v1^2 ((grad_1 u12)^2 + (grad_2 u12^2)]) ]
|
||||
!
|
||||
END_DOC
|
||||
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, ipoint
|
||||
|
||||
integer :: jpoint
|
||||
double precision :: r1(3), r2(3)
|
||||
double precision :: tmp_x, tmp_y, tmp_z, r12
|
||||
double precision :: dx1_v1, dy1_v1, dz1_v1, grad_u12(3)
|
||||
double precision :: tmp1, v1_tmp, v2_tmp, u12_tmp
|
||||
double precision :: fst_term, scd_term, thd_term, tmp
|
||||
|
||||
double precision, external :: ao_value
|
||||
double precision, external :: j1b_nucl
|
||||
double precision, external :: j12_mu
|
||||
double precision, external :: grad_x_j1b_nucl
|
||||
double precision, external :: grad_y_j1b_nucl
|
||||
double precision, external :: grad_z_j1b_nucl
|
||||
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
num_grad12_j12 = 0.d0
|
||||
do jpoint = 1, n_points_final_grid
|
||||
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
|
||||
tmp_x = r1(1) - r2(1)
|
||||
tmp_y = r1(2) - r2(2)
|
||||
tmp_z = r1(3) - r2(3)
|
||||
r12 = dsqrt(tmp_x*tmp_x + tmp_y*tmp_y + tmp_z*tmp_z)
|
||||
|
||||
dx1_v1 = grad_x_j1b_nucl(r1)
|
||||
dy1_v1 = grad_y_j1b_nucl(r1)
|
||||
dz1_v1 = grad_z_j1b_nucl(r1)
|
||||
|
||||
call grad1_j12_mu_exc(r1, r2, grad_u12)
|
||||
|
||||
tmp1 = 1.d0 - derf(mu_erf * r12)
|
||||
v1_tmp = j1b_nucl(r1)
|
||||
v2_tmp = j1b_nucl(r2)
|
||||
u12_tmp = j12_mu(r1, r2)
|
||||
|
||||
fst_term = 0.5d0 * tmp1 * tmp1 * v1_tmp * v1_tmp
|
||||
|
||||
tmp = -0.5d0 * ao_value(i, r2) * ao_value(j, r2) * final_weight_at_r_vector(jpoint) * fst_term * v2_tmp * v2_tmp
|
||||
|
||||
num_grad12_j12 += tmp
|
||||
enddo
|
||||
|
||||
return
|
||||
end function num_grad12_j12
|
||||
|
||||
! ---
|
||||
|
||||
double precision function num_u12sq_j1bsq(i, j, ipoint)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! -0.50 x \int r2 \phi_i(2) \phi_j(2) x v2^2 [ u12^2 (grad_1 v1)^2 ]
|
||||
!
|
||||
END_DOC
|
||||
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, ipoint
|
||||
|
||||
integer :: jpoint
|
||||
double precision :: r1(3), r2(3)
|
||||
double precision :: tmp_x, tmp_y, tmp_z, r12
|
||||
double precision :: dx1_v1, dy1_v1, dz1_v1, grad_u12(3)
|
||||
double precision :: tmp1, v1_tmp, v2_tmp, u12_tmp
|
||||
double precision :: fst_term, scd_term, thd_term, tmp
|
||||
|
||||
double precision, external :: ao_value
|
||||
double precision, external :: j1b_nucl
|
||||
double precision, external :: j12_mu
|
||||
double precision, external :: grad_x_j1b_nucl
|
||||
double precision, external :: grad_y_j1b_nucl
|
||||
double precision, external :: grad_z_j1b_nucl
|
||||
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
num_u12sq_j1bsq = 0.d0
|
||||
do jpoint = 1, n_points_final_grid
|
||||
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
|
||||
tmp_x = r1(1) - r2(1)
|
||||
tmp_y = r1(2) - r2(2)
|
||||
tmp_z = r1(3) - r2(3)
|
||||
r12 = dsqrt(tmp_x*tmp_x + tmp_y*tmp_y + tmp_z*tmp_z)
|
||||
|
||||
dx1_v1 = grad_x_j1b_nucl(r1)
|
||||
dy1_v1 = grad_y_j1b_nucl(r1)
|
||||
dz1_v1 = grad_z_j1b_nucl(r1)
|
||||
|
||||
call grad1_j12_mu_exc(r1, r2, grad_u12)
|
||||
|
||||
tmp1 = 1.d0 - derf(mu_erf * r12)
|
||||
v1_tmp = j1b_nucl(r1)
|
||||
v2_tmp = j1b_nucl(r2)
|
||||
u12_tmp = j12_mu(r1, r2)
|
||||
|
||||
scd_term = u12_tmp * u12_tmp * (dx1_v1*dx1_v1 + dy1_v1*dy1_v1 + dz1_v1*dz1_v1)
|
||||
|
||||
tmp = -0.5d0 * ao_value(i, r2) * ao_value(j, r2) * final_weight_at_r_vector(jpoint) * scd_term * v2_tmp * v2_tmp
|
||||
|
||||
num_u12sq_j1bsq += tmp
|
||||
enddo
|
||||
|
||||
return
|
||||
end function num_u12sq_j1bsq
|
||||
|
||||
! ---
|
||||
|
||||
double precision function num_u12_grad1_u12_j1b_grad1_j1b(i, j, ipoint)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! -0.50 x \int r2 \phi_i(2) \phi_j(2) x v2^2 [ 2 u12 v1 (grad_1 u12) . (grad_1 v1) ]
|
||||
!
|
||||
END_DOC
|
||||
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, ipoint
|
||||
|
||||
integer :: jpoint
|
||||
double precision :: r1(3), r2(3)
|
||||
double precision :: tmp_x, tmp_y, tmp_z, r12
|
||||
double precision :: dx1_v1, dy1_v1, dz1_v1, grad_u12(3)
|
||||
double precision :: tmp1, v1_tmp, v2_tmp, u12_tmp
|
||||
double precision :: fst_term, scd_term, thd_term, tmp
|
||||
|
||||
double precision, external :: ao_value
|
||||
double precision, external :: j1b_nucl
|
||||
double precision, external :: j12_mu
|
||||
double precision, external :: grad_x_j1b_nucl
|
||||
double precision, external :: grad_y_j1b_nucl
|
||||
double precision, external :: grad_z_j1b_nucl
|
||||
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
num_u12_grad1_u12_j1b_grad1_j1b = 0.d0
|
||||
do jpoint = 1, n_points_final_grid
|
||||
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
|
||||
tmp_x = r1(1) - r2(1)
|
||||
tmp_y = r1(2) - r2(2)
|
||||
tmp_z = r1(3) - r2(3)
|
||||
r12 = dsqrt(tmp_x*tmp_x + tmp_y*tmp_y + tmp_z*tmp_z)
|
||||
|
||||
dx1_v1 = grad_x_j1b_nucl(r1)
|
||||
dy1_v1 = grad_y_j1b_nucl(r1)
|
||||
dz1_v1 = grad_z_j1b_nucl(r1)
|
||||
|
||||
call grad1_j12_mu_exc(r1, r2, grad_u12)
|
||||
|
||||
tmp1 = 1.d0 - derf(mu_erf * r12)
|
||||
v1_tmp = j1b_nucl(r1)
|
||||
v2_tmp = j1b_nucl(r2)
|
||||
u12_tmp = j12_mu(r1, r2)
|
||||
|
||||
thd_term = 2.d0 * v1_tmp * u12_tmp * (dx1_v1*grad_u12(1) + dy1_v1*grad_u12(2) + dz1_v1*grad_u12(3))
|
||||
|
||||
tmp = -0.5d0 * ao_value(i, r2) * ao_value(j, r2) * final_weight_at_r_vector(jpoint) * thd_term * v2_tmp * v2_tmp
|
||||
|
||||
num_u12_grad1_u12_j1b_grad1_j1b += tmp
|
||||
enddo
|
||||
|
||||
return
|
||||
end function num_u12_grad1_u12_j1b_grad1_j1b
|
||||
|
||||
! ---
|
||||
|
||||
subroutine num_int2_u_grad1u_total_j1b2(i, j, ipoint, integ)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! \int dr2 u12 (grad_1 u12) \phi_i(r2) \phi_j(r2) x v_1b(r2)^2
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, ipoint
|
||||
double precision, intent(out) :: integ(3)
|
||||
|
||||
integer :: jpoint
|
||||
double precision :: r1(3), r2(3), grad(3)
|
||||
double precision :: dx, dy, dz, r12, tmp0, tmp1, tmp2
|
||||
double precision :: tmp_x, tmp_y, tmp_z
|
||||
|
||||
double precision, external :: ao_value
|
||||
double precision, external :: j1b_nucl
|
||||
double precision, external :: j12_mu
|
||||
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
|
||||
tmp_x = 0.d0
|
||||
tmp_y = 0.d0
|
||||
tmp_z = 0.d0
|
||||
do jpoint = 1, n_points_final_grid
|
||||
r2(1) = final_grid_points(1,jpoint)
|
||||
r2(2) = final_grid_points(2,jpoint)
|
||||
r2(3) = final_grid_points(3,jpoint)
|
||||
dx = r1(1) - r2(1)
|
||||
dy = r1(2) - r2(2)
|
||||
dz = r1(3) - r2(3)
|
||||
r12 = dsqrt( dx * dx + dy * dy + dz * dz )
|
||||
if(r12 .lt. 1d-10) cycle
|
||||
|
||||
tmp0 = j1b_nucl(r2)
|
||||
tmp1 = 0.5d0 * j12_mu(r1, r2) * (1.d0 - derf(mu_erf * r12)) / r12
|
||||
tmp2 = tmp0 * tmp0 * tmp1 * ao_value(i, r2) * ao_value(j, r2) * final_weight_at_r_vector(jpoint)
|
||||
|
||||
tmp_x += tmp2 * dx
|
||||
tmp_y += tmp2 * dy
|
||||
tmp_z += tmp2 * dz
|
||||
enddo
|
||||
|
||||
integ(1) = tmp_x
|
||||
integ(2) = tmp_y
|
||||
integ(3) = tmp_z
|
||||
|
||||
return
|
||||
end subroutine num_int2_u_grad1u_total_j1b2
|
||||
|
||||
! ---
|
102
src/non_h_ints_mu/test_non_h_ints.irp.f
Normal file
102
src/non_h_ints_mu/test_non_h_ints.irp.f
Normal file
@ -0,0 +1,102 @@
|
||||
program test_non_h
|
||||
implicit none
|
||||
my_grid_becke = .True.
|
||||
my_n_pt_r_grid = 50
|
||||
my_n_pt_a_grid = 74
|
||||
! my_n_pt_r_grid = 10 ! small grid for quick debug
|
||||
! my_n_pt_a_grid = 26 ! small grid for quick debug
|
||||
touch my_grid_becke my_n_pt_r_grid my_n_pt_a_grid
|
||||
!call routine_grad_squared
|
||||
call routine_fit
|
||||
end
|
||||
|
||||
subroutine routine_lapl_grad
|
||||
implicit none
|
||||
integer :: i,j,k,l
|
||||
double precision :: grad_lapl, get_ao_tc_sym_two_e_pot,new,accu,contrib
|
||||
double precision :: ao_two_e_integral_erf,get_ao_two_e_integral,count_n,accu_relat
|
||||
! !!!!!!!!!!!!!!!!!!!!! WARNING
|
||||
! THIS ROUTINE MAKES SENSE ONLY IF HAND MODIFIED coef_gauss_eff_pot(1:n_max_fit_slat) = 0. to cancel (1-erf(mu*r12))^2
|
||||
accu = 0.d0
|
||||
accu_relat = 0.d0
|
||||
count_n = 0.d0
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
grad_lapl = get_ao_tc_sym_two_e_pot(i,j,k,l,ao_tc_sym_two_e_pot_map) ! pure gaussian part : comes from Lapl
|
||||
grad_lapl += ao_two_e_integral_erf(i, k, j, l) ! erf(mu r12)/r12 : comes from Lapl
|
||||
grad_lapl += ao_non_hermit_term_chemist(k,i,l,j) ! \grad u(r12) . grad
|
||||
new = tc_grad_and_lapl_ao(k,i,l,j)
|
||||
new += get_ao_two_e_integral(i,j,k,l,ao_integrals_map)
|
||||
contrib = dabs(new - grad_lapl)
|
||||
if(dabs(grad_lapl).gt.1.d-12)then
|
||||
count_n += 1.d0
|
||||
accu_relat += 2.0d0 * contrib/dabs(grad_lapl+new)
|
||||
endif
|
||||
if(contrib.gt.1.d-10)then
|
||||
print*,i,j,k,l
|
||||
print*,grad_lapl,new,contrib
|
||||
print*,2.0d0*contrib/dabs(grad_lapl+new+1.d-12)
|
||||
endif
|
||||
accu += contrib
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
print*,'accu = ',accu/count_n
|
||||
print*,'accu/rel = ',accu_relat/count_n
|
||||
|
||||
end
|
||||
|
||||
subroutine routine_grad_squared
|
||||
implicit none
|
||||
integer :: i,j,k,l
|
||||
double precision :: grad_squared, get_ao_tc_sym_two_e_pot,new,accu,contrib
|
||||
double precision :: count_n,accu_relat
|
||||
! !!!!!!!!!!!!!!!!!!!!! WARNING
|
||||
! THIS ROUTINE MAKES SENSE ONLY IF HAND MODIFIED coef_gauss_eff_pot(n_max_fit_slat:n_max_fit_slat+1) = 0. to cancel exp(-'mu*r12)^2)
|
||||
accu = 0.d0
|
||||
accu_relat = 0.d0
|
||||
count_n = 0.d0
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
grad_squared = get_ao_tc_sym_two_e_pot(i,j,k,l,ao_tc_sym_two_e_pot_map) ! pure gaussian part : comes from Lapl
|
||||
new = tc_grad_square_ao(k,i,l,j)
|
||||
contrib = dabs(new - grad_squared)
|
||||
if(dabs(grad_squared).gt.1.d-12)then
|
||||
count_n += 1.d0
|
||||
accu_relat += 2.0d0 * contrib/dabs(grad_squared+new)
|
||||
endif
|
||||
if(contrib.gt.1.d-10)then
|
||||
print*,i,j,k,l
|
||||
print*,grad_squared,new,contrib
|
||||
print*,2.0d0*contrib/dabs(grad_squared+new+1.d-12)
|
||||
endif
|
||||
accu += contrib
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
print*,'accu = ',accu/count_n
|
||||
print*,'accu/rel = ',accu_relat/count_n
|
||||
|
||||
end
|
||||
|
||||
subroutine routine_fit
|
||||
implicit none
|
||||
integer :: i,nx
|
||||
double precision :: dx,xmax,x,j_mu,j_mu_F_x_j,j_mu_fit_gauss
|
||||
nx = 500
|
||||
xmax = 5.d0
|
||||
dx = xmax/dble(nx)
|
||||
x = 0.d0
|
||||
print*,'coucou',mu_erf
|
||||
do i = 1, nx
|
||||
write(33,'(100(F16.10,X))') x,j_mu(x),j_mu_F_x_j(x),j_mu_fit_gauss(x)
|
||||
x += dx
|
||||
enddo
|
||||
|
||||
end
|
91
src/non_h_ints_mu/total_tc_int.irp.f
Normal file
91
src/non_h_ints_mu/total_tc_int.irp.f
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, ao_tc_int_chemist, (ao_num, ao_num, ao_num, ao_num)]
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, l
|
||||
double precision :: wall1, wall0
|
||||
|
||||
print *, ' providing ao_tc_int_chemist ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
if(test_cycle_tc)then
|
||||
ao_tc_int_chemist = ao_tc_int_chemist_test
|
||||
else
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
ao_tc_int_chemist(k,i,l,j) = tc_grad_square_ao(k,i,l,j) + tc_grad_and_lapl_ao(k,i,l,j) + ao_two_e_coul(k,i,l,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
endif
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for ao_tc_int_chemist ', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, ao_tc_int_chemist_test, (ao_num, ao_num, ao_num, ao_num)]
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, l
|
||||
double precision :: wall1, wall0
|
||||
|
||||
print *, ' providing ao_tc_int_chemist_test ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
ao_tc_int_chemist_test(k,i,l,j) = tc_grad_square_ao_test(k,i,l,j) + tc_grad_and_lapl_ao_test(k,i,l,j) + ao_two_e_coul(k,i,l,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for ao_tc_int_chemist_test ', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, ao_two_e_coul, (ao_num, ao_num, ao_num, ao_num) ]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! ao_two_e_coul(k,i,l,j) = ( k i | 1/r12 | l j ) = < l k | 1/r12 | j i >
|
||||
!
|
||||
END_DOC
|
||||
|
||||
integer :: i, j, k, l
|
||||
double precision :: integral
|
||||
double precision, external :: get_ao_two_e_integral
|
||||
|
||||
PROVIDE ao_integrals_map
|
||||
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
|
||||
! < 1:k, 2:l | 1:i, 2:j >
|
||||
integral = get_ao_two_e_integral(i, j, k, l, ao_integrals_map)
|
||||
|
||||
ao_two_e_coul(k,i,l,j) = integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
185
src/tc_keywords/EZFIO.cfg
Normal file
185
src/tc_keywords/EZFIO.cfg
Normal file
@ -0,0 +1,185 @@
|
||||
[read_rl_eigv]
|
||||
type: logical
|
||||
doc: If |true|, read the right/left eigenvectors from ezfio
|
||||
interface: ezfio,provider,ocaml
|
||||
default: False
|
||||
|
||||
[comp_left_eigv]
|
||||
type: logical
|
||||
doc: If |true|, computes also the left-eigenvector
|
||||
interface: ezfio,provider,ocaml
|
||||
default: False
|
||||
|
||||
[three_body_h_tc]
|
||||
type: logical
|
||||
doc: If |true|, three-body terms are included
|
||||
interface: ezfio,provider,ocaml
|
||||
default: True
|
||||
|
||||
[pure_three_body_h_tc]
|
||||
type: logical
|
||||
doc: If |true|, pure triple excitation three-body terms are included
|
||||
interface: ezfio,provider,ocaml
|
||||
default: False
|
||||
|
||||
[double_normal_ord]
|
||||
type: logical
|
||||
doc: If |true|, contracted double excitation three-body terms are included
|
||||
interface: ezfio,provider,ocaml
|
||||
default: False
|
||||
|
||||
[core_tc_op]
|
||||
type: logical
|
||||
doc: If |true|, takes the usual Hamiltonian for core orbitals (assumed to be doubly occupied)
|
||||
interface: ezfio,provider,ocaml
|
||||
default: False
|
||||
|
||||
[full_tc_h_solver]
|
||||
type: logical
|
||||
doc: If |true|, you diagonalize the full TC H matrix
|
||||
interface: ezfio,provider,ocaml
|
||||
default: False
|
||||
|
||||
[thresh_it_dav]
|
||||
type: Threshold
|
||||
doc: Thresholds on the energy for iterative Davidson used in TC
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 1.e-5
|
||||
|
||||
[max_it_dav]
|
||||
type: integer
|
||||
doc: nb max of iteration in Davidson used in TC
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 1000
|
||||
|
||||
[thresh_psi_r]
|
||||
type: Threshold
|
||||
doc: Thresholds on the coefficients of the right-eigenvector. Used for PT2 computation.
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 0.000005
|
||||
|
||||
[thresh_psi_r_norm]
|
||||
type: logical
|
||||
doc: If |true|, you prune the WF to compute the PT1 coef based on the norm. If False, the pruning is done through the amplitude on the right-coefficient.
|
||||
interface: ezfio,provider,ocaml
|
||||
default: False
|
||||
|
||||
[state_following_tc]
|
||||
type: logical
|
||||
doc: If |true|, the states are re-ordered to match the input states
|
||||
default: False
|
||||
interface: ezfio,provider,ocaml
|
||||
|
||||
[bi_ortho]
|
||||
type: logical
|
||||
doc: If |true|, the MO basis is assumed to be bi-orthonormal
|
||||
interface: ezfio,provider,ocaml
|
||||
default: True
|
||||
|
||||
[symetric_fock_tc]
|
||||
type: logical
|
||||
doc: If |true|, using F+F^t as Fock TC
|
||||
interface: ezfio,provider,ocaml
|
||||
default: False
|
||||
|
||||
[thresh_tcscf]
|
||||
type: Threshold
|
||||
doc: Threshold on the convergence of the Hartree Fock energy.
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 1.e-12
|
||||
|
||||
[n_it_tcscf_max]
|
||||
type: Strictly_positive_int
|
||||
doc: Maximum number of SCF iterations
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 100
|
||||
|
||||
[j1b_pen]
|
||||
type: double precision
|
||||
doc: exponents of the 1-body Jastrow
|
||||
interface: ezfio
|
||||
size: (nuclei.nucl_num)
|
||||
|
||||
[j1b_coeff]
|
||||
type: double precision
|
||||
doc: coeff of the 1-body Jastrow
|
||||
interface: ezfio
|
||||
size: (nuclei.nucl_num)
|
||||
|
||||
[j1b_type]
|
||||
type: integer
|
||||
doc: type of 1-body Jastrow
|
||||
interface: ezfio, provider, ocaml
|
||||
default: 0
|
||||
|
||||
[thr_degen_tc]
|
||||
type: Threshold
|
||||
doc: Threshold to determine if two orbitals are degenerate in TCSCF in order to avoid random quasi orthogonality between the right- and left-eigenvector for the same eigenvalue
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 1.e-6
|
||||
|
||||
[maxovl_tc]
|
||||
type: logical
|
||||
doc: If |true|, maximize the overlap between orthogonalized left- and right eigenvectors
|
||||
interface: ezfio,provider,ocaml
|
||||
default: False
|
||||
|
||||
[ng_fit_jast]
|
||||
type: integer
|
||||
doc: nb of Gaussians used to fit Jastrow fcts
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 20
|
||||
|
||||
[tcscf_algorithm]
|
||||
type: character*(32)
|
||||
doc: Type of TCSCF algorithm used. Possible choices are [Simple | DIIS]
|
||||
interface: ezfio,provider,ocaml
|
||||
default: Simple
|
||||
|
||||
[test_cycle_tc]
|
||||
type: logical
|
||||
doc: If |true|, the integrals of the three-body jastrow are computed with cycles
|
||||
interface: ezfio,provider,ocaml
|
||||
default: True
|
||||
|
||||
[thresh_biorthog_diag]
|
||||
type: Threshold
|
||||
doc: Threshold to determine if diagonal elements of the bi-orthogonal condition L.T x R are close enouph to 1
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 1.e-6
|
||||
|
||||
[thresh_biorthog_nondiag]
|
||||
type: Threshold
|
||||
doc: Threshold to determine if non-diagonal elements of L.T x R are close enouph to 0
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 1.e-6
|
||||
|
||||
[max_dim_diis_tcscf]
|
||||
type: integer
|
||||
doc: Maximum size of the DIIS extrapolation procedure
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 15
|
||||
|
||||
[threshold_diis_tcscf]
|
||||
type: Threshold
|
||||
doc: Threshold on the convergence of the DIIS error vector during a TCSCF calculation. If 0. is chosen, the square root of thresh_tcscf will be used.
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 0.
|
||||
|
||||
[level_shift_tcscf]
|
||||
type: Positive_float
|
||||
doc: Energy shift on the virtual MOs to improve TCSCF convergence
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 0.
|
||||
|
||||
[im_thresh_tcscf]
|
||||
type: Threshold
|
||||
doc: Thresholds on the Imag part of energy
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 1.e-7
|
||||
|
||||
[debug_tc_pt2]
|
||||
type: integer
|
||||
doc: If :: 1 then you compute the TC-PT2 the old way, :: 2 then you check with the new version but without three-body
|
||||
interface: ezfio,provider,ocaml
|
||||
default: -1
|
2
src/tc_keywords/NEED
Normal file
2
src/tc_keywords/NEED
Normal file
@ -0,0 +1,2 @@
|
||||
ezfio_files
|
||||
nuclei
|
116
src/tc_keywords/j1b_pen.irp.f
Normal file
116
src/tc_keywords/j1b_pen.irp.f
Normal file
@ -0,0 +1,116 @@
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, j1b_pen, (nucl_num) ]
|
||||
|
||||
BEGIN_DOC
|
||||
! exponents of the 1-body Jastrow
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
logical :: exists
|
||||
|
||||
PROVIDE ezfio_filename
|
||||
|
||||
if (mpi_master) then
|
||||
call ezfio_has_tc_keywords_j1b_pen(exists)
|
||||
endif
|
||||
|
||||
IRP_IF MPI_DEBUG
|
||||
print *, irp_here, mpi_rank
|
||||
call MPI_BARRIER(MPI_COMM_WORLD, ierr)
|
||||
IRP_ENDIF
|
||||
|
||||
IRP_IF MPI
|
||||
include 'mpif.h'
|
||||
integer :: ierr
|
||||
call MPI_BCAST(j1b_pen, (nucl_num), MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
|
||||
if (ierr /= MPI_SUCCESS) then
|
||||
stop 'Unable to read j1b_pen with MPI'
|
||||
endif
|
||||
IRP_ENDIF
|
||||
|
||||
if (exists) then
|
||||
|
||||
if (mpi_master) then
|
||||
write(6,'(A)') '.. >>>>> [ IO READ: j1b_pen ] <<<<< ..'
|
||||
call ezfio_get_tc_keywords_j1b_pen(j1b_pen)
|
||||
IRP_IF MPI
|
||||
call MPI_BCAST(j1b_pen, (nucl_num), MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
|
||||
if (ierr /= MPI_SUCCESS) then
|
||||
stop 'Unable to read j1b_pen with MPI'
|
||||
endif
|
||||
IRP_ENDIF
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
integer :: i
|
||||
do i = 1, nucl_num
|
||||
j1b_pen(i) = 1d5
|
||||
enddo
|
||||
|
||||
endif
|
||||
print*,'parameters for nuclei jastrow'
|
||||
do i = 1, nucl_num
|
||||
print*,'i,Z,j1b_pen(i)',i,nucl_charge(i),j1b_pen(i)
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, j1b_coeff, (nucl_num) ]
|
||||
|
||||
BEGIN_DOC
|
||||
! coefficients of the 1-body Jastrow
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
logical :: exists
|
||||
|
||||
PROVIDE ezfio_filename
|
||||
|
||||
if (mpi_master) then
|
||||
call ezfio_has_tc_keywords_j1b_coeff(exists)
|
||||
endif
|
||||
|
||||
IRP_IF MPI_DEBUG
|
||||
print *, irp_here, mpi_rank
|
||||
call MPI_BARRIER(MPI_COMM_WORLD, ierr)
|
||||
IRP_ENDIF
|
||||
|
||||
IRP_IF MPI
|
||||
include 'mpif.h'
|
||||
integer :: ierr
|
||||
call MPI_BCAST(j1b_coeff, (nucl_num), MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
|
||||
if (ierr /= MPI_SUCCESS) then
|
||||
stop 'Unable to read j1b_coeff with MPI'
|
||||
endif
|
||||
IRP_ENDIF
|
||||
|
||||
if (exists) then
|
||||
|
||||
if (mpi_master) then
|
||||
write(6,'(A)') '.. >>>>> [ IO READ: j1b_coeff ] <<<<< ..'
|
||||
call ezfio_get_tc_keywords_j1b_coeff(j1b_coeff)
|
||||
IRP_IF MPI
|
||||
call MPI_BCAST(j1b_coeff, (nucl_num), MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
|
||||
if (ierr /= MPI_SUCCESS) then
|
||||
stop 'Unable to read j1b_coeff with MPI'
|
||||
endif
|
||||
IRP_ENDIF
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
integer :: i
|
||||
do i = 1, nucl_num
|
||||
j1b_coeff(i) = 0d5
|
||||
enddo
|
||||
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
7
src/tc_keywords/tc_keywords.irp.f
Normal file
7
src/tc_keywords/tc_keywords.irp.f
Normal file
@ -0,0 +1,7 @@
|
||||
program tc_keywords
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! TODO : Put the documentation of the program here
|
||||
END_DOC
|
||||
print *, 'Hello world'
|
||||
end
|
@ -129,6 +129,106 @@ subroutine give_explicit_poly_and_gaussian(P_new,P_center,p,fact_k,iorder,alpha,
|
||||
|
||||
end
|
||||
|
||||
subroutine give_explicit_poly_and_gaussian_v(P_new, ldp, P_center, p, fact_k, iorder, alpha, beta, a, b, A_center, LD_A, B_center, n_points)
|
||||
|
||||
BEGIN_DOC
|
||||
! Transforms the product of
|
||||
! (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta)
|
||||
! into
|
||||
! fact_k * [ sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x ] exp (- p (x-P_center(1))^2 )
|
||||
! * [ sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y ] exp (- p (y-P_center(2))^2 )
|
||||
! * [ sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z ] exp (- p (z-P_center(3))^2 )
|
||||
!
|
||||
! WARNING :: : IF fact_k is too smal then:
|
||||
! returns a "s" function centered in zero
|
||||
! with an inifinite exponent and a zero polynom coef
|
||||
END_DOC
|
||||
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n_points, ldp, LD_A
|
||||
integer, intent(in) :: a(3), b(3) ! powers : (x-xa)**a_x = (x-A(1))**a(1)
|
||||
double precision, intent(in) :: alpha, beta ! exponents
|
||||
double precision, intent(in) :: A_center(LD_A,3) ! A center
|
||||
double precision, intent(in) :: B_center(3) ! B center
|
||||
integer, intent(out) :: iorder(3) ! i_order(i) = order of the polynomials
|
||||
double precision, intent(out) :: P_center(n_points,3) ! new center
|
||||
double precision, intent(out) :: p ! new exponent
|
||||
double precision, intent(out) :: fact_k(n_points) ! constant factor
|
||||
double precision, intent(out) :: P_new(n_points,0:ldp,3) ! polynomial
|
||||
|
||||
integer :: n_new, i, j, ipoint, lda, ldb, xyz
|
||||
double precision, allocatable :: P_a(:,:,:), P_b(:,:,:)
|
||||
|
||||
|
||||
call gaussian_product_v(alpha, A_center, LD_A, beta, B_center, fact_k, p, P_center, n_points)
|
||||
|
||||
if(ior(ior(b(1), b(2)), b(3)) == 0) then ! b == (0,0,0)
|
||||
|
||||
iorder(1:3) = a(1:3)
|
||||
|
||||
lda = maxval(a)
|
||||
allocate(P_a(n_points,0:lda,3))
|
||||
!ldb = 0
|
||||
!allocate(P_b(n_points,0:0,3))
|
||||
|
||||
!call recentered_poly2_v0(P_a, lda, A_center, LD_A, P_center, a, P_b, B_center, P_center, n_points)
|
||||
call recentered_poly2_v0(P_a, lda, A_center, LD_A, P_center, a, n_points)
|
||||
|
||||
do ipoint = 1, n_points
|
||||
do xyz = 1, 3
|
||||
!P_new(ipoint,0,xyz) = P_a(ipoint,0,xyz) * P_b(ipoint,0,xyz)
|
||||
P_new(ipoint,0,xyz) = P_a(ipoint,0,xyz)
|
||||
do i = 1, a(xyz)
|
||||
!P_new(ipoint,i,xyz) = P_new(ipoint,i,xyz) + P_b(ipoint,0,xyz) * P_a(ipoint,i,xyz)
|
||||
P_new(ipoint,i,xyz) = P_a(ipoint,i,xyz)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
deallocate(P_a)
|
||||
!deallocate(P_b)
|
||||
|
||||
return
|
||||
endif
|
||||
|
||||
lda = maxval(a)
|
||||
ldb = maxval(b)
|
||||
allocate(P_a(n_points,0:lda,3), P_b(n_points,0:ldb,3))
|
||||
|
||||
call recentered_poly2_v(P_a, lda, A_center, LD_A, P_center, a, P_b, ldb, B_center, P_center, b, n_points)
|
||||
|
||||
iorder(1:3) = a(1:3) + b(1:3)
|
||||
|
||||
do xyz = 1, 3
|
||||
if(b(xyz) == 0) then
|
||||
|
||||
do ipoint = 1, n_points
|
||||
!P_new(ipoint,0,xyz) = P_a(ipoint,0,xyz) * P_b(ipoint,0,xyz)
|
||||
P_new(ipoint,0,xyz) = P_a(ipoint,0,xyz)
|
||||
do i = 1, a(xyz)
|
||||
!P_new(ipoint,i,xyz) = P_new(ipoint,i,xyz) + P_b(ipoint,0,xyz) * P_a(ipoint,i,xyz)
|
||||
P_new(ipoint,i,xyz) = P_a(ipoint,i,xyz)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
do i = 0, iorder(xyz)
|
||||
do ipoint = 1, n_points
|
||||
P_new(ipoint,i,xyz) = 0.d0
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call multiply_poly_v(P_a(1,0,xyz), a(xyz), P_b(1,0,xyz), b(xyz), P_new(1,0,xyz), ldp, n_points)
|
||||
|
||||
endif
|
||||
enddo
|
||||
|
||||
end subroutine give_explicit_poly_and_gaussian_v
|
||||
|
||||
! ---
|
||||
|
||||
subroutine give_explicit_poly_and_gaussian_double(P_new,P_center,p,fact_k,iorder,alpha,beta,gama,a,b,A_center,B_center,Nucl_center,dim)
|
||||
BEGIN_DOC
|
||||
@ -232,6 +332,64 @@ subroutine gaussian_product(a,xa,b,xb,k,p,xp)
|
||||
end subroutine
|
||||
|
||||
|
||||
subroutine gaussian_product_v(a, xa, LD_xa, b, xb, k, p, xp, n_points)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Gaussian product in 1D.
|
||||
! e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K_{ab}^x e^{-p (x-x_P)^2}
|
||||
!
|
||||
! Using multiple A centers
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: LD_xa, n_points
|
||||
double precision, intent(in) :: a, b ! Exponents
|
||||
double precision, intent(in) :: xa(LD_xa,3), xb(3) ! Centers
|
||||
double precision, intent(out) :: p ! New exponent
|
||||
double precision, intent(out) :: xp(n_points,3) ! New center
|
||||
double precision, intent(out) :: k(n_points) ! Constant
|
||||
|
||||
integer :: ipoint
|
||||
double precision :: p_inv
|
||||
double precision :: xab(3), ab, ap, bp, bpxb(3)
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: xab
|
||||
|
||||
ASSERT (a>0.)
|
||||
ASSERT (b>0.)
|
||||
|
||||
p = a+b
|
||||
p_inv = 1.d0/(a+b)
|
||||
ab = a*b*p_inv
|
||||
ap = a*p_inv
|
||||
bp = b*p_inv
|
||||
bpxb(1) = bp*xb(1)
|
||||
bpxb(2) = bp*xb(2)
|
||||
bpxb(3) = bp*xb(3)
|
||||
|
||||
do ipoint = 1, n_points
|
||||
xab(1) = xa(ipoint,1)-xb(1)
|
||||
xab(2) = xa(ipoint,2)-xb(2)
|
||||
xab(3) = xa(ipoint,3)-xb(3)
|
||||
k(ipoint) = ab*(xab(1)*xab(1)+xab(2)*xab(2)+xab(3)*xab(3))
|
||||
if (k(ipoint) > 40.d0) then
|
||||
k(ipoint)=0.d0
|
||||
xp(ipoint,1) = 0.d0
|
||||
xp(ipoint,2) = 0.d0
|
||||
xp(ipoint,3) = 0.d0
|
||||
else
|
||||
k(ipoint) = dexp(-k(ipoint))
|
||||
xp(ipoint,1) = ap*xa(ipoint,1)+bpxb(1)
|
||||
xp(ipoint,2) = ap*xa(ipoint,2)+bpxb(2)
|
||||
xp(ipoint,3) = ap*xa(ipoint,3)+bpxb(3)
|
||||
endif
|
||||
enddo
|
||||
|
||||
end subroutine gaussian_product_v
|
||||
|
||||
! ---
|
||||
|
||||
|
||||
subroutine gaussian_product_x(a,xa,b,xb,k,p,xp)
|
||||
@ -313,6 +471,43 @@ subroutine multiply_poly(b,nb,c,nc,d,nd)
|
||||
|
||||
end
|
||||
|
||||
subroutine multiply_poly_v(b,nb,c,nc,d,nd,n_points)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Multiply pairs of polynomials
|
||||
! D(t) += B(t)*C(t)
|
||||
END_DOC
|
||||
|
||||
integer, intent(in) :: nb, nc, n_points
|
||||
integer, intent(in) :: nd
|
||||
double precision, intent(in) :: b(n_points,0:nb), c(n_points,0:nc)
|
||||
double precision, intent(inout) :: d(n_points,0:nd)
|
||||
|
||||
integer :: ib, ic, id, k, ipoint
|
||||
if (nd < nb+nc) then
|
||||
print *, nd, nb, nc
|
||||
print *, irp_here, ': nd < nb+nc'
|
||||
stop 1
|
||||
endif
|
||||
|
||||
do ic = 0,nc
|
||||
do ipoint=1, n_points
|
||||
d(ipoint,ic) = d(ipoint,ic) + c(ipoint,ic) * b(ipoint,0)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
do ib=1,nb
|
||||
do ipoint=1, n_points
|
||||
d(ipoint, ib) = d(ipoint, ib) + c(ipoint,0) * b(ipoint, ib)
|
||||
enddo
|
||||
do ic = 1,nc
|
||||
do ipoint=1, n_points
|
||||
d(ipoint, ib+ic) = d(ipoint, ib+ic) + c(ipoint,ic) * b(ipoint, ib)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
end
|
||||
|
||||
subroutine add_poly(b,nb,c,nc,d,nd)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
@ -369,6 +564,152 @@ subroutine add_poly_multiply(b,nb,cst,d,nd)
|
||||
end
|
||||
|
||||
|
||||
subroutine recentered_poly2_v(P_new, lda, x_A, LD_xA, x_P, a, P_new2, ldb, x_B, x_Q, b, n_points)
|
||||
|
||||
BEGIN_DOC
|
||||
! Recenter two polynomials
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: a(3), b(3), n_points, lda, ldb, LD_xA
|
||||
double precision, intent(in) :: x_A(LD_xA,3), x_P(n_points,3), x_B(3), x_Q(n_points,3)
|
||||
double precision, intent(out) :: P_new(n_points,0:lda,3),P_new2(n_points,0:ldb,3)
|
||||
double precision :: binom_func
|
||||
integer :: i,j,k,l, minab(3), maxab(3),ipoint, xyz
|
||||
double precision, allocatable :: pows_a(:,:), pows_b(:,:)
|
||||
double precision :: fa, fb
|
||||
|
||||
maxab(1:3) = max(a(1:3),b(1:3))
|
||||
minab(1:3) = max(min(a(1:3),b(1:3)),(/0,0,0/))
|
||||
|
||||
allocate( pows_a(n_points,-2:maxval(maxab)+4), pows_b(n_points,-2:maxval(maxab)+4) )
|
||||
|
||||
do xyz=1,3
|
||||
if ((a(xyz)<0).or.(b(xyz)<0) ) cycle
|
||||
do ipoint=1,n_points
|
||||
pows_a(ipoint,0) = 1.d0
|
||||
pows_a(ipoint,1) = (x_P(ipoint,xyz) - x_A(ipoint,xyz))
|
||||
pows_b(ipoint,0) = 1.d0
|
||||
pows_b(ipoint,1) = (x_Q(ipoint,xyz) - x_B(xyz))
|
||||
enddo
|
||||
do i = 2,maxab(xyz)
|
||||
do ipoint=1,n_points
|
||||
pows_a(ipoint,i) = pows_a(ipoint,i-1)*pows_a(ipoint,1)
|
||||
pows_b(ipoint,i) = pows_b(ipoint,i-1)*pows_b(ipoint,1)
|
||||
enddo
|
||||
enddo
|
||||
do ipoint=1,n_points
|
||||
P_new (ipoint,0,xyz) = pows_a(ipoint,a(xyz))
|
||||
P_new2(ipoint,0,xyz) = pows_b(ipoint,b(xyz))
|
||||
enddo
|
||||
do i = 1,min(minab(xyz),20)
|
||||
fa = binom_transp(a(xyz)-i,a(xyz))
|
||||
fb = binom_transp(b(xyz)-i,b(xyz))
|
||||
do ipoint=1,n_points
|
||||
P_new (ipoint,i,xyz) = fa * pows_a(ipoint,a(xyz)-i)
|
||||
P_new2(ipoint,i,xyz) = fb * pows_b(ipoint,b(xyz)-i)
|
||||
enddo
|
||||
enddo
|
||||
do i = minab(xyz)+1,min(a(xyz),20)
|
||||
fa = binom_transp(a(xyz)-i,a(xyz))
|
||||
do ipoint=1,n_points
|
||||
P_new (ipoint,i,xyz) = fa * pows_a(ipoint,a(xyz)-i)
|
||||
enddo
|
||||
enddo
|
||||
do i = minab(xyz)+1,min(b(xyz),20)
|
||||
fb = binom_transp(b(xyz)-i,b(xyz))
|
||||
do ipoint=1,n_points
|
||||
P_new2(ipoint,i,xyz) = fb * pows_b(ipoint,b(xyz)-i)
|
||||
enddo
|
||||
enddo
|
||||
do i = 21,a(xyz)
|
||||
fa = binom_func(a(xyz),a(xyz)-i)
|
||||
do ipoint=1,n_points
|
||||
P_new (ipoint,i,xyz) = fa * pows_a(ipoint,a(xyz)-i)
|
||||
enddo
|
||||
enddo
|
||||
do i = 21,b(xyz)
|
||||
fb = binom_func(b(xyz),b(xyz)-i)
|
||||
do ipoint=1,n_points
|
||||
P_new2(ipoint,i,xyz) = fb * pows_b(ipoint,b(xyz)-i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end subroutine recentered_poly2_v
|
||||
|
||||
! ---
|
||||
|
||||
subroutine recentered_poly2_v0(P_new, lda, x_A, LD_xA, x_P, a, n_points)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Recenter two polynomials. Special case for b=(0,0,0)
|
||||
!
|
||||
! (x - A)^a (x - B)^0 = (x - P + P - A)^a (x - Q + Q - B)^0
|
||||
! = (x - P + P - A)^a
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: a(3), n_points, lda, LD_xA
|
||||
double precision, intent(in) :: x_A(LD_xA,3), x_P(n_points,3)
|
||||
!double precision, intent(in) :: x_B(3), x_Q(n_points,3)
|
||||
double precision, intent(out) :: P_new(n_points,0:lda,3)
|
||||
!double precision, intent(out) :: P_new2(n_points,3)
|
||||
|
||||
integer :: i, j, k, l, xyz, ipoint, maxab(3)
|
||||
double precision :: fa
|
||||
double precision, allocatable :: pows_a(:,:)
|
||||
!double precision, allocatable :: pows_b(:,:)
|
||||
|
||||
double precision :: binom_func
|
||||
|
||||
maxab(1:3) = max(a(1:3), (/0,0,0/))
|
||||
|
||||
allocate(pows_a(n_points,-2:maxval(maxab)+4))
|
||||
!allocate(pows_b(n_points,-2:maxval(maxab)+4))
|
||||
|
||||
do xyz = 1, 3
|
||||
if(a(xyz) < 0) cycle
|
||||
|
||||
do ipoint = 1, n_points
|
||||
pows_a(ipoint,0) = 1.d0
|
||||
pows_a(ipoint,1) = (x_P(ipoint,xyz) - x_A(ipoint,xyz))
|
||||
!pows_b(ipoint,0) = 1.d0
|
||||
!pows_b(ipoint,1) = (x_Q(ipoint,xyz) - x_B(xyz))
|
||||
enddo
|
||||
|
||||
do i = 2, maxab(xyz)
|
||||
do ipoint = 1, n_points
|
||||
pows_a(ipoint,i) = pows_a(ipoint,i-1) * pows_a(ipoint,1)
|
||||
!pows_b(ipoint,i) = pows_b(ipoint,i-1) * pows_b(ipoint,1)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
do ipoint = 1, n_points
|
||||
P_new (ipoint,0,xyz) = pows_a(ipoint,a(xyz))
|
||||
!P_new2(ipoint,xyz) = pows_b(ipoint,0)
|
||||
enddo
|
||||
do i = 1, min(a(xyz), 20)
|
||||
fa = binom_transp(a(xyz)-i, a(xyz))
|
||||
do ipoint = 1, n_points
|
||||
P_new(ipoint,i,xyz) = fa * pows_a(ipoint,a(xyz)-i)
|
||||
enddo
|
||||
enddo
|
||||
do i = 21, a(xyz)
|
||||
fa = binom_func(a(xyz), a(xyz)-i)
|
||||
do ipoint = 1, n_points
|
||||
P_new(ipoint,i,xyz) = fa * pows_a(ipoint,a(xyz)-i)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
enddo !xyz
|
||||
|
||||
deallocate(pows_a)
|
||||
!deallocate(pows_b)
|
||||
|
||||
end subroutine recentered_poly2_v0
|
||||
|
||||
subroutine recentered_poly2(P_new,x_A,x_P,a,P_new2,x_B,x_Q,b)
|
||||
implicit none
|
||||
@ -412,6 +753,79 @@ subroutine recentered_poly2(P_new,x_A,x_P,a,P_new2,x_B,x_Q,b)
|
||||
enddo
|
||||
end
|
||||
|
||||
subroutine pol_modif_center(A_center, B_center, iorder, A_pol, B_pol)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Transform the pol centerd on A:
|
||||
! [ \sum_i ax_i (x-x_A)^i ] [ \sum_j ay_j (y-y_A)^j ] [ \sum_k az_k (z-z_A)^k ]
|
||||
! to a pol centered on B
|
||||
! [ \sum_i bx_i (x-x_B)^i ] [ \sum_j by_j (y-y_B)^j ] [ \sum_k bz_k (z-z_B)^k ]
|
||||
!
|
||||
END_DOC
|
||||
|
||||
! useful for max_dim
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: iorder(3)
|
||||
double precision, intent(in) :: A_center(3), B_center(3)
|
||||
double precision, intent(in) :: A_pol(0:max_dim, 3)
|
||||
double precision, intent(out) :: B_pol(0:max_dim, 3)
|
||||
|
||||
integer :: i, Lmax
|
||||
|
||||
do i = 1, 3
|
||||
Lmax = iorder(i)
|
||||
call pol_modif_center_x( A_center(i), B_center(i), Lmax, A_pol(0:Lmax, i), B_pol(0:Lmax, i) )
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine pol_modif_center
|
||||
|
||||
|
||||
|
||||
subroutine pol_modif_center_x(A_center, B_center, iorder, A_pol, B_pol)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Transform the pol centerd on A:
|
||||
! [ \sum_i ax_i (x-x_A)^i ]
|
||||
! to a pol centered on B
|
||||
! [ \sum_i bx_i (x-x_B)^i ]
|
||||
!
|
||||
! bx_i = \sum_{j=i}^{iorder} ax_j (x_B - x_A)^(j-i) j! / [ i! (j-i)! ]
|
||||
! = \sum_{j=i}^{iorder} ax_j (x_B - x_A)^(j-i) binom_func(j,i)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: iorder
|
||||
double precision, intent(in) :: A_center, B_center
|
||||
double precision, intent(in) :: A_pol(0:iorder)
|
||||
double precision, intent(out) :: B_pol(0:iorder)
|
||||
|
||||
integer :: i, j
|
||||
double precision :: fact_tmp, dx
|
||||
|
||||
double precision :: binom_func
|
||||
|
||||
dx = B_center - A_center
|
||||
|
||||
do i = 0, iorder
|
||||
fact_tmp = 0.d0
|
||||
do j = i, iorder
|
||||
fact_tmp += A_pol(j) * binom_func(j, i) * dx**dble(j-i)
|
||||
enddo
|
||||
B_pol(i) = fact_tmp
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine pol_modif_center_x
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -145,3 +145,72 @@ end
|
||||
|
||||
|
||||
|
||||
subroutine overlap_gaussian_xyz_v(A_center, B_center, alpha, beta, power_A, power_B, overlap, n_points)
|
||||
|
||||
BEGIN_DOC
|
||||
!.. math::
|
||||
!
|
||||
! S_x = \int (x-A_x)^{a_x} exp(-\alpha(x-A_x)^2) (x-B_x)^{b_x} exp(-beta(x-B_x)^2) dx \\
|
||||
! S = S_x S_y S_z
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: n_points
|
||||
integer, intent(in) :: power_A(3), power_B(3) ! power of the x1 functions
|
||||
double precision, intent(in) :: A_center(n_points,3), B_center(3) ! center of the x1 functions
|
||||
double precision, intent(in) :: alpha, beta
|
||||
double precision, intent(out) :: overlap(n_points)
|
||||
|
||||
integer :: i
|
||||
integer :: iorder_p(3), ipoint, ldp
|
||||
integer :: nmax
|
||||
double precision :: F_integral_tab(0:max_dim)
|
||||
double precision :: p, overlap_x, overlap_y, overlap_z
|
||||
double precision :: F_integral
|
||||
double precision, allocatable :: P_new(:,:,:), P_center(:,:), fact_p(:)
|
||||
|
||||
ldp = maxval(power_A(1:3) + power_B(1:3))
|
||||
|
||||
allocate(P_new(n_points,0:ldp,3), P_center(n_points,3), fact_p(n_points))
|
||||
|
||||
call give_explicit_poly_and_gaussian_v(P_new, ldp, P_center, p, fact_p, iorder_p, alpha, beta, power_A, power_B, A_center, n_points, B_center, n_points)
|
||||
|
||||
nmax = maxval(iorder_p)
|
||||
do i = 0, nmax
|
||||
F_integral_tab(i) = F_integral(i,p)
|
||||
enddo
|
||||
|
||||
do ipoint = 1, n_points
|
||||
|
||||
if(fact_p(ipoint) .lt. 1d-20) then
|
||||
overlap(ipoint) = 1.d-10
|
||||
cycle
|
||||
endif
|
||||
|
||||
overlap_x = P_new(ipoint,0,1) * F_integral_tab(0)
|
||||
do i = 1, iorder_p(1)
|
||||
overlap_x = overlap_x + P_new(ipoint,i,1) * F_integral_tab(i)
|
||||
enddo
|
||||
|
||||
overlap_y = P_new(ipoint,0,2) * F_integral_tab(0)
|
||||
do i = 1, iorder_p(2)
|
||||
overlap_y = overlap_y + P_new(ipoint,i,2) * F_integral_tab(i)
|
||||
enddo
|
||||
|
||||
overlap_z = P_new(ipoint,0,3) * F_integral_tab(0)
|
||||
do i = 1, iorder_p(3)
|
||||
overlap_z = overlap_z + P_new(ipoint,i,3) * F_integral_tab(i)
|
||||
enddo
|
||||
|
||||
overlap(ipoint) = overlap_x * overlap_y * overlap_z * fact_p(ipoint)
|
||||
enddo
|
||||
|
||||
deallocate(P_new, P_center, fact_p)
|
||||
|
||||
end subroutine overlap_gaussian_xyz_v
|
||||
|
||||
! ---
|
||||
|
Loading…
Reference in New Issue
Block a user