10
1
mirror of https://github.com/pfloos/quack synced 2025-01-10 04:58:20 +01:00
QuAcK/src/GW/print_qsUGW.f90

179 lines
8.8 KiB
Fortran
Raw Normal View History

2023-11-09 22:24:57 +01:00
subroutine print_qsUGW(nBas,nO,nSCF,Conv,thresh,eHF,eGW,cGW,Ov,ENuc,ET,EV,EJ,Ex,EcGM,EcRPA,EqsGW,SigC,Z,dipole)
2020-10-21 12:09:18 +02:00
! Print one-electron energies and other stuff for qsUGW
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: nBas
integer,intent(in) :: nO(nspin)
integer,intent(in) :: nSCF
double precision,intent(in) :: ENuc
2020-10-21 20:53:36 +02:00
double precision,intent(in) :: ET(nspin)
double precision,intent(in) :: EV(nspin)
double precision,intent(in) :: EJ(nsp)
double precision,intent(in) :: Ex(nspin)
2021-03-01 14:55:29 +01:00
double precision,intent(in) :: EcGM(nspin)
2020-10-21 12:09:18 +02:00
double precision,intent(in) :: EcRPA
2020-10-21 20:53:36 +02:00
double precision,intent(in) :: EqsGW
2020-10-21 12:09:18 +02:00
double precision,intent(in) :: Conv
double precision,intent(in) :: thresh
2020-11-03 21:47:57 +01:00
double precision,intent(in) :: eHF(nBas,nspin)
2020-10-21 12:09:18 +02:00
double precision,intent(in) :: eGW(nBas,nspin)
double precision,intent(in) :: cGW(nBas,nBas,nspin)
2020-10-21 20:53:36 +02:00
double precision,intent(in) :: Ov(nBas,nBas)
2020-10-21 12:09:18 +02:00
double precision,intent(in) :: SigC(nBas,nBas,nspin)
double precision,intent(in) :: Z(nBas,nspin)
double precision,intent(in) :: dipole(ncart)
! Local variables
2023-11-08 22:58:55 +01:00
logical :: dump_orb = .false.
2020-10-21 12:09:18 +02:00
integer :: p
integer :: ispin,ixyz
double precision :: HOMO(nspin)
double precision :: LUMO(nspin)
double precision :: Gap(nspin)
double precision :: S_exact,S2_exact
double precision :: S,S2
double precision,external :: trace_matrix
! HOMO and LUMO
do ispin=1,nspin
if(nO(ispin) > 0) then
HOMO(ispin) = eGW(nO(ispin),ispin)
LUMO(ispin) = eGW(nO(ispin)+1,ispin)
Gap(ispin) = LUMO(ispin) - HOMO(ispin)
else
HOMO(ispin) = 0d0
LUMO(ispin) = eGW(1,ispin)
Gap(ispin) = 0d0
end if
end do
S2_exact = dble(nO(1) - nO(2))/2d0*(dble(nO(1) - nO(2))/2d0 + 1d0)
S2 = S2_exact + nO(2) - sum(matmul(transpose(cGW(:,1:nO(1),1)),matmul(Ov,cGW(:,1:nO(2),2)))**2)
S_exact = 0.5d0*dble(nO(1) - nO(2))
S = -0.5d0 + 0.5d0*sqrt(1d0 + 4d0*S2)
! Dump results
2023-11-14 22:00:23 +01:00
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
2023-11-09 17:22:01 +01:00
if(nSCF < 10) then
write(*,'(1X,A22,I1,A1,I1,A12)')' Self-consistent qsUG',nSCF,'W',nSCF,' calculation'
elseif(nSCF < 100) then
write(*,'(1X,A22,I2,A1,I2,A12)')' Self-consistent qsUG',nSCF,'W',nSCF,' calculation'
else
write(*,'(1X,A22,I3,A1,I3,A12)')' Self-consistent qsUG',nSCF,'W',nSCF,' calculation'
end if
2023-11-14 22:00:23 +01:00
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
2020-10-21 12:09:18 +02:00
write(*,'(A1,A3,A1,A30,A1,A30,A1,A30,A1,A30,A1)') &
2023-11-09 17:22:01 +01:00
'|',' ','|','e_HF ','|','Sig_GW ','|','Z ','|','e_GW ','|'
2020-10-21 12:09:18 +02:00
write(*,'(A1,A3,A1,2A15,A1,2A15,A1,2A15,A1,2A15,A1)') &
'|','#','|','up ','dw ','|','up ','dw ','|','up ','dw ','|','up ','dw ','|'
2023-11-14 22:00:23 +01:00
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
2020-10-21 12:09:18 +02:00
do p=1,nBas
write(*,'(A1,I3,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1)') &
2020-11-03 21:47:57 +01:00
'|',p,'|',eHF(p,1)*HaToeV,eHF(p,2)*HaToeV,'|',SigC(p,p,1)*HaToeV,SigC(p,p,2)*HaToeV,'|', &
2020-10-21 12:09:18 +02:00
Z(p,1),Z(p,2),'|',eGW(p,1)*HaToeV,eGW(p,2)*HaToeV,'|'
enddo
2023-11-14 22:00:23 +01:00
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
2020-10-21 12:09:18 +02:00
write(*,'(2X,A10,I3)') 'Iteration ',nSCF
2021-03-27 15:03:54 +01:00
write(*,'(2X,A14,F15.5)')'Convergence = ',Conv
2023-11-14 22:00:23 +01:00
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
2023-11-09 17:22:01 +01:00
write(*,'(2X,A30,F15.6,A3)') 'qsUGW HOMO energy = ',maxval(HOMO(:))*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'qsUGW LUMO energy = ',minval(LUMO(:))*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'qsUGW HOMO-LUMO gap = ',(minval(LUMO(:))-maxval(HOMO(:)))*HaToeV,' eV'
2023-11-14 22:00:23 +01:00
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
2023-11-09 17:22:01 +01:00
write(*,'(2X,A30,F15.6,A3)') ' qsUGW total energy = ',ENuc + EqsGW,' au'
write(*,'(2X,A30,F15.6,A3)') ' qsUGW exchange energy = ',sum(Ex(:)),' au'
write(*,'(2X,A30,F15.6,A3)') ' GM@qsUGW correlation energy = ',sum(EcGM(:)),' au'
write(*,'(2X,A30,F15.6,A3)') 'RPA@qsUGW correlation energy = ',EcRPA,' au'
2023-11-14 22:00:23 +01:00
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
2020-10-21 12:09:18 +02:00
write(*,*)
! Dump results for final iteration
if(Conv < thresh) then
write(*,*)
write(*,'(A60)') '-------------------------------------------------'
write(*,'(A40)') ' Summary '
write(*,'(A60)') '-------------------------------------------------'
2023-11-09 17:22:01 +01:00
write(*,'(A40,1X,F16.10,A3)') ' One-electron energy = ',sum(ET(:)) + sum(EV(:)),' au'
write(*,'(A40,1X,F16.10,A3)') ' One-electron a energy = ',ET(1) + EV(1),' au'
write(*,'(A40,1X,F16.10,A3)') ' One-electron b energy = ',ET(2) + EV(2),' au'
2020-10-21 12:09:18 +02:00
write(*,*)
2023-11-09 17:22:01 +01:00
write(*,'(A40,1X,F16.10,A3)') ' Kinetic energy = ',sum(ET(:)),' au'
write(*,'(A40,1X,F16.10,A3)') ' Kinetic a energy = ',ET(1),' au'
write(*,'(A40,1X,F16.10,A3)') ' Kinetic b energy = ',ET(2),' au'
2020-10-21 12:09:18 +02:00
write(*,*)
2023-11-09 17:22:01 +01:00
write(*,'(A40,1X,F16.10,A3)') ' Potential energy = ',sum(EV(:)),' au'
write(*,'(A40,1X,F16.10,A3)') ' Potential a energy = ',EV(1),' au'
write(*,'(A40,1X,F16.10,A3)') ' Potential b energy = ',EV(2),' au'
2020-10-21 12:09:18 +02:00
write(*,'(A60)') '-------------------------------------------------'
2023-11-09 17:22:01 +01:00
write(*,'(A40,1X,F16.10,A3)') ' Two-electron energy = ',sum(EJ(:)) + sum(Ex(:)),' au'
write(*,'(A40,1X,F16.10,A3)') ' Two-electron aa energy = ',EJ(1) + Ex(1),' au'
write(*,'(A40,1X,F16.10,A3)') ' Two-electron ab energy = ',EJ(2),' au'
write(*,'(A40,1X,F16.10,A3)') ' Two-electron bb energy = ',EJ(3) + Ex(2),' au'
2020-10-21 12:09:18 +02:00
write(*,*)
2023-11-09 17:22:01 +01:00
write(*,'(A40,1X,F16.10,A3)') ' Hartree energy = ',sum(EJ(:)),' au'
write(*,'(A40,1X,F16.10,A3)') ' Hartree aa energy = ',EJ(1),' au'
write(*,'(A40,1X,F16.10,A3)') ' Hartree ab energy = ',EJ(2),' au'
write(*,'(A40,1X,F16.10,A3)') ' Hartree bb energy = ',EJ(3),' au'
2020-10-21 12:09:18 +02:00
write(*,*)
2023-11-09 17:22:01 +01:00
write(*,'(A40,1X,F16.10,A3)') ' Exchange energy = ',sum(Ex(:)),' au'
write(*,'(A40,1X,F16.10,A3)') ' Exchange a energy = ',Ex(1),' au'
write(*,'(A40,1X,F16.10,A3)') ' Exchange b energy = ',Ex(2),' au'
2021-03-01 14:55:29 +01:00
write(*,*)
2023-11-09 17:22:01 +01:00
write(*,'(A40,1X,F16.10,A3)') ' Correlation energy = ',sum(EcGM(:)),' au'
write(*,'(A40,1X,F16.10,A3)') ' Correlation aa energy = ',EcGM(1),' au'
write(*,'(A40,1X,F16.10,A3)') ' Correlation bb energy = ',EcGM(2),' au'
2020-10-21 12:09:18 +02:00
write(*,'(A60)') '-------------------------------------------------'
2023-11-09 17:22:01 +01:00
write(*,'(A40,1X,F16.10,A3)') ' Electronic energy = ',EqsGW,' au'
write(*,'(A40,1X,F16.10,A3)') ' Nuclear repulsion = ',ENuc,' au'
write(*,'(A40,1X,F16.10,A3)') ' qsUGW energy = ',ENuc + EqsGW,' au'
2020-10-21 12:09:18 +02:00
write(*,'(A60)') '-------------------------------------------------'
2023-11-09 17:22:01 +01:00
write(*,'(A40,F13.6)') ' S (exact) = ',2d0*S_exact + 1d0
write(*,'(A40,F13.6)') ' S = ',2d0*S + 1d0
write(*,'(A40,F13.6)') ' <S**2> (exact) = ',S2_exact
write(*,'(A40,F13.6)') ' <S**2> = ',S2
2020-10-21 12:09:18 +02:00
write(*,'(A60)') '-------------------------------------------------'
write(*,'(A45)') ' Dipole moment (Debye) '
write(*,'(19X,4A10)') 'X','Y','Z','Tot.'
2023-11-09 09:37:21 +01:00
write(*,'(19X,4F10.4)') (dipole(ixyz)*auToD,ixyz=1,ncart),norm2(dipole)*auToD
2020-10-21 12:09:18 +02:00
write(*,'(A60)') '-------------------------------------------------'
write(*,*)
2020-12-10 09:19:58 +01:00
! Print orbitals
2023-11-08 22:58:55 +01:00
if(dump_orb) then
write(*,'(A50)') '-----------------------------------------'
write(*,'(A50)') 'qsUGW spin-up orbital coefficients '
write(*,'(A50)') '-----------------------------------------'
call matout(nBas,nBas,cGW(:,:,1))
write(*,*)
write(*,'(A50)') '-----------------------------------------'
write(*,'(A50)') 'qsUGW spin-down orbital coefficients '
write(*,'(A50)') '-----------------------------------------'
call matout(nBas,nBas,cGW(:,:,2))
write(*,*)
end if
2020-12-10 09:19:58 +01:00
2023-11-08 22:58:55 +01:00
end if
2020-10-21 12:09:18 +02:00
2023-07-28 15:00:17 +02:00
end subroutine