4
1
mirror of https://github.com/pfloos/quack synced 2024-06-23 13:42:19 +02:00
quack/src/eDFT/US51_lda_exchange_energy.f90

39 lines
672 B
Fortran
Raw Normal View History

2020-10-14 23:31:14 +02:00
subroutine US51_lda_exchange_energy(nGrid,weight,rho,Ex)
2019-03-13 11:07:31 +01:00
! Compute 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
2021-02-15 17:27:06 +01:00
double precision :: r
2019-03-13 11:07:31 +01:00
2020-10-14 16:02:09 +02:00
! Output variables
2020-07-02 14:27:38 +02:00
2020-10-14 23:31:14 +02:00
double precision :: Ex
! Compute LDA exchange energy
2019-03-13 11:07:31 +01:00
2020-10-14 23:31:14 +02:00
Ex = 0d0
do iG=1,nGrid
2019-03-13 11:07:31 +01:00
2020-10-14 23:31:14 +02:00
r = max(0d0,rho(iG))
2019-03-13 11:07:31 +01:00
2020-10-14 23:31:14 +02:00
if(r > threshold) then
2019-03-13 11:07:31 +01:00
2021-02-15 17:27:06 +01:00
Ex = Ex + weight(iG)*CxLSDA*r**(4d0/3d0)
2019-03-13 11:07:31 +01:00
2020-10-14 23:31:14 +02:00
endif
2019-03-13 11:07:31 +01:00
2020-10-14 23:31:14 +02:00
enddo
2019-03-13 11:07:31 +01:00
2020-07-02 14:27:38 +02:00
end subroutine US51_lda_exchange_energy