10
1
mirror of https://github.com/pfloos/quack synced 2024-12-26 14:23:38 +01:00
QuAcK/src/eDFT/W38_lda_correlation_energy.f90

53 lines
950 B
Fortran
Raw Normal View History

2019-03-13 11:07:31 +01:00
subroutine W38_lda_correlation_energy(nGrid,weight,rho,Ec)
! Compute Wigner's LDA correlation energy
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: nGrid
double precision,intent(in) :: weight(nGrid)
double precision,intent(in) :: rho(nGrid,nspin)
! Local variables
integer :: iG
double precision :: ra,rb,r
double precision :: a,d,epsc
! Output variables
double precision :: Ec(nsp)
! Coefficients for Wigner's LDA correlation
a = 0.04918d0
d = 0.349d0
! Compute LDA correlation energy
Ec(:) = 0d0
do iG=1,nGrid
ra = max(0d0,rho(iG,1))
rb = max(0d0,rho(iG,2))
if(ra > threshold .and. rb > threshold) then
r = ra + rb
epsc = ra*rb/(r + d*r**(2d0/3d0))
Ec(2) = Ec(2) + weight(iG)*epsc
endif
enddo
Ec(2) = -4d0*a*Ec(2)
end subroutine W38_lda_correlation_energy