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

45 lines
812 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
2020-10-14 15:07:35 +02:00
use xc_f90_lib_m
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
2020-10-14 23:31:14 +02:00
double precision :: alpha,r,alphaw,a2,b2,c2,a1,b1,c1
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
! Cx coefficient for Slater LDA exchange
2019-03-13 11:07:31 +01:00
2020-10-14 23:31:14 +02:00
alpha = -(3d0/2d0)*(3d0/(4d0*pi))**(1d0/3d0)
2019-03-13 11:07:31 +01:00
2020-10-14 23:31:14 +02:00
! 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
2020-10-14 23:31:14 +02:00
Ex = Ex + weight(iG)*alpha*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