10
1
mirror of https://github.com/pfloos/quack synced 2025-01-08 20:33:19 +01:00
QuAcK/src/GW/RGW_self_energy.f90

154 lines
3.4 KiB
Fortran
Raw Normal View History

2024-09-11 15:09:40 +02:00
subroutine RGW_self_energy(eta,nBas,nOrb,nC,nO,nV,nR,nS,e,Om,rho,EcGM,Sig,Z)
2019-03-19 10:13:33 +01:00
2023-07-12 14:13:45 +02:00
! Compute 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
double precision,intent(in) :: eta
2021-12-17 11:41:40 +01:00
integer,intent(in) :: nBas
2024-09-11 15:09:40 +02:00
integer,intent(in) :: nOrb
2021-12-17 11:41:40 +01:00
integer,intent(in) :: nC
integer,intent(in) :: nO
integer,intent(in) :: nV
integer,intent(in) :: nR
integer,intent(in) :: nS
2024-09-11 15:09:40 +02:00
double precision,intent(in) :: e(nOrb)
2023-07-21 13:04:29 +02:00
double precision,intent(in) :: Om(nS)
2024-09-11 15:09:40 +02:00
double precision,intent(in) :: rho(nOrb,nOrb,nS)
2019-03-19 10:13:33 +01:00
! Local variables
2021-03-01 14:55:29 +01:00
integer :: i,j,a,b
2023-07-23 22:03:42 +02:00
integer :: p,q,m
2023-07-12 14:13:45 +02:00
double precision :: num,eps
2019-03-19 10:13:33 +01:00
! Output variables
double precision,intent(out) :: EcGM
2024-09-11 15:09:40 +02:00
double precision,intent(out) :: Sig(nOrb,nOrb)
double precision,intent(out) :: Z(nOrb)
2019-03-19 10:13:33 +01:00
!----------------!
! GW self-energy !
!----------------!
2019-03-19 10:13:33 +01:00
2024-09-11 15:09:40 +02:00
Sig(:,:) = 0d0
! Occupied part of the correlation self-energy
2024-09-11 15:09:40 +02:00
!$OMP PARALLEL &
!$OMP SHARED(Sig,Z,rho,eta,nS,nC,nO,nOrb,nR,e,Om) &
!$OMP PRIVATE(m,i,q,p,eps,num) &
!$OMP DEFAULT(NONE)
!$OMP DO
do q=nC+1,nOrb-nR
do p=nC+1,nOrb-nR
do m=1,nS
do i=nC+1,nO
2024-09-11 15:09:40 +02:00
eps = e(p) - e(i) + Om(m)
num = 2d0*rho(p,i,m)*rho(q,i,m)
Sig(p,q) = Sig(p,q) + num*eps/(eps**2 + eta**2)
2021-03-01 14:55:29 +01:00
end do
2024-09-11 15:09:40 +02:00
end do
end do
end do
!$OMP END DO
!$OMP END PARALLEL
! Virtual part of the correlation self-energy
2024-09-11 15:09:40 +02:00
!$OMP PARALLEL &
!$OMP SHARED(Sig,Z,rho,eta,nS,nC,nO,nOrb,nR,e,Om) &
!$OMP PRIVATE(m,a,q,p,eps,num) &
!$OMP DEFAULT(NONE)
!$OMP DO
do q=nC+1,nOrb-nR
do p=nC+1,nOrb-nR
do m=1,nS
do a=nO+1,nOrb-nR
eps = e(p) - e(a) - Om(m)
num = 2d0*rho(p,a,m)*rho(q,a,m)
Sig(p,q) = Sig(p,q) + num*eps/(eps**2 + eta**2)
end do
end do
end do
end do
!$OMP END DO
!$OMP END PARALLEL
!------------------------!
! Renormalization factor !
!------------------------!
Z(:) = 0d0
! Occupied part of the renormalization factor
!$OMP PARALLEL &
2024-09-11 15:09:40 +02:00
!$OMP SHARED(Sig,Z,rho,eta,nS,nC,nO,nOrb,nR,e,Om) &
2024-11-05 07:56:10 +01:00
!$OMP PRIVATE(m,i,p,eps,num) &
!$OMP DEFAULT(NONE)
2024-09-11 15:09:40 +02:00
!$OMP DO
do p=nC+1,nOrb-nR
do m=1,nS
do i=nC+1,nO
2019-03-19 10:13:33 +01:00
2024-09-11 15:09:40 +02:00
eps = e(p) - e(i) + Om(m)
2024-11-05 07:56:10 +01:00
num = 2d0*rho(p,i,m)*rho(p,i,m)
2024-09-11 15:09:40 +02:00
Z(p) = Z(p) - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
2019-03-19 10:13:33 +01:00
2021-03-01 14:55:29 +01:00
end do
end do
end do
2024-09-11 15:09:40 +02:00
!$OMP END DO
!$OMP END PARALLEL
! Virtual part of the renormalization factor
!$OMP PARALLEL &
!$OMP SHARED(Sig,Z,rho,eta,nS,nC,nO,nOrb,nR,e,Om) &
2024-11-05 07:56:10 +01:00
!$OMP PRIVATE(m,a,p,eps,num) &
2024-09-11 15:09:40 +02:00
!$OMP DEFAULT(NONE)
!$OMP DO
do p=nC+1,nOrb-nR
do m=1,nS
do a=nO+1,nOrb-nR
eps = e(p) - e(a) - Om(m)
2024-11-05 07:56:10 +01:00
num = 2d0*rho(p,a,m)*rho(p,a,m)
2024-09-11 15:09:40 +02:00
Z(p) = Z(p) - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
end do
end do
end do
!$OMP END DO
!$OMP END PARALLEL
2021-03-01 14:55:29 +01:00
2024-09-11 15:09:40 +02:00
Z(:) = 1d0/(1d0 - Z(:))
!-------------------------------------!
! Galitskii-Migdal correlation energy !
!-------------------------------------!
2021-03-01 14:55:29 +01:00
EcGM = 0d0
2023-07-23 22:03:42 +02:00
do m=1,nS
2024-09-11 15:09:40 +02:00
do a=nO+1,nOrb-nR
do i=nC+1,nO
2023-07-12 14:13:45 +02:00
2023-07-23 22:03:42 +02:00
eps = e(a) - e(i) + Om(m)
num = 4d0*rho(a,i,m)*rho(a,i,m)
EcGM = EcGM - num*eps/(eps**2 + eta**2)
2023-07-12 14:13:45 +02:00
2021-03-01 14:55:29 +01:00
end do
end do
end do
2019-03-19 10:13:33 +01:00
2023-07-04 10:44:20 +02:00
end subroutine