4
1
mirror of https://github.com/pfloos/quack synced 2024-11-09 07:33:55 +01:00
quack/src/eDFT/US51_lda_exchange_energy.f90

35 lines
651 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
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
2020-07-02 14:27:38 +02:00
end subroutine US51_lda_exchange_energy