10
1
mirror of https://github.com/pfloos/quack synced 2025-01-06 11:28:45 +01:00
QuAcK/src/GW/GW_self_energy_diag.f90

129 lines
2.8 KiB
Fortran
Raw Normal View History

2023-07-12 14:13:45 +02:00
subroutine GW_self_energy_diag(COHSEX,eta,nBas,nC,nO,nV,nR,nS,e,Omega,rho,EcGM,Sig,Z)
2019-03-19 10:13:33 +01:00
2023-07-12 14:13:45 +02:00
! Compute diagonal of the correlation part of the self-energy and the renormalization factor
2019-03-19 10:13:33 +01:00
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
2023-07-12 14:13:45 +02:00
double precision :: num,eps
2019-03-19 10:13:33 +01:00
! Output variables
2023-07-12 14:13:45 +02:00
double precision,intent(out) :: Sig(nBas)
double precision,intent(out) :: Z(nBas)
2019-03-19 10:13:33 +01:00
double precision,intent(out) :: EcGM
! Initialize
2023-07-12 14:13:45 +02:00
Sig(:) = 0d0
Z(:) = 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
2023-07-12 14:13:45 +02:00
Sig(p) = Sig(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
2023-07-12 14:13:45 +02:00
Sig(p) = Sig(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
2023-07-12 14:13:45 +02:00
EcGM = EcGM - Sig(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
2023-07-12 14:13:45 +02:00
2020-09-21 23:04:26 +02:00
eps = e(p) - e(i) + Omega(jb)
2023-07-12 14:13:45 +02:00
num = 2d0*rho(p,i,jb)**2
Sig(p) = Sig(p) + num*eps/(eps**2 + eta**2)
Z(p) = Z(p) - num*(eps**2 - eta**2)/(eps**2 + eta**2)**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
2023-07-12 14:13:45 +02:00
2020-09-21 23:04:26 +02:00
eps = e(p) - e(a) - Omega(jb)
2023-07-12 14:13:45 +02:00
num = 2d0*rho(p,a,jb)**2
Sig(p) = Sig(p) + num*eps/(eps**2 + eta**2)
Z(p) = Z(p) - num*(eps**2 - eta**2)/(eps**2 + eta**2)**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
2023-07-12 14:13:45 +02:00
2020-09-21 23:04:26 +02:00
eps = e(a) - e(i) + Omega(jb)
2023-07-12 14:13:45 +02:00
num = 4d0*rho(a,i,jb)**2
EcGM = EcGM - num*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-12 14:13:45 +02:00
! Compute renormalization factor from derivative
Z(:) = 1d0/(1d0 - Z(:))
2023-07-04 10:44:20 +02:00
end subroutine