4
1
mirror of https://github.com/pfloos/quack synced 2024-11-13 09:34:04 +01:00
quack/src/eDFT/RS51_lda_exchange_energy.f90

39 lines
691 B
Fortran

subroutine RS51_lda_exchange_energy(nGrid,weight,rho,Ex)
! Compute restriced version of Slater's LDA exchange energy
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: nGrid
double precision,intent(in) :: weight(nGrid)
double precision,intent(in) :: rho(nGrid)
! Local variables
integer :: iG
double precision :: r
! Output variables
double precision :: Ex
! Compute LDA exchange energy
Ex = 0d0
do iG=1,nGrid
r = max(0d0,rho(iG))
if(r > threshold) then
Ex = Ex + weight(iG)*CxLDA*r**(4d0/3d0)
endif
enddo
end subroutine RS51_lda_exchange_energy