From 97d5958add2dfdb9dd15aec57f0663c53e67b5f2 Mon Sep 17 00:00:00 2001 From: Pierre-Francois Loos Date: Thu, 19 Mar 2020 10:59:20 +0100 Subject: [PATCH] GF clean up --- input/options | 2 +- src/QuAcK/G0F2.f90 | 54 +++++++++------------------------------- src/QuAcK/print_G0F2.f90 | 27 ++++++++++---------- 3 files changed, 27 insertions(+), 56 deletions(-) diff --git a/input/options b/input/options index a3963bf..b94b9a1 100644 --- a/input/options +++ b/input/options @@ -7,7 +7,7 @@ # CIS/TDHF/BSE: singlet triplet T T # GF: maxSCF thresh DIIS n_diis lin renorm - 256 0.00001 T 5 T 3 + 256 0.00001 T 5 F 3 # GW: maxSCF thresh DIIS n_diis COHSEX SOSEX BSE TDA G0W GW0 lin eta 256 0.00001 T 5 F F T F F F T 0.000 # ACFDT: AC Kx XBS diff --git a/src/QuAcK/G0F2.f90 b/src/QuAcK/G0F2.f90 index f78ef91..bc7511c 100644 --- a/src/QuAcK/G0F2.f90 +++ b/src/QuAcK/G0F2.f90 @@ -19,6 +19,7 @@ subroutine G0F2(linearize,nBas,nC,nO,nV,nR,V,e0) ! Local variables double precision :: eps + double precision :: VV double precision,allocatable :: eGF2(:) double precision,allocatable :: Bpp(:,:) double precision,allocatable :: Z(:) @@ -41,16 +42,17 @@ subroutine G0F2(linearize,nBas,nC,nO,nV,nR,V,e0) ! Frequency-dependent second-order contribution Bpp(:,:) = 0d0 + Z(:) = 0d0 do p=nC+1,nBas-nR do i=nC+1,nO do j=nC+1,nO do a=nO+1,nBas-nR - eps = eGF2(p) + e0(a) - e0(i) - e0(j) - - Bpp(p,1) = Bpp(p,1) & - + (2d0*V(p,a,i,j) - V(p,a,j,i))*V(p,a,i,j)/eps + eps = e0(p) + e0(a) - e0(i) - e0(j) + VV = (2d0*V(p,a,i,j) - V(p,a,j,i))*V(p,a,i,j) + Bpp(p,1) = Bpp(p,1) + VV/eps + Z(p) = Z(p) + VV/eps**2 end do end do @@ -62,49 +64,17 @@ subroutine G0F2(linearize,nBas,nC,nO,nV,nR,V,e0) do a=nO+1,nBas-nR do b=nO+1,nBas-nR - eps = eGF2(p) + e0(i) - e0(a) - e0(b) - - Bpp(p,2) = Bpp(p,2) & - + (2d0*V(p,i,a,b) - V(p,i,b,a))*V(p,i,a,b)/eps + eps = e0(p) + e0(i) - e0(a) - e0(b) + VV = (2d0*V(p,i,a,b) - V(p,i,b,a))*V(p,i,a,b) + Bpp(p,2) = Bpp(p,2) + VV/eps + Z(p) = Z(p) + VV/eps**2 end do end do end do end do - ! Compute the renormalization factor - - Z(:) = 0d0 - - do p=nC+1,nBas-nR - do i=nC+1,nO - do j=nC+1,nO - do a=nO+1,nBas-nR - - eps = eGF2(p) + e0(a) - e0(i) - e0(j) - - Z(p) = Z(p) - (2d0*V(p,a,i,j) - V(p,a,j,i))*V(p,a,i,j)/eps**2 - - end do - end do - end do - end do - - do p=nC+1,nBas-nR - do i=nC+1,nO - do a=nO+1,nBas-nR - do b=nO+1,nBas-nR - - eps = eGF2(p) + e0(i) - e0(a) - e0(b) - - Z(p) = Z(p) - (2d0*V(p,i,a,b) - V(p,i,b,a))*V(p,i,a,b)/eps**2 - - end do - end do - end do - end do - - Z(:) = 1d0/(1d0 - Z(:)) + Z(:) = 1d0/(1d0 + Z(:)) if(linearize) then @@ -117,6 +87,6 @@ subroutine G0F2(linearize,nBas,nC,nO,nV,nR,V,e0) end if ! Print results - call print_G0F2(nBas,nO,e0,eGF2) + call print_G0F2(nBas,nO,e0,eGF2,Z) end subroutine G0F2 diff --git a/src/QuAcK/print_G0F2.f90 b/src/QuAcK/print_G0F2.f90 index 479b959..1e80ac1 100644 --- a/src/QuAcK/print_G0F2.f90 +++ b/src/QuAcK/print_G0F2.f90 @@ -1,4 +1,4 @@ -subroutine print_G0F2(nBas,nO,eHF,eGF2) +subroutine print_G0F2(nBas,nO,eHF,eGF2,Z) ! Print one-electron energies and other stuff for G0F2 @@ -9,8 +9,9 @@ subroutine print_G0F2(nBas,nO,eHF,eGF2) integer,intent(in) :: nO double precision,intent(in) :: eHF(nBas) double precision,intent(in) :: eGF2(nBas) + double precision,intent(in) :: Z(nBas) - integer :: x + integer :: p integer :: HOMO integer :: LUMO double precision :: Gap @@ -19,27 +20,27 @@ subroutine print_G0F2(nBas,nO,eHF,eGF2) HOMO = nO LUMO = HOMO + 1 - Gap = eGF2(LUMO)-eGF2(HOMO) + Gap = eGF2(LUMO) - eGF2(HOMO) ! Dump results - write(*,*)'-------------------------------------------' + write(*,*)'--------------------------------------------------------' write(*,*)' Frequency-dependent G0F2 calculation' - write(*,*)'-------------------------------------------' - write(*,'(1X,A1,1X,A3,1X,A1,1X,A15,1X,A1,1X,A15,1X,A1,1X)') & - '|','#','|','e_HF (eV)','|','e_G0F2 (eV)','|' - write(*,*)'-------------------------------------------' + write(*,*)'--------------------------------------------------------' + write(*,'(1X,A1,1X,A3,1X,A1,1X,A15,1X,A1,1X,A15,1X,A1,1X,A10,1X,A1,1X)') & + '|','#','|','e_HF (eV)','|','e_G0F2 (eV)','|','Z','|' + write(*,*)'--------------------------------------------------------' - do x=1,nBas - write(*,'(1X,A1,1X,I3,1X,A1,1X,F15.6,1X,A1,1X,F15.6,1X,A1,1X)') & - '|',x,'|',eHF(x)*HaToeV,'|',eGF2(x)*HaToeV,'|' + do p=1,nBas + write(*,'(1X,A1,1X,I3,1X,A1,1X,F15.6,1X,A1,1X,F15.6,1X,A1,1X,F10.6,1X,A1,1X)') & + '|',p,'|',eHF(p)*HaToeV,'|',eGF2(p)*HaToeV,'|',Z(p),'|' enddo - write(*,*)'-------------------------------------------' + write(*,*)'--------------------------------------------------------' write(*,'(2X,A27,F15.6)') 'G0F2 HOMO energy (eV):',eGF2(HOMO)*HaToeV write(*,'(2X,A27,F15.6)') 'G0F2 LUMO energy (eV):',eGF2(LUMO)*HaToeV write(*,'(2X,A27,F15.6)') 'G0F2 HOMO-LUMO gap (eV):',Gap*HaToeV - write(*,*)'-------------------------------------------' + write(*,*)'--------------------------------------------------------' write(*,*) end subroutine print_G0F2