10
1
mirror of https://github.com/pfloos/quack synced 2024-11-04 05:03:49 +01:00

remove SOSEX

This commit is contained in:
Pierre-Francois Loos 2023-07-04 10:37:54 +02:00
parent 812721e5d9
commit 490dd13c0d
8 changed files with 10 additions and 495 deletions

View File

@ -8,8 +8,8 @@
F T F T T F T F T T
# GF: maxSCF thresh DIIS n_diis lin eta renorm reg # GF: maxSCF thresh DIIS n_diis lin eta renorm reg
256 0.00001 T 5 T 0.0 0 F 256 0.00001 T 5 T 0.0 0 F
# GW: maxSCF thresh DIIS n_diis lin eta COHSEX SOSEX TDA_W reg # GW: maxSCF thresh DIIS n_diis lin eta COHSEX TDA_W reg
256 0.00001 T 5 T 0.0 F F F F 256 0.00001 T 5 T 0.0 F F F
# GT: maxSCF thresh DIIS n_diis lin eta TDA_T reg # GT: maxSCF thresh DIIS n_diis lin eta TDA_T reg
256 0.00001 T 5 T 0.1 F F 256 0.00001 T 5 T 0.1 F F
# ACFDT: AC Kx XBS # ACFDT: AC Kx XBS

View File

