4
1
mirror of https://github.com/pfloos/quack synced 2024-11-09 15:43:56 +01:00
quack/src/QuAcK/self_energy_correlation_diag.f90

182 lines
4.3 KiB
Fortran
Raw Normal View History

2019-09-22 21:15:53 +02:00
subroutine self_energy_correlation_diag(COHSEX,SOSEX,eta,nBas,nC,nO,nV,nR,nS,e,Omega,rho,rhox,EcGM,SigC)
2019-03-19 10:13:33 +01:00
! Compute diagonal of the correlation part of the self-energy
implicit none
include 'parameters.h'
! Input variables
2019-09-22 21:15:53 +02:00
logical,intent(in) :: COHSEX
logical,intent(in) :: SOSEX
double precision,intent(in) :: eta
integer,intent(in) :: nBas
integer,intent(in) :: nC
integer,intent(in) :: nO
integer,intent(in) :: nV
integer,intent(in) :: nR
integer,intent(in) :: nS
double precision,intent(in) :: e(nBas)
double precision,intent(in) :: Omega(nS)
double precision,intent(in) :: rho(nBas,nBas,nS)
double precision,intent(in) :: rhox(nBas,nBas,nS)
2019-03-19 10:13:33 +01:00
! Local variables
2019-07-15 14:19:45 +02:00
integer :: i,j,a,b,p,x,jb
2019-09-22 21:15:53 +02:00
double precision :: eps
2019-03-19 10:13:33 +01:00
double precision,external :: SigC_dcgw
! Output variables
double precision,intent(out) :: SigC(nBas)
double precision,intent(out) :: EcGM
! Initialize
SigC = 0d0
! COHSEX static approximation
if(COHSEX) then
2019-07-15 14:19:45 +02:00
! COHSEX: SEX part of the COHSEX correlation self-energy
2019-03-19 10:13:33 +01:00
do x=nC+1,nBas-nR
do i=nC+1,nO
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
2019-07-15 14:19:45 +02:00
SigC(x) = SigC(x) + 4d0*rho(x,i,jb)**2/Omega(jb)
2019-03-19 10:13:33 +01:00
enddo
enddo
enddo
enddo
2019-07-15 14:19:45 +02:00
! COHSEX: COH part of the COHSEX correlation self-energy
2019-03-19 10:13:33 +01:00
do x=nC+1,nBas-nR
2019-07-15 14:19:45 +02:00
do p=nC+1,nBas-nR
2019-03-19 10:13:33 +01:00
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
2019-07-15 14:19:45 +02:00
SigC(x) = SigC(x) - 2d0*rho(x,p,jb)**2/Omega(jb)
2019-03-19 10:13:33 +01:00
enddo
enddo
enddo
enddo
! GM correlation energy
2019-04-01 15:53:39 +02:00
EcGM = 0d0
2019-03-19 10:13:33 +01:00
do i=nC+1,nO
2019-05-04 17:13:50 +02:00
EcGM = EcGM + 0.5d0*SigC(i)
2019-03-19 10:13:33 +01:00
enddo
else
! Occupied part of the correlation self-energy
do x=nC+1,nBas-nR
do i=nC+1,nO
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
eps = e(x) - e(i) + Omega(jb)
! SigC(x) = SigC(x) + 4d0*rho(x,i,jb)**2/(eps + eps*sqrt(1d0 + rho(x,i,jb)**2/eps**2))
SigC(x) = SigC(x) + 2d0*rho(x,i,jb)**2*eps/(eps**2 + eta**2)
! SigC(x) = SigC(x) + 2d0*SigC_dcgw(eps,rho(x,i,jb))
enddo
enddo
enddo
enddo
! Virtual part of the correlation self-energy
do x=nC+1,nBas-nR
do a=nO+1,nBas-nR
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
eps = e(x) - e(a) - Omega(jb)
! SigC(x) = SigC(x) + 4d0*rho(x,a,jb)**2/(eps + eps*sqrt(1d0 + 4d0*rho(x,a,jb)**2/eps**2))
SigC(x) = SigC(x) + 2d0*rho(x,a,jb)**2*eps/(eps**2 + eta**2)
! SigC(x) = SigC(x) + 2d0*SigC_dcgw(eps,rho(x,a,jb))
enddo
enddo
enddo
enddo
! GM correlation energy
2019-04-01 15:53:39 +02:00
EcGM = 0d0
2019-03-19 10:13:33 +01:00
do i=nC+1,nO
do a=nO+1,nBas-nR
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
eps = e(a) - e(i) + Omega(jb)
2019-09-22 21:15:53 +02:00
EcGM = EcGM - 2d0*rho(a,i,jb)*rho(a,i,jb)*eps/(eps**2 + eta**2)
2019-03-19 10:13:33 +01:00
enddo
enddo
enddo
enddo
if(SOSEX) then
! SOSEX: occupied part of the correlation self-energy
do x=nC+1,nBas-nR
do i=nC+1,nO
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
eps = e(x) - e(i) + Omega(jb)
2019-09-22 21:15:53 +02:00
SigC(x) = SigC(x) - rho(x,i,jb)*rhox(x,i,jb)*eps/(eps**2 + eta**2)
2019-03-19 10:13:33 +01:00
enddo
enddo
enddo
enddo
! SOSEX: virtual part of the correlation self-energy
do x=nC+1,nBas-nR
do a=nO+1,nBas-nR
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
eps = e(x) - e(a) - Omega(jb)
2019-09-22 21:15:53 +02:00
SigC(x) = SigC(x) - rho(x,a,jb)*rhox(x,a,jb)*eps/(eps**2 + eta**2)
2019-03-19 10:13:33 +01:00
enddo
enddo
enddo
enddo
! GM correlation energy
do i=nC+1,nO
do a=nO+1,nBas-nR
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
eps = e(a) - e(i) + Omega(jb)
2019-09-22 21:15:53 +02:00
EcGM = EcGM + rho(a,i,jb)*rhox(a,i,jb)*eps/(eps**2 + eta**2)
2019-03-19 10:13:33 +01:00
enddo
enddo
enddo
enddo
endif
endif
end subroutine self_energy_correlation_diag