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

51 lines
1.2 KiB
Fortran
Raw Normal View History

2020-03-31 22:15:45 +02:00
subroutine restricted_elda_correlation_individual_energy(aMFL,nGrid,weight,rhow,rho,Ec)
2020-03-15 22:37:40 +01:00
! Compute LDA correlation individual energy of 2-glomium for various states
implicit none
include 'parameters.h'
! Input variables
2020-03-31 22:15:45 +02:00
double precision,intent(in) :: aMFL(3)
2020-03-15 22:37:40 +01:00
integer,intent(in) :: nGrid
double precision,intent(in) :: weight(nGrid)
double precision,intent(in) :: rhow(nGrid)
double precision,intent(in) :: rho(nGrid)
! Local variables
integer :: iG
double precision :: r
double precision :: rI
double precision :: ec_p,dFcdr
! Output variables
double precision,intent(out) :: Ec
! Compute eLDA correlation potential
Ec = 0d0
do iG=1,nGrid
2020-03-31 12:39:26 +02:00
r = max(0d0,rhow(iG))
2020-03-15 22:37:40 +01:00
rI = max(0d0,rho(iG))
2020-07-06 15:42:21 +02:00
if(r > threshold .or. rI > threshold) then
2020-03-15 22:37:40 +01:00
2020-03-31 22:15:45 +02:00
ec_p = aMFL(1)/(1d0 + aMFL(2)*r**(-1d0/6d0) + aMFL(3)*r**(-1d0/3d0))
2020-03-15 22:37:40 +01:00
2020-03-31 22:15:45 +02:00
dFcdr = aMFL(2)*r**(-1d0/6d0) + 2d0*aMFL(3)*r**(-1d0/3d0)
dFcdr = dFcdr/(1d0 + aMFL(2)*r**(-1d0/6d0) + aMFL(3)*r**(-1d0/3d0))
2020-03-15 22:37:40 +01:00
dFcdr = ec_p*dFcdr/(6d0*r)
2020-03-30 23:51:47 +02:00
Ec = Ec + weight(iG)*(ec_p*rI + dFcdr*r*rI - dFcdr*r*r)
2020-03-15 22:37:40 +01:00
end if
end do
end subroutine restricted_elda_correlation_individual_energy