4
1
mirror of https://github.com/pfloos/quack synced 2024-07-17 00:20:37 +02:00
quack/src/eDFT/US51_lda_exchange_individual_energy.f90

87 lines
2.0 KiB
Fortran
Raw Normal View History

2021-12-06 10:03:28 +01:00
subroutine US51_lda_exchange_individual_energy(nEns,nGrid,weight,rhow,rho,doNcentered,kappa,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)
2021-12-06 10:03:28 +01:00
logical,intent(in) :: doNcentered
double precision,intent(in) :: kappa(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 10:03:28 +01:00
double precision,intent(out) :: LZx(nspin,nEns)
2021-12-01 10:54:51 +01:00
double precision,intent(out) :: Ex(nspin,nEns)
2021-12-06 10:03:28 +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(doNcentered) then
! if(r > threshold) then
! e = CxLSDA*r**(+1d0/3d0)
! dedr = 1d0/3d0*CxLSDA*r**(-2d0/3d0)
! do iEns=1,nEns
! rI = max(0d0,rho(iG,ispin,iEns))
! LZx(ispin,iEns) = LZx(ispin,iEns) - weight(iG)*kappa(iEns)*dedr*r*r
! if(rI > threshold) Ex(ispin,iEns) = Ex(ispin,iEns) + weight(iG)*(kappa(iEns)*e+dedr*r)*rI
! end do
! endif
! else
if(r > threshold) then
e = CxLSDA*r**(+1d0/3d0)
dedr = 1d0/3d0*CxLSDA*r**(-2d0/3d0)
LZx(ispin,:) = LZx(ispin,:) - weight(iG)*dedr*r*r
do iEns=1,nEns
rI = max(0d0,rho(iG,ispin,iEns))
if(rI > threshold) Ex(ispin,iEns) = Ex(ispin,iEns) + weight(iG)*(e+dedr*r)*rI
end do
endif
! endif
2021-12-01 10:54:51 +01:00
enddo
2020-07-02 14:27:38 +02:00
enddo
end subroutine US51_lda_exchange_individual_energy