@ -1,197 +0,0 @@
subroutine G0W0_SOSEX(doACFDT,exchange_kernel,doXBS,BSE,TDA_W,TDA,dBSE,dTDA,evDyn,singlet,triplet,eta, &
nBas,nC,nO,nV,nR,nS,ENuc,ERHF,ERI_AO,ERI_MO,dipole_int,PHF,cHF,eHF,Vxc,eSOSEX)
! Perform the SOSEX extension of G0W0
implicit none
include 'parameters.h'
include 'quadrature.h'
! Input variables
logical,intent(in) :: doACFDT
logical,intent(in) :: exchange_kernel
logical,intent(in) :: doXBS
logical,intent(in) :: BSE
logical,intent(in) :: TDA_W
logical,intent(in) :: TDA
logical,intent(in) :: dBSE
logical,intent(in) :: dTDA
logical,intent(in) :: evDyn
logical,intent(in) :: singlet
logical,intent(in) :: triplet
double precision,intent(in) :: eta
integer,intent(in) :: nBas
integer,intent(in) :: nC
integer,intent(in) :: nO
integer,intent(in) :: nV
integer,intent(in) :: nR
integer,intent(in) :: nS
double precision,intent(in) :: ENuc
double precision,intent(in) :: ERHF
double precision,intent(in) :: ERI_AO(nBas,nBas,nBas,nBas)
double precision,intent(in) :: ERI_MO(nBas,nBas,nBas,nBas)
double precision,intent(in) :: dipole_int(nBas,nBas,ncart)
double precision,intent(in) :: Vxc(nBas)
double precision,intent(in) :: eHF(nBas)
double precision,intent(in) :: cHF(nBas,nBas)
double precision,intent(in) :: PHF(nBas,nBas)
! Local variables
logical :: print_W = .true.
integer :: ispin
double precision :: EcRPA(nspin)
double precision :: EcBSE(nspin)
double precision :: EcAC(nspin)
double precision :: EcGM
double precision,allocatable :: SigX(:)
double precision,allocatable :: SigC(:)
double precision,allocatable :: Z(:)
double precision,allocatable :: OmRPA(:,:)
double precision,allocatable :: XpY_RPA(:,:,:)
double precision,allocatable :: XmY_RPA(:,:,:)
double precision,allocatable :: rho_RPA(:,:,:,:)
! Output variables
double precision :: eSOSEX(nBas)
! Hello world
write(*,*)
write(*,*)'************************************************'
write(*,*)'| One-shot SOSEX calculation |'
write(*,*)'************************************************'
write(*,*)
! Initialization
EcRPA(:) = 0d0
! TDA for W
if(TDA_W) then
write(*,*) 'Tamm-Dancoff approximation for dynamic screening!'
write(*,*)
end if
! TDA
if(TDA) then
write(*,*) 'Tamm-Dancoff approximation activated!'
write(*,*)
end if
! Memory allocation
allocate(SigC(nBas),SigX(nBas),Z(nBas),OmRPA(nS,nspin),XpY_RPA(nS,nS,nspin),XmY_RPA(nS,nS,nspin),rho_RPA(nBas,nBas,nS,nspin))
!-------------------!
! Compute screening !
!-------------------!
do ispin=1,nspin
call linear_response(ispin,.true.,TDA_W,eta,nBas,nC,nO,nV,nR,nS,1d0,eHF,ERI_MO, &
EcRPA(ispin),OmRPA(:,ispin),XpY_RPA(:,:,ispin),XmY_RPA(:,:,ispin))
if(print_W) call print_excitation('RPA@HF ',ispin,nS,OmRPA(:,ispin))
end do
!--------------------------!
! Compute spectral weights !
!--------------------------!
call excitation_density_SOSEX(nBas,nC,nO,nR,nS,ERI_MO,XpY_RPA,rho_RPA)
!------------------------!
! Compute GW self-energy !
!------------------------!
call self_energy_exchange_diag(nBas,cHF,PHF,ERI_AO,SigX)
call self_energy_correlation_SOSEX_diag(eta,nBas,nC,nO,nV,nR,nS,eHF,OmRPA,rho_RPA,EcGM,SigC)
!--------------------------------!
! Compute renormalization factor !
!--------------------------------!
call renormalization_factor_SOSEX(eta,nBas,nC,nO,nV,nR,nS,eHF,OmRPA,rho_RPA,Z)
!-----------------------------------!
! Solve the quasi-particle equation !
!-----------------------------------!
eSOSEX(:) = eHF(:) + Z(:)*(SigX(:) + SigC(:) - Vxc(:))
! Compute the RPA correlation energy
do ispin=1,nspin
call linear_response(ispin,.true.,TDA_W,eta,nBas,nC,nO,nV,nR,nS,1d0,eSOSEX,ERI_MO, &
EcRPA(ispin),OmRPA(:,ispin),XpY_RPA(:,:,ispin),XmY_RPA(:,:,ispin))
end do
!--------------!
! Dump results !
!--------------!
call print_SOSEX(nBas,nO,eHF,ENuc,ERHF,SigC,Z,eSOSEX,EcRPA,EcGM)
! Deallocate memory
deallocate(SigC,Z,OmRPA,XpY_RPA,XmY_RPA,rho_RPA)
! Perform BSE calculation
if(BSE) then
call Bethe_Salpeter(TDA_W,TDA,dBSE,dTDA,evDyn,singlet,triplet,eta,nBas,nC,nO,nV,nR,nS,ERI_MO,dipole_int,eHF,eSOSEX,EcBSE)
if(exchange_kernel) then
EcBSE(1) = 0.5d0*EcBSE(1)
EcBSE(2) = 1.5d0*EcBSE(2)
end if
write(*,*)
write(*,*)'-------------------------------------------------------------------------------'
write(*,'(2X,A50,F20.10)') 'Tr@BSE@SOSEX correlation energy (singlet) =',EcBSE(1)
write(*,'(2X,A50,F20.10)') 'Tr@BSE@SOSEX correlation energy (triplet) =',EcBSE(2)
write(*,'(2X,A50,F20.10)') 'Tr@BSE@SOSEX correlation energy =',EcBSE(1) + EcBSE(2)
write(*,'(2X,A50,F20.10)') 'Tr@BSE@SOSEX total energy =',ENuc + ERHF + EcBSE(1) + EcBSE(2)
write(*,*)'-------------------------------------------------------------------------------'
write(*,*)
! Compute the BSE correlation energy via the adiabatic connection
if(doACFDT) then
write(*,*) '--------------------------------------------------------------'
write(*,*) ' Adiabatic connection version of BSE@SOSEX correlation energy '
write(*,*) '--------------------------------------------------------------'
write(*,*)
if(doXBS) then
write(*,*) '*** scaled screening version (XBS) ***'
write(*,*)
end if
call ACFDT(exchange_kernel,doXBS,.true.,TDA_W,TDA,BSE,singlet,triplet,eta,nBas,nC,nO,nV,nR,nS,ERI_MO,eHF,eSOSEX,EcAC)
write(*,*)
write(*,*)'-------------------------------------------------------------------------------'
write(*,'(2X,A50,F20.10)') 'AC@BSE@SOSEX correlation energy (singlet) =',EcAC(1)
write(*,'(2X,A50,F20.10)') 'AC@BSE@SOSEX correlation energy (triplet) =',EcAC(2)
write(*,'(2X,A50,F20.10)') 'AC@BSE@SOSEX correlation energy =',EcAC(1) + EcAC(2)
write(*,'(2X,A50,F20.10)') 'AC@BSE@SOSEX total energy =',ENuc + ERHF + EcAC(1) + EcAC(2)
write(*,*)'-------------------------------------------------------------------------------'
write(*,*)
end if
end if
end subroutine G0W0_SOSEX

