2024-01-30 12:06:21 +01:00
|
|
|
subroutine RGWC(dotest,eta,nBas,nC,nO,nV,nR,nS,Om,rho,eHF,eGW,Z)
|
2024-01-17 18:40:21 +01:00
|
|
|
|
|
|
|
! Perform GW+C calculation
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
include 'parameters.h'
|
|
|
|
|
|
|
|
! Input variables
|
|
|
|
|
|
|
|
logical,intent(in) :: dotest
|
|
|
|
|
2024-01-30 12:06:21 +01:00
|
|
|
double precision,intent(in) :: eta
|
2024-01-17 18:40:21 +01:00
|
|
|
integer,intent(in) :: nBas
|
2024-01-18 11:53:02 +01:00
|
|
|
integer,intent(in) :: nC
|
|
|
|
integer,intent(in) :: nO
|
2024-01-29 23:01:10 +01:00
|
|
|
integer,intent(in) :: nV
|
2024-01-18 11:53:02 +01:00
|
|
|
integer,intent(in) :: nR
|
|
|
|
integer,intent(in) :: nS
|
|
|
|
|
|
|
|
double precision,intent(in) :: Om(nS)
|
|
|
|
double precision,intent(in) :: rho(nBas,nBas,nS)
|
2024-01-29 23:01:10 +01:00
|
|
|
double precision,intent(in) :: eHF(nBas)
|
2024-01-17 18:40:21 +01:00
|
|
|
double precision,intent(in) :: eGW(nBas)
|
|
|
|
double precision,intent(in) :: Z(nBas)
|
|
|
|
|
|
|
|
! Local variables
|
|
|
|
|
2024-01-18 11:53:02 +01:00
|
|
|
integer :: p,q,i,a,m
|
|
|
|
integer :: iSat
|
2024-01-30 12:06:21 +01:00
|
|
|
double precision :: num,eps
|
|
|
|
double precision,parameter :: cutoff = 1d-2
|
2024-01-18 12:04:34 +01:00
|
|
|
|
|
|
|
logical,parameter :: do_hole_branch = .true.
|
|
|
|
logical,parameter :: do_electron_branch = .false.
|
2024-01-17 18:40:21 +01:00
|
|
|
|
2024-01-18 11:53:02 +01:00
|
|
|
double precision,allocatable :: de(:,:,:)
|
2024-01-17 18:40:21 +01:00
|
|
|
double precision,allocatable :: ZC(:)
|
2024-01-30 12:06:21 +01:00
|
|
|
double precision,allocatable :: ZSat(:,:,:)
|
|
|
|
double precision,allocatable :: eSat(:,:,:)
|
2024-01-17 18:40:21 +01:00
|
|
|
|
2024-01-29 23:01:10 +01:00
|
|
|
integer :: g
|
|
|
|
integer :: nGrid
|
|
|
|
double precision :: wmin,wmax,dw
|
|
|
|
double precision,external :: GW_ReSigC,GW_ImSigC,GW_RedSigC,GW_ImdSigC
|
|
|
|
double precision,allocatable :: w(:)
|
|
|
|
double precision,allocatable :: ReSigC(:,:),ImSigC(:,:)
|
|
|
|
double precision,allocatable :: RedSigC(:,:),ImdSigC(:,:)
|
|
|
|
double precision,allocatable :: AGWC(:,:)
|
|
|
|
|
2024-01-17 18:40:21 +01:00
|
|
|
! Output variables
|
|
|
|
|
|
|
|
! Hello world
|
|
|
|
|
|
|
|
write(*,*)
|
|
|
|
write(*,*)'*******************************'
|
|
|
|
write(*,*)'* Restricted GW+C Calculation *'
|
|
|
|
write(*,*)'*******************************'
|
|
|
|
write(*,*)
|
|
|
|
|
|
|
|
! Memory allocation
|
|
|
|
|
2024-01-30 12:06:21 +01:00
|
|
|
allocate(ZC(nBas),eSat(nBas,nBas,nS),ZSat(nBas,nBas,nS))
|
2024-01-18 11:53:02 +01:00
|
|
|
|
|
|
|
! Useful quantities
|
|
|
|
|
|
|
|
allocate(de(nBas,nBas,nS))
|
|
|
|
|
|
|
|
do p=nC+1,nBas-nR
|
|
|
|
do i=nC+1,nO
|
|
|
|
do m=1,nS
|
2024-01-30 12:06:21 +01:00
|
|
|
de(p,i,m) = eHF(p) - eGW(i) + Om(m)
|
2024-01-18 11:53:02 +01:00
|
|
|
end do
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
do p=nC+1,nBas-nR
|
|
|
|
do a=nO+1,nBas-nR
|
|
|
|
do m=1,nS
|
2024-01-30 12:06:21 +01:00
|
|
|
de(p,a,m) = eHF(p) - eGW(a) - Om(m)
|
2024-01-18 11:53:02 +01:00
|
|
|
end do
|
|
|
|
end do
|
|
|
|
end do
|
2024-01-17 18:40:21 +01:00
|
|
|
|
|
|
|
! GW+C weights
|
|
|
|
|
2024-01-18 11:53:02 +01:00
|
|
|
ZC(:) = 0d0
|
2024-01-17 18:40:21 +01:00
|
|
|
|
2024-01-18 11:53:02 +01:00
|
|
|
do p=nC+1,nBas-nR
|
|
|
|
do q=nC+1,nBas-nR
|
|
|
|
do m=1,nS
|
2024-01-30 12:06:21 +01:00
|
|
|
num = 2d0*rho(p,q,m)**2
|
|
|
|
eps = de(p,q,m)
|
|
|
|
ZC(p) = ZC(p) - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
|
2024-01-18 11:53:02 +01:00
|
|
|
end do
|
|
|
|
end do
|
|
|
|
end do
|
2024-01-17 18:40:21 +01:00
|
|
|
|
2024-01-30 12:06:21 +01:00
|
|
|
ZC(:) = exp(ZC(:))
|
2024-01-17 18:40:21 +01:00
|
|
|
|
|
|
|
! Dump results
|
|
|
|
|
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
write(*,*)' GW+C calculation '
|
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
write(*,'(1X,A1,1X,A3,1X,A1,1X,A15,1X,A1,1X,A15,1X,A1,1X,A15,1X,A1,1X,A15,1X,A1,1X)') &
|
2024-01-18 11:53:02 +01:00
|
|
|
'|','#','|','e_GW (eV)','|','e_GW+C (eV)','|','Z_GW','|','Z_GW+C','|'
|
2024-01-17 18:40:21 +01:00
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
|
|
|
|
do p=1,nBas
|
|
|
|
write(*,'(1X,A1,1X,I3,1X,A1,1X,F15.6,1X,A1,1X,F15.6,1X,A1,1X,F15.6,1X,A1,1X,F15.6,1X,A1,1X)') &
|
2024-01-18 11:53:02 +01:00
|
|
|
'|',p,'|',eGW(p)*HaToeV,'|',eGW(p)*HaToeV,'|',Z(p),'|',ZC(p),'|'
|
|
|
|
end do
|
|
|
|
|
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
write(*,*)
|
|
|
|
|
|
|
|
! GW+C satellites on hole branch
|
|
|
|
|
2024-01-18 12:04:34 +01:00
|
|
|
if(do_hole_branch) then
|
|
|
|
|
|
|
|
do i=nC+1,nO
|
2024-01-30 12:06:21 +01:00
|
|
|
do q=nC+1,nBas-nR
|
|
|
|
do m=1,nS
|
|
|
|
eps = de(i,q,m)
|
|
|
|
num = ZC(i)*2d0*rho(i,q,m)**2
|
|
|
|
eSat(i,q,m) = eGW(i) + eps
|
|
|
|
ZSat(i,q,m) = num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
|
2024-01-18 12:04:34 +01:00
|
|
|
end do
|
2024-01-18 11:53:02 +01:00
|
|
|
end do
|
|
|
|
end do
|
2024-01-18 12:04:34 +01:00
|
|
|
|
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
write(*,*)' Satellite series from GW+C on hole branch'
|
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
write(*,'(1X,A5,1X,A5,1X,A5,1X,A15,1X,A15,1X)') '#','i','m','e_Sat (eV)','Z_Sat'
|
|
|
|
|
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
iSat = 0
|
|
|
|
do i=nC+1,nO
|
2024-01-30 12:06:21 +01:00
|
|
|
do q=nC+1,nBas-nR
|
|
|
|
do m=1,nS
|
|
|
|
iSat = iSat + 1
|
|
|
|
if(ZSat(i,q,m) > cutoff) &
|
|
|
|
write(*,'(1X,I5,1X,I5,1X,I5,1X,I5,F15.6,1X,F15.6,1X)') iSat,i,q,m,eSat(i,q,m)*HaToeV,ZSat(i,q,m)
|
|
|
|
end do
|
2024-01-18 12:04:34 +01:00
|
|
|
end do
|
2024-01-18 11:53:02 +01:00
|
|
|
end do
|
2024-01-18 12:04:34 +01:00
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
write(*,*)
|
|
|
|
|
|
|
|
end if
|
2024-01-18 11:53:02 +01:00
|
|
|
|
|
|
|
! GW+C satellites on electron branch
|
2024-01-17 18:40:21 +01:00
|
|
|
|
2024-01-18 12:04:34 +01:00
|
|
|
if(do_electron_branch) then
|
|
|
|
|
|
|
|
do a=nO+1,nBas-nR
|
2024-01-30 12:06:21 +01:00
|
|
|
do q=nC+1,nBas-nR
|
|
|
|
do m=1,nS
|
|
|
|
eps = de(a,q,m)
|
|
|
|
num = ZC(a)*2d0*rho(a,q,m)**2
|
|
|
|
eSat(a,q,m) = eGW(a) + eps
|
|
|
|
ZSat(a,q,m) = num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
|
2024-01-18 12:04:34 +01:00
|
|
|
end do
|
2024-01-18 11:53:02 +01:00
|
|
|
end do
|
|
|
|
end do
|
2024-01-18 12:04:34 +01:00
|
|
|
|
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
write(*,*)' Satellite series from GW+C on electron branch'
|
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
write(*,'(1X,A5,1X,A5,1X,A5,1X,A15,1X,A15,1X)') '#','a','m','e_Sat (eV)','Z_Sat'
|
|
|
|
|
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
iSat = 0
|
|
|
|
do a=nO+1,nBas-nR
|
2024-01-30 12:06:21 +01:00
|
|
|
do q=nC+1,nBas-nR
|
|
|
|
do m=1,nS
|
|
|
|
iSat = iSat + 1
|
|
|
|
if(ZSat(a,q,m) > cutoff) &
|
|
|
|
write(*,'(1X,I5,1X,I5,I5,1X,1X,I5,F15.6,1X,F15.6,1X)') iSat,a,m,eSat(a,q,m)*HaToeV,ZSat(a,q,m)
|
|
|
|
end do
|
2024-01-18 12:04:34 +01:00
|
|
|
end do
|
2024-01-18 11:53:02 +01:00
|
|
|
end do
|
2024-01-18 12:04:34 +01:00
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
write(*,*)
|
|
|
|
|
|
|
|
end if
|
2024-01-17 18:40:21 +01:00
|
|
|
|
2024-01-29 23:01:10 +01:00
|
|
|
! Construct grid
|
|
|
|
|
|
|
|
nGrid = 1000
|
|
|
|
allocate(w(nGrid),AGWC(nBas,nGrid))
|
|
|
|
|
|
|
|
! Minimum and maximum frequency values
|
|
|
|
|
|
|
|
wmin = -5d0
|
|
|
|
wmax = +5d0
|
|
|
|
dw = (wmax - wmin)/dble(ngrid)
|
|
|
|
|
|
|
|
do g=1,nGrid
|
|
|
|
w(g) = wmin + dble(g)*dw
|
|
|
|
end do
|
|
|
|
|
|
|
|
! Compute QP part of the spectral function
|
|
|
|
|
|
|
|
allocate(ReSigC(nBas,nGrid),ImSigC(nBas,nGrid))
|
|
|
|
|
|
|
|
do g=1,nGrid
|
|
|
|
do p=nC+1,nBas-nR
|
|
|
|
ReSigC(p,g) = GW_ReSigC(p,eGW(p),eta,nBas,nC,nO,nV,nR,nS,eHF,Om,rho)
|
|
|
|
ImSigC(p,g) = GW_ImSigC(p,eGW(p),eta,nBas,nC,nO,nV,nR,nS,eHF,Om,rho)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
do g=1,nGrid
|
|
|
|
do p=nC+1,nBas-nR
|
|
|
|
AGWC(p,g) = ZC(p)*abs(ImSigC(p,g))/((w(g) - eGW(p))**2 + ImSigC(p,g)**2)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
AGWC(:,:) = AGWC(:,:)/pi
|
|
|
|
|
|
|
|
! Dump quantities in files as a function of w
|
|
|
|
|
|
|
|
open(unit=11 ,file='GWC_AQP.dat')
|
|
|
|
|
|
|
|
do g=1,nGrid
|
|
|
|
write(11,*) w(g)*HaToeV,(AGWC(p,g),p=nC+1,nBas-nR)
|
|
|
|
end do
|
|
|
|
|
|
|
|
! Closing files
|
|
|
|
|
|
|
|
close(unit=11)
|
|
|
|
|
|
|
|
! Compute cumulant part of the spectral function
|
|
|
|
|
|
|
|
AGWC(:,:) = 0d0
|
|
|
|
|
|
|
|
if(do_hole_branch) then
|
|
|
|
|
|
|
|
do g=1,nGrid
|
|
|
|
do i=nC+1,nO
|
2024-01-30 12:06:21 +01:00
|
|
|
do q=nC+1,nBas-nR
|
|
|
|
do m=1,nS
|
|
|
|
AGWC(i,g) = AGWC(i,g) + ZSat(i,q,m)*abs(ImSigC(i,g))/((w(g) - eSat(i,q,m))**2 + ImSigC(i,g)**2)
|
|
|
|
end do
|
2024-01-29 23:01:10 +01:00
|
|
|
end do
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
if(do_electron_branch) then
|
|
|
|
|
|
|
|
do g=1,nGrid
|
|
|
|
do a=nO+1,nBas-nR
|
2024-01-30 12:06:21 +01:00
|
|
|
do q=nC+1,nBas-nR
|
|
|
|
do m=1,nS
|
|
|
|
AGWC(a,g) = AGWC(a,g) + ZSat(a,q,m)*abs(ImSigC(a,g))/((w(g) - eSat(a,q,m))**2 + ImSigC(a,g)**2)
|
|
|
|
end do
|
2024-01-29 23:01:10 +01:00
|
|
|
end do
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
AGWC(:,:) = AGWC(:,:)/pi
|
|
|
|
|
|
|
|
! Dump quantities in files as a function of w
|
|
|
|
|
|
|
|
open(unit=12 ,file='GWC_AC.dat')
|
|
|
|
|
|
|
|
do g=1,nGrid
|
|
|
|
write(12,*) w(g)*HaToeV,(AGWC(p,g),p=nC+1,nBas-nR)
|
|
|
|
end do
|
|
|
|
|
|
|
|
! Closing files
|
|
|
|
|
|
|
|
close(unit=12)
|
|
|
|
|
2024-01-17 18:40:21 +01:00
|
|
|
! Testing zone
|
|
|
|
|
|
|
|
! if(dotest) then
|
|
|
|
|
|
|
|
! call dump_test_value('R','G0W0 correlation energy',EcRPA)
|
|
|
|
! call dump_test_value('R','G0W0 HOMO energy',eGW(nO))
|
|
|
|
! call dump_test_value('R','G0W0 LUMO energy',eGW(nO+1))
|
|
|
|
|
|
|
|
! end if
|
|
|
|
|
|
|
|
end subroutine
|