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

49 lines
931 B
Fortran
Raw Normal View History

2020-07-06 20:57:27 +02:00
subroutine UG96_gga_exchange_energy(nGrid,weight,rho,drho,Ex)
2019-03-13 11:07:31 +01:00
! Compute Gill's 96 GGA 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)
2021-02-12 10:41:01 +01:00
double precision,intent(in) :: drho(ncart,nGrid)
2019-03-13 11:07:31 +01:00
! Local variables
integer :: iG
2021-02-15 17:27:06 +01:00
double precision :: beta
2019-03-13 11:07:31 +01:00
double precision :: r,g
! Output variables
double precision :: Ex
! Coefficients for G96 GGA exchange functional
beta = 1d0/137d0
! Compute GGA exchange energy
Ex = 0d0
do iG=1,nGrid
r = max(0d0,rho(iG))
if(r > threshold) then
g = drho(1,iG)**2 + drho(2,iG)**2 + drho(3,iG)**2
2021-02-15 17:27:06 +01:00
Ex = Ex + weight(iG)*r**(4d0/3d0)*(CxLSDA - beta*g**(3d0/4d0)/r**2)
2019-03-13 11:07:31 +01:00
end if
end do
2020-07-06 20:57:27 +02:00
end subroutine UG96_gga_exchange_energy