4
1
mirror of https://github.com/pfloos/quack synced 2024-06-26 15:12:17 +02:00
quack/src/eDFT/S51_lda_exchange_energy.f90

35 lines
649 B
Fortran
Raw Normal View History

2022-01-07 09:13:38 +01:00
subroutine S51_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
2021-12-01 10:54:51 +01:00
r = max(0d0,rho(iG))
2019-03-13 11:07:31 +01:00
2021-12-01 10:54:51 +01:00
if(r > threshold) Ex = Ex + weight(iG)*CxLSDA*r**(1d0/3d0)*r
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
2022-01-07 09:13:38 +01:00
end subroutine S51_lda_exchange_energy