4
1
mirror of https://github.com/pfloos/quack synced 2024-06-22 21:22:20 +02:00
quack/src/GW/GW_self_energy_diag.f90

112 lines
2.4 KiB
Fortran
Raw Normal View History

2023-07-04 10:44:20 +02:00
subroutine GW_self_energy_diag(COHSEX,eta,nBas,nC,nO,nV,nR,nS,e,Omega,rho,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
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)
2019-03-19 10:13:33 +01:00
! Local variables
2020-09-21 23:04:26 +02:00
integer :: i,a,p,q,jb
2019-09-22 21:15:53 +02:00
double precision :: eps
2019-03-19 10:13:33 +01:00
! Output variables
double precision,intent(out) :: SigC(nBas)
double precision,intent(out) :: EcGM
! Initialize
2020-09-21 16:54:38 +02:00
SigC(:) = 0d0
2019-03-19 10:13:33 +01:00
2020-09-21 16:54:38 +02:00
!-----------------------------
! COHSEX static self-energy
!-----------------------------
2019-03-19 10:13:33 +01:00
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
2020-09-21 16:54:38 +02:00
do p=nC+1,nBas-nR
2019-03-19 10:13:33 +01:00
do i=nC+1,nO
2020-09-21 23:04:26 +02:00
do jb=1,nS
SigC(p) = SigC(p) + 4d0*rho(p,i,jb)**2/Omega(jb)
2020-09-21 16:54:38 +02:00
end do
end do
end do
2019-03-19 10:13:33 +01:00
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
2020-09-21 16:54:38 +02:00
do p=nC+1,nBas-nR
do q=nC+1,nBas-nR
2020-09-21 23:04:26 +02:00
do jb=1,nS
SigC(p) = SigC(p) - 2d0*rho(p,q,jb)**2/Omega(jb)
2020-09-21 16:54:38 +02:00
end do
end do
end do
2019-03-19 10:13:33 +01:00
! 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
2020-09-22 15:32:26 +02:00
EcGM = EcGM - SigC(i)
2020-09-21 16:54:38 +02:00
end do
!-----------------------------
! GW self-energy
!-----------------------------
2019-03-19 10:13:33 +01:00
else
! Occupied part of the correlation self-energy
2020-09-21 16:54:38 +02:00
do p=nC+1,nBas-nR
2019-03-19 10:13:33 +01:00
do i=nC+1,nO
2020-09-21 23:04:26 +02:00
do jb=1,nS
eps = e(p) - e(i) + Omega(jb)
SigC(p) = SigC(p) + 2d0*rho(p,i,jb)**2*eps/(eps**2 + eta**2)
2020-09-21 16:54:38 +02:00
end do
end do
end do
2019-03-19 10:13:33 +01:00
! Virtual part of the correlation self-energy
2020-09-21 16:54:38 +02:00
do p=nC+1,nBas-nR
2019-03-19 10:13:33 +01:00
do a=nO+1,nBas-nR
2020-09-21 23:04:26 +02:00
do jb=1,nS
eps = e(p) - e(a) - Omega(jb)
SigC(p) = SigC(p) + 2d0*rho(p,a,jb)**2*eps/(eps**2 + eta**2)
2020-09-21 16:54:38 +02:00
end do
end do
end do
2019-03-19 10:13:33 +01:00
! 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
2020-09-21 23:04:26 +02:00
do jb=1,nS
eps = e(a) - e(i) + Omega(jb)
2020-09-22 15:32:26 +02:00
EcGM = EcGM - 4d0*rho(a,i,jb)*rho(a,i,jb)*eps/(eps**2 + eta**2)
2020-09-21 16:54:38 +02:00
end do
end do
end do
2019-03-19 10:13:33 +01:00
2020-09-21 16:54:38 +02:00
end if
2023-07-04 10:44:20 +02:00
end subroutine