4
1
mirror of https://github.com/pfloos/quack synced 2024-06-23 21:52:20 +02:00
quack/src/eDFT/restricted_elda_correlation_energy.f90

40 lines
843 B
Fortran
Raw Normal View History

2020-03-27 20:46:13 +01:00
subroutine restricted_elda_correlation_energy(aMFL,nGrid,weight,rho,Ec)
2020-03-15 22:37:40 +01:00
! Compute the restricted LDA correlation energy of 2-glomium for various states
implicit none
include 'parameters.h'
! Input variables
2020-03-17 11:50:05 +01:00
double precision,intent(in) :: aMFL(3)
2020-03-15 22:37:40 +01:00
integer,intent(in) :: nGrid
double precision,intent(in) :: weight(nGrid)
double precision,intent(in) :: rho(nGrid)
! Local variables
integer :: iG
2020-03-17 19:35:00 +01:00
double precision :: r,e
2020-03-15 22:37:40 +01:00
! Output variables
double precision,intent(out) :: Ec
! Compute eLDA correlation energy
Ec = 0d0
do iG=1,nGrid
r = max(0d0,rho(iG))
if(r > threshold) then
2020-03-17 19:35:00 +01:00
e = aMFL(1)/(1d0 + aMFL(2)*r**(-1d0/6d0) + aMFL(3)*r**(-1d0/3d0))
Ec = Ec + weight(iG)*e*r
2020-03-15 22:37:40 +01:00
end if
end do
end subroutine restricted_elda_correlation_energy