4
1
mirror of https://github.com/pfloos/quack synced 2024-06-02 11:25:28 +02:00
quack/src/GW/GW_QP_graph.f90

85 lines
2.2 KiB
Fortran
Raw Normal View History

2023-10-02 21:37:25 +02:00
subroutine GW_QP_graph(eta,nBas,nC,nO,nV,nR,nS,eHF,Om,rho,eGWlin,eOld,eGW,Z)
2020-03-12 15:04:16 +01:00
! Compute the graphical solution of the QP equation
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: nBas
integer,intent(in) :: nC
integer,intent(in) :: nO
integer,intent(in) :: nV
integer,intent(in) :: nR
integer,intent(in) :: nS
2023-08-24 00:02:23 +02:00
2020-03-12 15:04:16 +01:00
double precision,intent(in) :: eta
double precision,intent(in) :: eHF(nBas)
2023-07-27 17:43:18 +02:00
double precision,intent(in) :: Om(nS)
2020-03-12 15:04:16 +01:00
double precision,intent(in) :: rho(nBas,nBas,nS)
double precision,intent(in) :: eGWlin(nBas)
2023-10-02 21:41:37 +02:00
double precision,intent(in) :: eOld(nBas)
2020-03-12 15:04:16 +01:00
! Local variables
integer :: p
integer :: nIt
integer,parameter :: maxIt = 64
double precision,parameter :: thresh = 1d-6
2023-07-27 16:43:15 +02:00
double precision,external :: GW_SigC,GW_dSigC
2023-08-24 11:18:12 +02:00
double precision :: SigC,dSigC
2020-03-12 15:04:16 +01:00
double precision :: f,df
double precision :: w
! Output variables
double precision,intent(out) :: eGW(nBas)
2023-07-27 21:23:40 +02:00
double precision,intent(out) :: Z(nBas)
2020-03-12 15:04:16 +01:00
! Run Newton's algorithm to find the root
2023-10-02 21:37:25 +02:00
2023-09-07 14:15:31 +02:00
write(*,*)'-----------------------------------------------------'
write(*,'(A5,1X,A3,1X,A15,1X,A15,1X,A10)') 'Orb.','It.','e_GWlin (eV)','e_GW (eV)','Z'
write(*,*)'-----------------------------------------------------'
2023-08-24 12:14:07 +02:00
2020-03-12 15:04:16 +01:00
do p=nC+1,nBas-nR
w = eGWlin(p)
nIt = 0
f = 1d0
do while (abs(f) > thresh .and. nIt < maxIt)
nIt = nIt + 1
2023-10-02 21:37:25 +02:00
SigC = GW_SigC(p,w,eta,nBas,nC,nO,nV,nR,nS,eOld,Om,rho)
dSigC = GW_dSigC(p,w,eta,nBas,nC,nO,nV,nR,nS,eOld,Om,rho)
2023-08-24 11:18:12 +02:00
f = w - eHF(p) - SigC
df = 1d0/(1d0 - dSigC)
2023-07-27 21:23:40 +02:00
w = w - df*f
2020-03-12 15:04:16 +01:00
end do
if(nIt == maxIt) then
2023-07-27 21:23:40 +02:00
eGW(p) = eGWlin(p)
2023-09-07 14:15:31 +02:00
write(*,'(I5,1X,I3,1X,F15.9,1X,F15.9,1X,F10.6,1X,A12)') p,nIt,eGWlin(p)*HaToeV,eGW(p)*HaToeV,Z(p),'Cvg Failed!'
2020-03-12 15:04:16 +01:00
else
eGW(p) = w
2023-07-27 21:23:40 +02:00
Z(p) = df
2020-03-12 15:04:16 +01:00
2023-09-07 14:15:31 +02:00
write(*,'(I5,1X,I3,1X,F15.9,1X,F15.9,1X,F10.6)') p,nIt,eGWlin(p)*HaToeV,eGW(p)*HaToeV,Z(p)
2020-03-12 15:04:16 +01:00
end if
end do
2023-11-29 16:20:53 +01:00
2023-11-27 23:25:10 +01:00
write(*,*)'-----------------------------------------------------'
write(*,*)
2020-03-12 15:04:16 +01:00
2023-07-27 16:43:15 +02:00
end subroutine