4
1
mirror of https://github.com/pfloos/quack synced 2024-11-14 18:13:59 +01:00
quack/src/eDFT/elda_correlation_individual_energy.f90

58 lines
1.3 KiB
Fortran
Raw Normal View History

2020-03-31 22:15:45 +02:00
subroutine elda_correlation_individual_energy(aLF,nGrid,weight,rhow,rho,Ec)
2019-03-13 11:07:31 +01:00
! Compute LDA correlation individual energy of 2-glomium for various states
implicit none
include 'parameters.h'
! Input variables
2020-03-31 22:15:45 +02:00
double precision,intent(in) :: aLF(3)
2019-03-13 11:07:31 +01:00
integer,intent(in) :: nGrid
double precision,intent(in) :: weight(nGrid)
double precision,intent(in) :: rhow(nGrid,nspin)
double precision,intent(in) :: rho(nGrid,nspin)
! Local variables
integer :: iG
double precision :: ra, rb, r
double precision :: raI,rbI,rI
double precision :: ec_p,dFcdr
! Output variables
double precision,intent(out) :: Ec(nsp)
! Compute eLDA correlation potential
Ec(:) = 0d0
do iG=1,nGrid
2020-03-31 12:39:26 +02:00
ra = max(0d0,rhow(iG,1))
rb = max(0d0,rhow(iG,2))
2019-03-13 11:07:31 +01:00
raI = max(0d0,rho(iG,1))
rbI = max(0d0,rho(iG,2))
r = ra + rb
rI = raI + rbI
2020-07-06 15:42:21 +02:00
if(r > threshold .or. rI > threshold) then
2019-03-13 11:07:31 +01:00
ec_p = aLF(1)/(1d0 + aLF(2)*r**(-1d0/6d0) + aLF(3)*r**(-1d0/3d0))
dFcdr = aLF(2)*r**(-1d0/6d0) + 2d0*aLF(3)*r**(-1d0/3d0)
dFcdr = dFcdr/(1d0 + aLF(2)*r**(-1d0/6d0) + aLF(3)*r**(-1d0/3d0))
dFcdr = ec_p*dFcdr/(6d0*r)
dFcdr = ec_p + dFcdr*r
Ec(2) = Ec(2) + weight(iG)*rI*dFcdr
end if
end do
end subroutine elda_correlation_individual_energy