View File

@ -1,67 +0,0 @@
subroutine excitation_density_SOSEX(nBas,nC,nO,nR,nS,ERI,XpY,rho)
! Compute excitation densities for SOSEX
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: nBas
integer,intent(in) :: nC
integer,intent(in) :: nO
integer,intent(in) :: nR
integer,intent(in) :: nS
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
double precision,intent(in) :: XpY(nS,nS,nspin)
! Local variables
integer :: ispin
integer :: p,q
integer :: i,a,j,b
integer :: ia,jb
! Output variables
double precision,intent(out) :: rho(nBas,nBas,nS,nspin)
rho(:,:,:,:) = 0d0
! Singlet part
ispin = 1
do ia=1,nS
do p=nC+1,nBas-nR
do q=nC+1,nBas-nR
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
rho(p,q,ia,ispin) = rho(p,q,ia,ispin) + ERI(p,j,q,b)*XpY(ia,jb,ispin)
enddo
enddo
enddo
enddo
enddo
! Triplet part
ispin = 2
do ia=1,nS
do p=nC+1,nBas-nR
do q=nC+1,nBas-nR
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
rho(p,q,ia,ispin) = rho(p,q,ia,ispin) + (ERI(p,j,q,b) - ERI(p,j,b,q))*XpY(ia,jb,ispin)
enddo
enddo
enddo
enddo
enddo
end subroutine excitation_density_SOSEX

View File

@ -1,55 +0,0 @@
subroutine print_SOSEX(nBas,nO,eHF,ENuc,ERHF,SigC,Z,eSOSEX,EcRPA,EcGM)
! Print one-electron energies and other stuff for SOSEX
implicit none
include 'parameters.h'
integer,intent(in) :: nBas,nO
double precision,intent(in) :: ENuc
double precision,intent(in) :: ERHF
double precision,intent(in) :: EcRPA
double precision,intent(in) :: EcGM
double precision,intent(in) :: eHF(nBas)
double precision,intent(in) :: SigC(nBas)
double precision,intent(in) :: Z(nBas)
double precision,intent(in) :: eSOSEX(nBas)
integer :: p,HOMO,LUMO
double precision :: Gap
! HOMO and LUMO
HOMO = nO
LUMO = HOMO + 1
Gap = eSOSEX(LUMO)-eSOSEX(HOMO)
! Dump results
write(*,*)'-------------------------------------------------------------------------------'
write(*,*)' One-shot SOSEX calculation '
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)') &
'|','#','|','e_HF (eV)','|','Sig_c (eV)','|','Z','|','e_QP (eV)','|'
write(*,*)'-------------------------------------------------------------------------------'
do p=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)') &
'|',p,'|',eHF(p)*HaToeV,'|',SigC(p)*HaToeV,'|',Z(p),'|',eSOSEX(p)*HaToeV,'|'
enddo
write(*,*)'-------------------------------------------------------------------------------'
write(*,'(2X,A30,F15.6,A3)') 'SOSEX HOMO energy:',eSOSEX(HOMO)*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'SOSEX LUMO energy:',eSOSEX(LUMO)*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'SOSEX HOMO-LUMO gap :',Gap*HaToeV,' eV'
write(*,*)'-------------------------------------------------------------------------------'
write(*,'(2X,A30,F15.6,A3)') 'RPA@SOSEX total energy :',ENuc + ERHF + EcRPA,' au'
write(*,'(2X,A30,F15.6,A3)') 'RPA@SOSEX correlation energy:',EcRPA,' au'
write(*,'(2X,A30,F15.6,A3)') 'GM@SOSEX total energy :',ENuc + ERHF + EcGM,' au'
write(*,'(2X,A30,F15.6,A3)') 'GM@SOSEX correlation energy:',EcGM,' au'
write(*,*)'-------------------------------------------------------------------------------'
write(*,*)
end subroutine print_SOSEX

