4
1
mirror of https://github.com/pfloos/quack synced 2024-11-09 07:33:55 +01:00
quack/src/GW/GW_self_energy.f90

134 lines
3.0 KiB
Fortran
Raw Normal View History

2023-07-04 10:44:20 +02:00
subroutine GW_self_energy(COHSEX,eta,nBas,nC,nO,nV,nR,nS,e,Omega,rho,EcGM,SigC)
2019-03-19 10:13:33 +01:00
! Compute 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
2021-12-17 11:41:40 +01:00
integer,intent(in) :: nBas
integer,intent(in) :: nC
integer,intent(in) :: nO
integer,intent(in) :: nV
integer,intent(in) :: nR
integer,intent(in) :: nS
2019-09-22 21:15:53 +02:00
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
2021-03-01 14:55:29 +01:00
integer :: i,j,a,b
integer :: p,q,r
integer :: 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) :: EcGM
2022-01-06 13:48:15 +01:00
double precision,intent(out) :: SigC(nBas,nBas)
2019-03-19 10:13:33 +01:00
! Initialize
2021-03-01 14:55:29 +01:00
SigC(:,:) = 0d0
2019-03-19 10:13:33 +01:00
2020-09-24 11:56:06 +02:00
!-----------------------------!
! COHSEX static approximation !
!-----------------------------!
2019-03-19 10:13:33 +01:00
if(COHSEX) then
2019-07-15 14:19:45 +02:00
! COHSEX: SEX of the COHSEX correlation self-energy
2019-03-19 10:13:33 +01:00
2021-03-01 14:55:29 +01:00
do p=nC+1,nBas-nR
do q=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
2021-03-01 14:55:29 +01:00
SigC(p,q) = SigC(p,q) + 4d0*rho(p,i,jb)*rho(q,i,jb)/Omega(jb)
end do
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
2021-03-01 14:55:29 +01:00
do p=nC+1,nBas-nR
do q=nC+1,nBas-nR
do r=nC+1,nBas-nR
2020-09-21 23:04:26 +02:00
do jb=1,nS
2021-03-01 14:55:29 +01:00
SigC(p,q) = SigC(p,q) - 2d0*rho(p,r,jb)*rho(q,r,jb)/Omega(jb)
end do
end do
end do
end do
2019-03-19 10:13:33 +01:00
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,i)
2021-03-01 14:55:29 +01:00
end do
2019-03-19 10:13:33 +01:00
else
2020-09-24 11:56:06 +02:00
!----------------!
! GW self-energy !
!----------------!
2019-03-19 10:13:33 +01:00
! Occupied part of the correlation self-energy
2023-03-14 14:11:54 +01:00
!$OMP PARALLEL &
!$OMP SHARED(SigC,rho,eta,nS,nC,nO,nBas,nR,e,Omega) &
!$OMP PRIVATE(jb,i,q,p,eps) &
!$OMP DEFAULT(NONE)
!$OMP DO
do q=nC+1,nBas-nR
do p=nC+1,nBas-nR
do jb=1,nS
do i=nC+1,nO
2021-03-01 14:55:29 +01:00
eps = e(p) - e(i) + Omega(jb)
SigC(p,q) = SigC(p,q) + 2d0*rho(p,i,jb)*rho(q,i,jb)*eps/(eps**2 + eta**2)
2023-03-14 14:11:54 +01:00
end do
2021-03-01 14:55:29 +01:00
end do
2023-03-14 14:11:54 +01:00
end do
end do
!$OMP END DO
!$OMP END PARALLEL
2019-03-19 10:13:33 +01:00
! Virtual part of the correlation self-energy
2023-03-14 14:11:54 +01:00
!$OMP PARALLEL &
!$OMP SHARED(SigC,rho,eta,nS,nC,nO,nBas,nR,e,Omega) &
!$OMP PRIVATE(jb,a,q,p,eps) &
!$OMP DEFAULT(NONE)
!$OMP DO
do q=nC+1,nBas-nR
do p=nC+1,nBas-nR
do jb=1,nS
do a=nO+1,nBas-nR
2021-03-01 14:55:29 +01:00
eps = e(p) - e(a) - Omega(jb)
SigC(p,q) = SigC(p,q) + 2d0*rho(p,a,jb)*rho(q,a,jb)*eps/(eps**2 + eta**2)
2023-03-14 14:11:54 +01:00
end do
2021-03-01 14:55:29 +01:00
end do
2023-03-14 14:11:54 +01:00
end do
end do
!$OMP END DO
!$OMP END PARALLEL
2021-03-01 14:55:29 +01:00
2022-01-06 13:48:15 +01:00
! Galitskii-Migdal correlation energy
2021-03-01 14:55:29 +01:00
EcGM = 0d0
do jb=1,nS
2021-03-01 14:55:29 +01:00
do a=nO+1,nBas-nR
do i=nC+1,nO
2021-03-01 14:55:29 +01:00
eps = e(a) - e(i) + Omega(jb)
EcGM = EcGM - 4d0*rho(a,i,jb)*rho(a,i,jb)*eps/(eps**2 + eta**2)
end do
end do
end do
end if
2019-03-19 10:13:33 +01:00
2023-07-04 10:44:20 +02:00
end subroutine