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

89 lines
2.6 KiB
Fortran
Raw Normal View History

2023-07-27 19:17:20 +02:00
subroutine GTpp_QP_graph(eta,nBas,nC,nO,nV,nR,nOOs,nVVs,nOOt,nVVt,eHF,Om1s,rho1s,Om2s,rho2s, &
2023-10-02 21:41:37 +02:00
Om1t,rho1t,Om2t,rho2t,eGTlin,eOld,eGT,Z)
2023-06-30 19:17:35 +02:00
! Compute the graphical solution of the QP equation
2023-07-03 14:33:48 +02:00
implicit none
include 'parameters.h'
! Input variables
2023-06-30 19:17:35 +02:00
integer,intent(in) :: nBas
integer,intent(in) :: nC
integer,intent(in) :: nO
integer,intent(in) :: nV
integer,intent(in) :: nR
2023-07-27 19:17:20 +02:00
integer,intent(in) :: nOOs,nOOt
integer,intent(in) :: nVVs,nVVt
2023-06-30 19:17:35 +02:00
double precision,intent(in) :: eta
double precision,intent(in) :: eHF(nBas)
2023-07-27 19:17:20 +02:00
double precision,intent(in) :: Om1s(nVVs),Om1t(nVVt)
double precision,intent(in) :: rho1s(nBas,nBas,nVVs),rho1t(nBas,nBas,nVVt)
double precision,intent(in) :: Om2s(nOOs),Om2t(nOOt)
double precision,intent(in) :: rho2s(nBas,nBas,nOOs),rho2t(nBas,nBas,nOOt)
2023-06-30 19:17:35 +02:00
double precision,intent(in) :: eGTlin(nBas)
2023-10-02 21:41:37 +02:00
double precision,intent(in) :: eOld(nBas)
2023-06-30 19:17:35 +02:00
! Local variables
2023-06-30 19:17:35 +02:00
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 :: GTpp_SigC,GTpp_dSigC
2023-08-24 11:18:12 +02:00
double precision :: SigC,dSigC
2023-06-30 19:17:35 +02:00
double precision :: f,df
double precision :: w
! Output variables
2023-07-27 21:23:40 +02:00
2023-06-30 19:17:35 +02:00
double precision,intent(out) :: eGT(nBas)
2023-07-27 21:23:40 +02:00
double precision,intent(out) :: Z(nBas)
2023-06-30 19:17:35 +02:00
! Run Newton's algorithm to find the root
2023-09-07 14:15:31 +02:00
write(*,*)'-----------------------------------------------------'
write(*,'(A5,1X,A3,1X,A15,1X,A15,1X,A10)') 'Orb.','It.','e_GTpplin (eV)','e_GTpplin (eV)','Z'
write(*,*)'-----------------------------------------------------'
2023-08-24 12:14:07 +02:00
do p=nC+1,nBas-nR
2023-06-30 19:17:35 +02:00
w = eGTlin(p)
nIt = 0
f = 1d0
do while (abs(f) > thresh .and. nIt < maxIt)
nIt = nIt + 1
2023-06-30 19:17:35 +02:00
2023-10-02 21:41:37 +02:00
SigC = GTpp_SigC(p,w,eta,nBas,nC,nO,nV,nR,nOOs,nVVs,nOOt,nVVt,eOld,Om1s,rho1s,Om2s,rho2s,Om1t,rho1t,Om2t,rho2t)
dSigC = GTpp_dSigC(p,w,eta,nBas,nC,nO,nV,nR,nOOs,nVVs,nOOt,nVVt,eOld,Om1s,rho1s,Om2s,rho2s,Om1t,rho1t,Om2t,rho2t)
f = w - eHF(p) - SigC
df = 1d0/(1d0 - dSigC)
w = w - df*f
2023-06-30 19:17:35 +02:00
end do
if(nIt == maxIt) then
2023-07-27 21:23:40 +02:00
eGT(p) = eGTlin(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,eGTlin(p)*HaToeV,eGT(p)*HaToeV,Z(p),'Cvg Failed!'
2023-07-27 21:23:40 +02:00
2023-06-30 19:17:35 +02:00
else
2023-07-27 21:23:40 +02:00
2023-06-30 19:17:35 +02:00
eGT(p) = w
2023-07-27 21:23:40 +02:00
Z(p) = df
2023-09-07 14:15:31 +02:00
write(*,'(I5,1X,I3,1X,F15.9,1X,F15.9,1X,F10.6)') p,nIt,eGTlin(p)*HaToeV,eGT(p)*HaToeV,Z(p)
2023-06-30 19:17:35 +02:00
end if
end do
2023-08-24 12:14:07 +02:00
2023-09-07 14:15:31 +02:00
write(*,*)'-----------------------------------------------------'
2023-08-24 12:14:07 +02:00
write(*,*)
2023-06-30 19:17:35 +02:00
2023-07-27 16:43:15 +02:00
end subroutine