use dftd3 method to address zero small denominators

This commit is contained in:
edoapra 2023-01-18 16:34:22 -08:00
parent 75819c7c64
commit eb744ccf36
No known key found for this signature in database
GPG key ID: 48E12DA1EDE9E1B0

View file

@ -42,6 +42,7 @@ C>
double precision cnj !< [Input] \f$\mathrm{CN}^B(R)\f$
double precision top,bottom,dist,c6_ref
double precision cna,cnb
double precision c6_mem,dist_save
integer i,j
double precision eps
parameter (eps=1d-90)
@ -49,6 +50,8 @@ c
c6cn=0.0d0
top=0.0d0
bottom=0.0d0
c6_mem=-1.d+99
dist_save=1.0d99
do i=1,maxcn(iat)
do j=1,maxcn(jat)
c6_ref=c6ab(iat,jat,i,j,1)
@ -56,6 +59,10 @@ c
cna=c6ab(iat,jat,i,j,2)
cnb=c6ab(iat,jat,i,j,3)
dist=(cna-cni)**2+(cnb-cnj)**2
if (dist.lt.dist_save) then
dist_save=dist
c6_mem=c6_ref
endif
top=top+dexp(k3*dist)*c6_ref
bottom=bottom+dexp(k3*dist)
endif
@ -65,8 +72,7 @@ c
if (bottom.gt.eps) then
c6cn=top/bottom
else
c6cn=0.0d0
call errquit(' c6cn returning zero ',0,0)
c6cn=c6_mem
endif
return
end