4
1
mirror of https://github.com/pfloos/quack synced 2024-06-20 04:02:18 +02:00
quack/src/GT/GTeh_self_energy.f90
2023-07-04 09:27:35 +02:00

95 lines
2.2 KiB
Fortran

subroutine GTeh_self_energy(eta,nBas,nC,nO,nV,nR,nS,e,Om,rhoL,rhoR,EcGM,SigC)
! Compute correlation part of the self-energy for GTeh
implicit none
include 'parameters.h'
! Input variables
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) :: Om(nS)
double precision,intent(in) :: rhoL(nBas,nBas,nS)
double precision,intent(in) :: rhoR(nBas,nBas,nS)
! Local variables
integer :: i,j,a,b
integer :: p,q,r
integer :: m
double precision :: eps
! Output variables
double precision,intent(out) :: EcGM
double precision,intent(out) :: SigC(nBas,nBas)
! Initialize
SigC(:,:) = 0d0
!----------------!
! GW self-energy !
!----------------!
! Occupied part of the correlation self-energy
!$OMP PARALLEL &
!$OMP SHARED(SigC,rho,eta,nS,nC,nO,nBas,nR,e,Om) &
!$OMP PRIVATE(m,i,q,p,eps) &
!$OMP DEFAULT(NONE)
!$OMP DO
do q=nC+1,nBas-nR
do p=nC+1,nBas-nR
do m=1,nS
do i=nC+1,nO
eps = e(p) - e(i) + Om(m)
SigC(p,q) = SigC(p,q) + rhoL(i,p,m)*rhoR(i,q,m)*eps/(eps**2 + eta**2)
end do
end do
end do
end do
!$OMP END DO
!$OMP END PARALLEL
! Virtual part of the correlation self-energy
!$OMP PARALLEL &
!$OMP SHARED(SigC,rho,eta,nS,nC,nO,nBas,nR,e,Om) &
!$OMP PRIVATE(m,a,q,p,eps) &
!$OMP DEFAULT(NONE)
!$OMP DO
do q=nC+1,nBas-nR
do p=nC+1,nBas-nR
do m=1,nS
do a=nO+1,nBas-nR
eps = e(p) - e(a) - Om(m)
SigC(p,q) = SigC(p,q) + rhoL(p,a,m)*rhoR(q,a,m)*eps/(eps**2 + eta**2)
end do
end do
end do
end do
!$OMP END DO
!$OMP END PARALLEL
! Galitskii-Migdal correlation energy
EcGM = 0d0
do m=1,nS
do a=nO+1,nBas-nR
do i=nC+1,nO
eps = e(a) - e(i) + Om(m)
EcGM = EcGM - rhoL(i,a,m)*rhoR(i,a,m)*eps/(eps**2 + eta**2)
end do
end do
end do
end subroutine