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

49 lines
960 B
Fortran
Raw Normal View History

2020-07-06 20:57:27 +02:00
subroutine UB88_gga_exchange_energy(nGrid,weight,rho,drho,Ex)
2019-03-13 11:07:31 +01:00
2020-03-28 22:52:45 +01:00
! Compute Becke's 88 GGA exchange energy
2019-03-13 11:07:31 +01:00
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: nGrid
double precision,intent(in) :: weight(nGrid)
double precision,intent(in) :: rho(nGrid)
double precision,intent(in) :: drho(3,nGrid)
! Local variables
integer :: iG
2021-02-15 17:27:06 +01:00
double precision :: b
2019-03-13 11:07:31 +01:00
double precision :: r,g,x
! Output variables
double precision :: Ex
! Coefficients for B88 GGA exchange functional
2021-02-12 16:47:40 +01:00
b = 0.0042d0
2019-03-13 11:07:31 +01:00
! 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
x = sqrt(g)/r**(4d0/3d0)
2021-02-15 17:27:06 +01:00
Ex = Ex + weight(iG)*r**(4d0/3d0)*(CxLSDA - b*x**2/(1d0 + 6d0*b*x*asinh(x)))
2019-03-13 11:07:31 +01:00
end if
end do
2020-07-06 20:57:27 +02:00
end subroutine UB88_gga_exchange_energy