4
1
mirror of https://github.com/pfloos/quack synced 2024-11-07 14:43:58 +01:00
quack/src/QuAcK/fc_srlda.f90

89 lines
1.8 KiB
Fortran
Raw Normal View History

2019-07-09 23:09:32 +02:00
subroutine fc_srlda(nBas,nGrid,weight,MO,rho,mu,eG0W0)
2019-07-09 17:26:36 +02:00
! Compute sr-lda ec
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: nBas
integer,intent(in) :: nGrid
double precision,intent(in) :: weight(nGrid)
double precision,intent(in) :: MO(nBas,nGrid)
double precision,intent(in) :: rho(nGrid)
double precision,intent(in) :: mu(nGrid)
2019-07-09 23:09:32 +02:00
double precision,intent(in) :: eG0W0(nBas)
2019-07-09 17:26:36 +02:00
! Local variables
2019-07-09 23:09:32 +02:00
integer :: iG,p
2019-07-15 12:07:54 +02:00
double precision :: r,ra,rb,rap,ram
double precision :: rs,rsp,rsm
double precision :: ec,ecp,ecm,vcup,vcdw
double precision,parameter :: delta = 1d-6
2019-07-09 23:09:32 +02:00
double precision,allocatable :: de(:)
! Memory allocation
allocate(de(nBas))
2019-07-09 17:26:36 +02:00
! Initialization
2019-07-09 23:09:32 +02:00
de(:) = 0d0
2019-07-09 17:26:36 +02:00
do iG=1,ngrid
2019-07-15 12:07:54 +02:00
r = max(0d0,rho(iG))
ra = 0.5d0*r
rb = 0.5d0*r
2019-07-09 17:26:36 +02:00
2019-07-09 23:09:32 +02:00
if(r > threshold) then
2019-07-09 17:26:36 +02:00
rs = (4d0*pi*r/3d0)**(-1d0/3d0)
2019-07-15 12:07:54 +02:00
! call lsdsr(rs,0d0,mu(iG),ec,vcup,vcdw)
if(abs(ra) > delta) then
rap = ra + delta
ram = ra - delta
rsp = (4d0*pi*rap/3d0)**(-1d0/3d0)
rsm = (4d0*pi*ram/3d0)**(-1d0/3d0)
! call lsdsr(rsp,0d0,mu(iG),ecp,vcup,vcdw)
! call lsdsr(rsm,0d0,mu(iG),ecm,vcup,vcdw)
call lsdsr(rs,0d0,mu(iG),ec,vcup,vcdw)
! call ESRC_MD_LDAERF(mu(iG),rap,rb,.true.,ecp)
! call ESRC_MD_LDAERF(mu(iG),ram,rb,.true.,ecm)
! vcup = (ecp - ecm)/(2d0*delta)
else
vcup = 0d0
end if
2019-07-09 23:09:32 +02:00
do p=1,nBas
2019-07-09 17:26:36 +02:00
2019-07-09 23:09:32 +02:00
de(p)= de(p) + weight(iG)*vcup*MO(p,iG)**2
2019-07-09 17:26:36 +02:00
2019-07-09 23:09:32 +02:00
end do
2019-07-09 17:26:36 +02:00
end if
end do
2019-07-09 23:09:32 +02:00
print*, 'Eigenvalues correction from srDFT (in eV)'
call matout(nBas,1,de(:)*HaToeV)
print*, 'Corrected G0W0 eigenvalues (in eV)'
call matout(nBas,1,(eG0W0(:) + de(:))*HaToeV)
2019-07-09 17:26:36 +02:00
end subroutine fc_srlda