10
1
mirror of https://github.com/pfloos/quack synced 2024-12-25 22:03:44 +01:00
QuAcK/src/MBPT/print_qsGW.f90

119 lines
4.9 KiB
Fortran
Raw Normal View History

2020-10-21 12:58:37 +02:00
subroutine print_qsGW(nBas,nO,nSCF,Conv,thresh,eHF,eGW,c,ENuc,P,T,V,J,K,F,SigC,Z,EcRPA,EqsGW,dipole)
2019-03-19 10:13:33 +01:00
! Print one-electron energies and other stuff for qsGW
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: nBas,nO,nSCF
2020-10-21 12:09:18 +02:00
double precision,intent(in) :: ENuc,EcRPA,Conv,thresh
2019-03-19 10:13:33 +01:00
double precision,intent(in) :: eHF(nBas),eGW(nBas),c(nBas),P(nBas,nBas)
2020-10-06 14:24:54 +02:00
double precision,intent(in) :: T(nBas,nBas),V(nBas,nBas)
2019-03-19 10:13:33 +01:00
double precision,intent(in) :: J(nBas,nBas),K(nBas,nBas),F(nBas,nBas)
2020-01-15 22:29:43 +01:00
double precision,intent(in) :: Z(nBas),SigC(nBas,nBas)
2020-10-21 12:58:37 +02:00
double precision,intent(in) :: dipole(ncart)
2019-03-19 10:13:33 +01:00
! Local variables
2020-10-21 12:58:37 +02:00
integer :: x,ixyz,HOMO,LUMO
double precision :: Gap,ET,EV,EJ,Ex,Ec
2019-03-19 10:13:33 +01:00
double precision,external :: trace_matrix
! Output variables
double precision,intent(out) :: EqsGW
2019-03-19 10:13:33 +01:00
! HOMO and LUMO
HOMO = nO
LUMO = HOMO + 1
Gap = eGW(LUMO)-eGW(HOMO)
2020-11-03 21:47:57 +01:00
! Compute energies
2019-03-19 10:13:33 +01:00
ET = trace_matrix(nBas,matmul(P,T))
EV = trace_matrix(nBas,matmul(P,V))
EJ = 0.5d0*trace_matrix(nBas,matmul(P,J))
2019-03-19 11:21:34 +01:00
Ex = 0.25d0*trace_matrix(nBas,matmul(P,K))
2020-11-04 15:25:53 +01:00
Ec = 0d0
! Ec = -0.50d0*trace_matrix(nBas,matmul(P,SigC))
2020-01-15 22:29:43 +01:00
EqsGW = ET + EV + EJ + Ex + Ec
2019-03-19 10:13:33 +01:00
! Dump results
write(*,*)'-------------------------------------------------------------------------------'
if(nSCF < 10) then
write(*,'(1X,A21,I1,A1,I1,A12)')' Self-consistent qsG',nSCF,'W',nSCF,' calculation'
else
write(*,'(1X,A21,I2,A1,I2,A12)')' Self-consistent qsG',nSCF,'W',nSCF,' calculation'
endif
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)') &
2020-11-03 21:47:57 +01:00
'|','#','|','e_HF (eV)','|','Sig_c (eV)','|','Z','|','e_QP (eV)','|'
2019-03-19 10:13:33 +01:00
write(*,*)'-------------------------------------------------------------------------------'
do x=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)') &
2020-11-03 21:47:57 +01:00
'|',x,'|',eHF(x)*HaToeV,'|',SigC(x,x)*HaToeV,'|',Z(x),'|',eGW(x)*HaToeV,'|'
2019-03-19 10:13:33 +01:00
enddo
write(*,*)'-------------------------------------------------------------------------------'
write(*,'(2X,A10,I3)') 'Iteration ',nSCF
write(*,'(2X,A19,F15.5)')'max(|FPS - SPF|) = ',Conv
write(*,*)'-------------------------------------------'
2020-11-03 22:07:16 +01:00
write(*,'(2X,A30,F15.6,A3)') 'qsGW HOMO energy:',eGW(HOMO)*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'qsGW LUMO energy:',eGW(LUMO)*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'qsGW HOMO-LUMO gap :',Gap*HaToeV,' eV'
2019-03-19 10:13:33 +01:00
write(*,*)'-------------------------------------------'
2020-11-04 14:49:45 +01:00
write(*,'(2X,A30,F15.6,A3)') ' qsGW total energy:',EqsGW + ENuc,' au'
write(*,'(2X,A30,F15.6,A3)') ' qsGW exchange energy:',Ex,' au'
2020-11-04 15:25:53 +01:00
! write(*,'(2X,A30,F15.6,A3)') ' qsGW correlation energy:',Ec,' au'
2020-11-03 22:07:16 +01:00
write(*,'(2X,A30,F15.6,A3)') 'RPA@qsGW correlation energy:',EcRPA,' au'
2019-03-19 10:13:33 +01:00
write(*,*)'-------------------------------------------'
write(*,*)
! Dump results for final iteration
if(Conv < thresh) then
write(*,*)
write(*,'(A50)') '---------------------------------------'
write(*,'(A32)') ' Summary '
write(*,'(A50)') '---------------------------------------'
2020-11-03 22:07:16 +01:00
write(*,'(A32,1X,F16.10,A3)') ' One-electron energy: ',ET + EV,' au'
write(*,'(A32,1X,F16.10,A3)') ' Kinetic energy: ',ET,' au'
write(*,'(A32,1X,F16.10,A3)') ' Potential energy: ',EV,' au'
2019-03-19 10:13:33 +01:00
write(*,'(A50)') '---------------------------------------'
2020-11-03 22:07:16 +01:00
write(*,'(A32,1X,F16.10,A3)') ' Two-electron energy: ',EJ + Ex,' au'
2020-11-04 14:47:45 +01:00
write(*,'(A32,1X,F16.10,A3)') ' Hartree energy: ',EJ,' au'
2020-11-03 22:07:16 +01:00
write(*,'(A32,1X,F16.10,A3)') ' Exchange energy: ',Ex,' au'
2020-11-04 15:25:53 +01:00
! write(*,'(A32,1X,F16.10,A3)') ' Correlation energy: ',Ec,' au'
2019-03-19 10:13:33 +01:00
write(*,'(A50)') '---------------------------------------'
2020-11-03 22:07:16 +01:00
write(*,'(A32,1X,F16.10,A3)') ' Electronic energy: ',EqsGW,' au'
write(*,'(A32,1X,F16.10,A3)') ' Nuclear repulsion: ',ENuc,' au'
write(*,'(A32,1X,F16.10,A3)') ' qsGW energy: ',ENuc + EqsGW,' au'
2019-03-19 10:13:33 +01:00
write(*,'(A50)') '---------------------------------------'
2020-10-21 12:58:37 +02:00
write(*,'(A35)') ' Dipole moment (Debye) '
write(*,'(10X,4A10)') 'X','Y','Z','Tot.'
write(*,'(10X,4F10.6)') (dipole(ixyz)*auToD,ixyz=1,ncart),norm2(dipole)*auToD
write(*,'(A50)') '-----------------------------------------'
2019-03-19 10:13:33 +01:00
write(*,*)
write(*,'(A50)') '---------------------------------------'
write(*,'(A32)') ' qsGW MO coefficients'
write(*,'(A50)') '---------------------------------------'
call matout(nBas,nBas,c)
write(*,*)
write(*,'(A50)') '---------------------------------------'
write(*,'(A32)') ' qsGW MO energies'
write(*,'(A50)') '---------------------------------------'
call matout(nBas,1,eGW)
write(*,*)
endif
end subroutine print_qsGW