View File

@ -1,73 +0,0 @@
subroutine renormalization_factor_SOSEX(eta,nBas,nC,nO,nV,nR,nS,e,Omega,rho,Z)
! Compute renormalization factor for the SOSEX version of GW
implicit none
include 'parameters.h'
! Input variables
double precision,intent(in) :: eta
integer,intent(in) :: nBas
integer,intent(in) :: nC
integer,intent(in) :: nO
integer,intent(in) :: nV
integer,intent(in) :: nR
integer,intent(in) :: nS
double precision,intent(in) :: e(nBas)
double precision,intent(in) :: Omega(nS,nspin)
double precision,intent(in) :: rho(nBas,nBas,nS,nspin)
! Local variables
integer :: ispin
integer :: i,j,a,b,p,jb
double precision :: eps
! Output variables
double precision,intent(out) :: Z(nBas)
! Initialize
Z(:) = 0d0
! Occupied part of the correlation self-energy
do p=nC+1,nBas-nR
do i=nC+1,nO
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
do ispin=1,nspin
eps = e(p) - e(i) + Omega(jb,ispin)
Z(p) = Z(p) - 2d0*rho(p,i,jb,ispin)**2*(eps/(eps**2 + eta**2))**2
end do
end do
end do
end do
end do
! Virtual part of the correlation self-energy
do p=nC+1,nBas-nR
do a=nO+1,nBas-nR
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
do ispin=1,nspin
eps = e(p) - e(a) - Omega(jb,ispin)
Z(p) = Z(p) - 2d0*rho(p,a,jb,ispin)**2*(eps/(eps**2 + eta**2))**2
end do
end do
end do
end do
end do
! Compute renormalization factor from derivative of SigC
Z(:) = 1d0/(1d0 - Z(:))
end subroutine renormalization_factor_SOSEX

View File

@ -1,80 +0,0 @@
subroutine self_energy_correlation_SOSEX_diag(eta,nBas,nC,nO,nV,nR,nS,e,Omega,rho,EcGM,SigC)
! Compute diagonal of the correlation part of the self-energy
implicit none
include 'parameters.h'
! Input variables
double precision,intent(in) :: eta
integer,intent(in) :: nBas
integer,intent(in) :: nC
integer,intent(in) :: nO
integer,intent(in) :: nV
integer,intent(in) :: nR
integer,intent(in) :: nS
double precision,intent(in) :: e(nBas)
double precision,intent(in) :: Omega(nS,nspin)
double precision,intent(in) :: rho(nBas,nBas,nS,nspin)
! Local variables
integer :: ispin
integer :: i,a,p,q,jb
double precision :: eps
! Output variables
double precision,intent(out) :: SigC(nBas)
double precision,intent(out) :: EcGM
! Initialize
SigC(:) = 0d0
!-----------------------------
! SOSEX self-energy
!-----------------------------
! Occupied part of the correlation self-energy
do p=nC+1,nBas-nR
do i=nC+1,nO
do jb=1,nS
do ispin=1,nspin
eps = e(p) - e(i) + Omega(jb,ispin)
SigC(p) = SigC(p) + 2d0*rho(p,i,jb,ispin)**2*eps/(eps**2 + eta**2)
end do
end do
end do
end do
! Virtual part of the correlation self-energy
do p=nC+1,nBas-nR
do a=nO+1,nBas-nR
do jb=1,nS
do ispin=1,nspin
eps = e(p) - e(a) - Omega(jb,ispin)
SigC(p) = SigC(p) + 2d0*rho(p,a,jb,ispin)**2*eps/(eps**2 + eta**2)
end do
end do
end do
end do
! GM correlation energy
EcGM = 0d0
do i=nC+1,nO
do a=nO+1,nBas-nR
do jb=1,nS
do ispin=1,nspin
eps = e(a) - e(i) + Omega(jb,ispin)
EcGM = EcGM - 4d0*rho(a,i,jb,ispin)*rho(a,i,jb,ispin)*eps/(eps**2 + eta**2)
end do
end do
end do
end do
end subroutine self_energy_correlation_SOSEX_diag

