10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-11 22:03:47 +02:00

>50% acceleration of int.f90

This commit is contained in:
Thomas Applencourt 2015-05-05 14:22:38 +02:00
parent db8f905b98
commit c1c684b0e7
2 changed files with 129 additions and 96 deletions

View File

@ -1898,11 +1898,17 @@ end
!! !!
!! M_n(x) modified spherical bessel function !! M_n(x) modified spherical bessel function
!! !!
double precision function int_prod_bessel(l,gam,n,m,a,b,arg) double precision function int_prod_bessel(l,gam,n,m,a,b,arg)
implicit none implicit none
integer n,k,m,q,l,kcp integer n,k,m,q,l,kcp
double precision gam,dblefact,fact,pi,a,b double precision gam,dblefact,fact,pi,a,b
double precision int,intold,sum,coef_nk,crochet,u,int_prod_bessel_large,freal,arg double precision int,intold,sum,coef_nk,crochet,u,int_prod_bessel_large,freal,arg
double precision dump
double precision, allocatable :: temp_array(:)
logical done logical done
u=(a+b)/(2.d0*dsqrt(gam)) u=(a+b)/(2.d0*dsqrt(gam))
@ -1913,6 +1919,7 @@ end
int_prod_bessel=0.d0 int_prod_bessel=0.d0
return return
endif endif
int_prod_bessel=crochet(l,gam)*freal int_prod_bessel=crochet(l,gam)*freal
return return
endif endif
@ -1929,30 +1936,48 @@ end
int=0.d0 int=0.d0
done=.false. done=.false.
kcp=0 kcp=0
allocate( temp_array(0:101))
do while (.not.done) do while (.not.done)
kcp=kcp+1 kcp=kcp+1
sum=0.d0 sum=0.d0
do k=0,q
sum=sum+coef_nk(n,k)*coef_nk(m,q-k)*a**(n+2*k)*b**(m-2*k+2*q) dump = a**n
do k=q,q+1
temp_array(k) = coef_nk(n,k)*dump*(a**(2*k))
enddo enddo
do k=0,q
sum=sum+temp_array(k)*coef_nk(m,q-k)*b**(m-2*k+2*q)
enddo
int=int+sum*crochet(2*q+n+m+l,gam) int=int+sum*crochet(2*q+n+m+l,gam)
if(dabs(int-intold).lt.1d-15)then if(dabs(int-intold).lt.1d-15)then
done=.true. done=.true.
else else
q=q+1 q=q+1
intold=int intold=int
endif endif
enddo enddo
deallocate(temp_array)
int_prod_bessel=int*freal int_prod_bessel=int*freal
if(kcp.gt.100)then if(kcp.gt.100)then
print*,'**WARNING** bad convergence in int_prod_bessel' print*,'**WARNING** bad convergence in int_prod_bessel'
! else
! print*,'kcp=',kcp
endif endif
return return
endif endif
if(a.eq.0.d0.and.b.ne.0.d0)then if(a.eq.0.d0.and.b.ne.0.d0)then
if(n.ne.0)then if(n.ne.0)then
int_prod_bessel=0.d0 int_prod_bessel=0.d0
return return
@ -1963,16 +1988,21 @@ end
int=0.d0 int=0.d0
done=.false. done=.false.
kcp=0 kcp=0
do while (.not.done) do while (.not.done)
kcp=kcp+1 kcp=kcp+1
int=int+coef_nk(m,q)*b**(m+2*q)*crochet(2*q+m+l,gam) int=int+coef_nk(m,q)*b**(m+2*q)*crochet(2*q+m+l,gam)
if(dabs(int-intold).lt.1d-15)then if(dabs(int-intold).lt.1d-15)then
done=.true. done=.true.
else else
q=q+1 q=q+1
intold=int intold=int
endif endif
enddo enddo
int_prod_bessel=int*freal int_prod_bessel=int*freal
if(kcp.gt.100)stop '**WARNING** bad convergence in int_prod_bessel' if(kcp.gt.100)stop '**WARNING** bad convergence in int_prod_bessel'
return return
@ -1989,6 +2019,7 @@ end
int=0.d0 int=0.d0
done=.false. done=.false.
kcp=0 kcp=0
do while (.not.done) do while (.not.done)
kcp=kcp+1 kcp=kcp+1
int=int+coef_nk(n,q)*a**(n+2*q)*crochet(2*q+n+l,gam) int=int+coef_nk(n,q)*a**(n+2*q)*crochet(2*q+n+l,gam)
@ -1999,9 +2030,11 @@ end
intold=int intold=int
endif endif
enddo enddo
int_prod_bessel=int*freal int_prod_bessel=int*freal
if(kcp.gt.100)stop '**WARNING** bad convergence in int_prod_bessel' if(kcp.gt.100)stop '**WARNING** bad convergence in int_prod_bessel'
return return
endif endif
stop 'pb in int_prod_bessel!!' stop 'pb in int_prod_bessel!!'

View File

@ -169,7 +169,7 @@ def run_hf(geo, basis, mult=1, pseudo=False, remove_after_sucess=True):
ref_energy["sto-3g"]["methane"] = Energy(-39.7267433402, None) ref_energy["sto-3g"]["methane"] = Energy(-39.7267433402, None)
ref_energy["vdz"]["SO2"] = Energy(None, -41.48912297776174) ref_energy["vdz"]["SO2"] = Energy(None, -41.48912297776174)
ref_energy["vdz"]["HBO"] = Energy(None, -19.1198251160) ref_energy["vdz"]["HBO"] = Energy(None, -19.11982540413317)
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
# G l o b a l _ v a r i a b l e # # G l o b a l _ v a r i a b l e #