4
1
mirror of https://github.com/pfloos/quack synced 2024-06-28 16:12:32 +02:00
quack/src/eDFT/S51_lda_exchange_individual_energy.f90

62 lines
1.4 KiB
Fortran
Raw Normal View History

2022-01-07 09:13:38 +01:00
subroutine S51_lda_exchange_individual_energy(nEns,nGrid,weight,rhow,rho,LZx,Ex)
2020-07-02 14:27:38 +02:00
! Compute the restricted version of Slater's LDA exchange individual energy
implicit none
include 'parameters.h'
! Input variables
2021-12-01 10:54:51 +01:00
integer,intent(in) :: nEns
2020-07-02 14:27:38 +02:00
integer,intent(in) :: nGrid
double precision,intent(in) :: weight(nGrid)
2021-12-01 10:54:51 +01:00
double precision,intent(in) :: rhow(nGrid,nspin)
double precision,intent(in) :: rho(nGrid,nspin,nEns)
2020-07-02 14:27:38 +02:00
! Local variables
integer :: iG
2021-12-01 10:54:51 +01:00
integer :: iEns
integer :: ispin
2021-11-29 23:32:49 +01:00
double precision :: r
2021-12-01 10:54:51 +01:00
double precision :: rI
double precision :: e
2021-11-29 23:32:49 +01:00
double precision :: dedr
2020-07-02 14:27:38 +02:00
! Output variables
2021-12-06 15:27:39 +01:00
double precision,intent(out) :: LZx(nspin)
2021-12-01 10:54:51 +01:00
double precision,intent(out) :: Ex(nspin,nEns)
2021-12-06 15:27:39 +01:00
LZx(:) = 0d0
2021-12-01 10:54:51 +01:00
Ex(:,:) = 0d0
do ispin=1,nspin
do iG=1,nGrid
r = max(0d0,rhow(iG,ispin))
2021-12-06 10:03:28 +01:00
if(r > threshold) then
e = CxLSDA*r**(+1d0/3d0)
dedr = 1d0/3d0*CxLSDA*r**(-2d0/3d0)
2021-12-06 15:27:39 +01:00
LZx(ispin) = LZx(ispin) - weight(iG)*dedr*r*r
2021-12-06 10:03:28 +01:00
do iEns=1,nEns
rI = max(0d0,rho(iG,ispin,iEns))
2021-12-07 09:41:14 +01:00
if(rI > threshold) Ex(ispin,iEns) = Ex(ispin,iEns) + weight(iG)*(e + dedr*r)*rI
2021-12-06 10:03:28 +01:00
end do
endif
2021-12-01 10:54:51 +01:00
enddo
2020-07-02 14:27:38 +02:00
enddo
2022-01-07 09:13:38 +01:00
end subroutine S51_lda_exchange_individual_energy