View File

@ -99,7 +99,7 @@ program QuAcK
integer :: maxSCF_GW,n_diis_GW integer :: maxSCF_GW,n_diis_GW
double precision :: thresh_GW double precision :: thresh_GW
logical :: DIIS_GW,COHSEX,SOSEX,TDA_W,linGW,regGW logical :: DIIS_GW,COHSEX,TDA_W,linGW,regGW
double precision :: eta_GW double precision :: eta_GW
integer :: maxSCF_GT,n_diis_GT integer :: maxSCF_GT,n_diis_GT
@ -149,8 +149,7 @@ program QuAcK
maxSCF_CC,thresh_CC,DIIS_CC,n_diis_CC, & maxSCF_CC,thresh_CC,DIIS_CC,n_diis_CC, &
TDA,singlet,triplet,spin_conserved,spin_flip, & TDA,singlet,triplet,spin_conserved,spin_flip, &
maxSCF_GF,thresh_GF,DIIS_GF,n_diis_GF,linGF,eta_GF,renormGF,regGF, & maxSCF_GF,thresh_GF,DIIS_GF,n_diis_GF,linGF,eta_GF,renormGF,regGF, &
maxSCF_GW,thresh_GW,DIIS_GW,n_diis_GW,linGW,eta_GW,regGW, & maxSCF_GW,thresh_GW,DIIS_GW,n_diis_GW,linGW,eta_GW,regGW,COHSEX,TDA_W, &
COHSEX,SOSEX,TDA_W, &
maxSCF_GT,thresh_GT,DIIS_GT,n_diis_GT,linGT,eta_GT,regGT,TDA_T, & maxSCF_GT,thresh_GT,DIIS_GT,n_diis_GT,linGT,eta_GT,regGT,TDA_T, &
doACFDT,exchange_kernel,doXBS, & doACFDT,exchange_kernel,doXBS, &
BSE,dBSE,dTDA,evDyn,ppBSE,BSE2) BSE,dBSE,dTDA,evDyn,ppBSE,BSE2)
@ -947,18 +946,10 @@ program QuAcK
dipole_int_aa,dipole_int_bb,PHF,cHF,eHF,Vxc,eG0W0) dipole_int_aa,dipole_int_bb,PHF,cHF,eHF,Vxc,eG0W0)
else else
! SOSEX extrension of GW
if(SOSEX) then
call G0W0_SOSEX(doACFDT,exchange_kernel,doXBS,BSE,BSE2,TDA_W,TDA,dBSE,dTDA,evDyn,singlet,triplet, &
eta_GW,nBas,nC,nO,nV,nR,nS,ENuc,ERHF,ERI_AO,ERI_MO,dipole_int_MO,PHF,cHF,eHF,Vxc,eG0W0)
else
call G0W0(doACFDT,exchange_kernel,doXBS,COHSEX,BSE,BSE2,TDA_W,TDA,dBSE,dTDA,evDyn,ppBSE,singlet,triplet, & call G0W0(doACFDT,exchange_kernel,doXBS,COHSEX,BSE,BSE2,TDA_W,TDA,dBSE,dTDA,evDyn,ppBSE,singlet,triplet, &
linGW,eta_GW,regGW,nBas,nC,nO,nV,nR,nS,ENuc,ERHF,ERI_AO,ERI_MO,dipole_int_MO,PHF,cHF,eHF,Vxc,eG0W0) linGW,eta_GW,regGW,nBas,nC,nO,nV,nR,nS,ENuc,ERHF,ERI_AO,ERI_MO,dipole_int_MO,PHF,cHF,eHF,Vxc,eG0W0)
end if end if
end if
call cpu_time(end_GW) call cpu_time(end_GW)
t_GW = end_GW - start_GW t_GW = end_GW - start_GW

