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

196 lines
5.1 KiB
Fortran
Raw Normal View History

2021-03-07 22:19:42 +01:00
subroutine unrestricted_self_energy_GF2(nBas,nC,nO,nV,nR,eta,ERI_aa,ERI_ab,ERI_bb,eHF,eGF2,SigC,Z)
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
! Perform unrestricted GF2 self-energy and its renormalization factor
2021-03-07 17:17:18 +01:00
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: nBas
integer,intent(in) :: nC(nspin)
integer,intent(in) :: nO(nspin)
integer,intent(in) :: nV(nspin)
integer,intent(in) :: nR(nspin)
2021-03-07 22:19:42 +01:00
double precision,intent(in) :: eta
2021-03-07 17:17:18 +01:00
double precision,intent(in) :: ERI_aa(nBas,nBas,nBas,nBas)
double precision,intent(in) :: ERI_ab(nBas,nBas,nBas,nBas)
double precision,intent(in) :: ERI_bb(nBas,nBas,nBas,nBas)
2021-03-07 22:19:42 +01:00
double precision,intent(in) :: eHF(nBas,nspin)
double precision,intent(in) :: eGF2(nBas,nspin)
2021-03-07 17:17:18 +01:00
! Local variables
2021-03-07 22:19:42 +01:00
integer :: p,q
2021-03-07 17:17:18 +01:00
integer :: i,j,a,b
2021-03-07 22:19:42 +01:00
double precision :: eps,num
2021-03-07 17:17:18 +01:00
! Output variables
2021-03-07 22:19:42 +01:00
double precision,intent(out) :: SigC(nBas,nBas,nspin)
double precision,intent(out) :: Z(nBas,nspin)
2021-03-07 17:17:18 +01:00
!---------------------!
2021-03-07 22:19:42 +01:00
! Compute self-energy |
2021-03-07 17:17:18 +01:00
!---------------------!
2021-03-08 17:00:05 +01:00
SigC(:,:,:) = 0d0
2021-03-23 19:50:46 +01:00
Z(:,:) = 0d0
2021-03-08 17:00:05 +01:00
2021-03-07 22:19:42 +01:00
!----------------!
! Spin-up sector
!----------------!
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
do p=nC(1)+1,nBas-nR(1)
do q=nC(1)+1,nBas-nR(1)
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
! Addition part: aa
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
do i=nC(1)+1,nO(1)
do a=nO(1)+1,nBas-nR(1)
do b=nO(1)+1,nBas-nR(1)
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
eps = eGF2(p,1) + eHF(i,1) - eHF(a,1) - eHF(b,1)
num = ERI_aa(i,q,a,b)*ERI_aa(a,b,i,p) &
- ERI_aa(i,q,a,b)*ERI_aa(a,b,p,i)
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
SigC(p,q,1) = SigC(p,q,1) + num*eps/(eps**2 + eta**2)
if(p == q) Z(p,1) = Z(p,1) - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
enddo
enddo
enddo
! Addition part: ab
do i=nC(2)+1,nO(2)
do a=nO(2)+1,nBas-nR(2)
do b=nO(1)+1,nBas-nR(1)
eps = eGF2(p,1) + eHF(i,2) - eHF(a,2) - eHF(b,1)
num = ERI_ab(q,i,b,a)*ERI_ab(b,a,p,i)
SigC(p,q,1) = SigC(p,q,1) + num*eps/(eps**2 + eta**2)
if(p == q) Z(p,1) = Z(p,1) - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
enddo
2021-03-07 17:17:18 +01:00
enddo
enddo
2021-03-07 22:19:42 +01:00
! Removal part: aa
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
do i=nC(1)+1,nO(1)
do a=nO(1)+1,nBas-nR(1)
do j=nC(1)+1,nO(1)
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
eps = eGF2(p,1) + eHF(a,1) - eHF(i,1) - eHF(j,1)
num = ERI_aa(a,q,i,j)*ERI_aa(i,j,a,p) &
- ERI_aa(a,q,i,j)*ERI_aa(i,j,p,a)
SigC(p,q,1) = SigC(p,q,1) + num*eps/(eps**2 + eta**2)
if(p == q) Z(p,1) = Z(p,1) - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
enddo
enddo
enddo
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
! Removal part: ab
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
do i=nC(2)+1,nO(2)
do a=nO(2)+1,nBas-nR(2)
do j=nC(1)+1,nO(1)
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
eps = eGF2(p,1) + eHF(a,2) - eHF(i,2) - eHF(j,1)
num = ERI_ab(q,a,j,i)*ERI_ab(j,i,p,a)
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
SigC(p,q,1) = SigC(p,q,1) + num*eps/(eps**2 + eta**2)
if(p == q) Z(p,1) = Z(p,1) - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
enddo
2021-03-07 17:17:18 +01:00
enddo
enddo
2021-03-07 22:19:42 +01:00
2021-03-07 17:17:18 +01:00
enddo
enddo
2021-03-07 22:19:42 +01:00
!------------------!
! Spin-down sector !
!------------------!
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
do p=nC(2)+1,nBas-nR(2)
do q=nC(2)+1,nBas-nR(2)
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
! Addition part: bb
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
do i=nC(2)+1,nO(2)
do a=nO(2)+1,nBas-nR(2)
do b=nO(2)+1,nBas-nR(2)
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
eps = eGF2(p,2) + eHF(i,2) - eHF(a,2) - eHF(b,2)
num = ERI_bb(i,q,a,b)*ERI_bb(a,b,i,p) &
- ERI_bb(i,q,a,b)*ERI_bb(a,b,p,i)
SigC(p,q,2) = SigC(p,q,2) + num*eps/(eps**2 + eta**2)
if(p == q) Z(p,2) = Z(p,2) - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
enddo
enddo
enddo
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
! Addition part: ab
do i=nC(1)+1,nO(1)
do a=nO(1)+1,nBas-nR(1)
do b=nO(2)+1,nBas-nR(2)
eps = eGF2(p,2) + eHF(i,1) - eHF(a,1) - eHF(b,2)
num = ERI_ab(i,q,a,b)*ERI_ab(a,b,i,p)
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
SigC(p,q,2) = SigC(p,q,2) + num*eps/(eps**2 + eta**2)
if(p == q) Z(p,2) = Z(p,2) - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
enddo
enddo
enddo
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
! Removal part: bb
2021-03-07 17:17:18 +01:00
2021-03-07 22:19:42 +01:00
do i=nC(2)+1,nO(2)
do a=nO(2)+1,nBas-nR(2)
do j=nC(2)+1,nO(2)
eps = eGF2(p,2) + eHF(a,2) - eHF(i,2) - eHF(j,2)
num = ERI_bb(a,q,i,j)*ERI_bb(i,j,a,p) &
- ERI_bb(a,q,i,j)*ERI_bb(i,j,p,a)
SigC(p,q,2) = SigC(p,q,2) + num*eps/(eps**2 + eta**2)
if(p == q) Z(p,2) = Z(p,2) - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
enddo
2021-03-07 17:17:18 +01:00
enddo
enddo
2021-03-07 22:19:42 +01:00
! Removal part: ab
do i=nC(1)+1,nO(1)
do a=nO(1)+1,nBas-nR(1)
do j=nC(2)+1,nO(2)
eps = eGF2(p,2) + eHF(a,1) - eHF(i,1) - eHF(j,2)
num = ERI_ab(a,q,i,j)*ERI_ab(i,j,a,p)
SigC(p,q,2) = SigC(p,q,2) + num*eps/(eps**2 + eta**2)
if(p == q) Z(p,2) = Z(p,2) - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
enddo
enddo
enddo
2021-03-07 17:17:18 +01:00
enddo
enddo
2021-03-07 22:19:42 +01:00
Z(:,:) = 1d0/(1d0 - Z(:,:))
end subroutine unrestricted_self_energy_GF2