View File

@ -3,8 +3,7 @@ subroutine read_options(maxSCF_HF,thresh_HF,DIIS_HF,n_diis_HF,guess_type,ortho_t
maxSCF_CC,thresh_CC,DIIS_CC,n_diis_CC, & maxSCF_CC,thresh_CC,DIIS_CC,n_diis_CC, &
TDA,singlet,triplet,spin_conserved,spin_flip, & TDA,singlet,triplet,spin_conserved,spin_flip, &
maxSCF_GF,thresh_GF,DIIS_GF,n_diis_GF,linGF,eta_GF,renormGF,regGF, & maxSCF_GF,thresh_GF,DIIS_GF,n_diis_GF,linGF,eta_GF,renormGF,regGF, &
maxSCF_GW,thresh_GW,DIIS_GW,n_diis_GW,linGW,eta_GW,regGW, & maxSCF_GW,thresh_GW,DIIS_GW,n_diis_GW,linGW,eta_GW,regGW,COHSEX,TDA_W, &
COHSEX,SOSEX,TDA_W, &
maxSCF_GT,thresh_GT,DIIS_GT,n_diis_GT,linGT,eta_GT,regGT,TDA_T, & maxSCF_GT,thresh_GT,DIIS_GT,n_diis_GT,linGT,eta_GT,regGT,TDA_T, &
doACFDT,exchange_kernel,doXBS, & doACFDT,exchange_kernel,doXBS, &
BSE,dBSE,dTDA,evDyn,ppBSE,BSE2) BSE,dBSE,dTDA,evDyn,ppBSE,BSE2)
@ -52,7 +51,6 @@ subroutine read_options(maxSCF_HF,thresh_HF,DIIS_HF,n_diis_HF,guess_type,ortho_t
logical,intent(out) :: DIIS_GW logical,intent(out) :: DIIS_GW
integer,intent(out) :: n_diis_GW integer,intent(out) :: n_diis_GW
logical,intent(out) :: COHSEX logical,intent(out) :: COHSEX
logical,intent(out) :: SOSEX
logical,intent(out) :: TDA_W logical,intent(out) :: TDA_W
logical,intent(out) :: linGW logical,intent(out) :: linGW
double precision,intent(out) :: eta_GW double precision,intent(out) :: eta_GW
@ -175,19 +173,17 @@ subroutine read_options(maxSCF_HF,thresh_HF,DIIS_HF,n_diis_HF,guess_type,ortho_t
eta_GW = 0d0 eta_GW = 0d0
regGW = .false. regGW = .false.
COHSEX = .false. COHSEX = .false.
SOSEX = .false.
TDA_W = .false. TDA_W = .false.
read(1,*) read(1,*)
read(1,*) maxSCF_GW,thresh_GW,answer1,n_diis_GW,answer2,eta_GW, & read(1,*) maxSCF_GW,thresh_GW,answer1,n_diis_GW,answer2,eta_GW, &
answer3,answer4,answer5,answer6 answer3,answer4,answer5
if(answer1 == 'T') DIIS_GW = .true. if(answer1 == 'T') DIIS_GW = .true.
if(answer2 == 'T') linGW = .true. if(answer2 == 'T') linGW = .true.
if(answer3 == 'T') COHSEX = .true. if(answer3 == 'T') COHSEX = .true.
if(answer4 == 'T') SOSEX = .true. if(answer4 == 'T') TDA_W = .true.
if(answer5 == 'T') TDA_W = .true. if(answer5 == 'T') regGW = .true.
if(answer6 == 'T') regGW = .true.
if(.not.DIIS_GW) n_diis_GW = 1 if(.not.DIIS_GW) n_diis_GW = 1
! Read GT options ! Read GT options