mirror of
https://github.com/pfloos/quack
synced 2024-08-31 00:23:45 +02:00
213 lines
7.1 KiB
Fortran
213 lines
7.1 KiB
Fortran
subroutine G0W0(doACFDT,exchange_kernel,doXBS,COHSEX,SOSEX,BSE,TDA, &
|
|
singlet_manifold,triplet_manifold,linearize,eta, &
|
|
nBas,nC,nO,nV,nR,nS,ENuc,ERHF,Hc,H,ERI,PHF,cHF,eHF,eGW)
|
|
|
|
! Perform G0W0 calculation
|
|
|
|
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) :: COHSEX
|
|
logical,intent(in) :: SOSEX
|
|
logical,intent(in) :: BSE
|
|
logical,intent(in) :: TDA
|
|
logical,intent(in) :: singlet_manifold
|
|
logical,intent(in) :: triplet_manifold
|
|
logical,intent(in) :: linearize
|
|
double precision,intent(in) :: eta
|
|
|
|
integer,intent(in) :: nBas,nC,nO,nV,nR,nS
|
|
double precision,intent(in) :: ENuc
|
|
double precision,intent(in) :: ERHF
|
|
double precision,intent(in) :: eHF(nBas)
|
|
double precision,intent(in) :: cHF(nBas,nBas)
|
|
double precision,intent(in) :: PHF(nBas,nBas)
|
|
double precision,intent(in) :: Hc(nBas,nBas)
|
|
double precision,intent(in) :: H(nBas,nBas)
|
|
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
|
|
|
|
! Local variables
|
|
|
|
logical :: print_W = .false.
|
|
integer :: ispin
|
|
double precision :: EcRPA(nspin)
|
|
double precision :: EcBSE(nspin)
|
|
double precision :: EcAC(nspin)
|
|
double precision :: EcGM
|
|
double precision,allocatable :: SigC(:)
|
|
double precision,allocatable :: Z(:)
|
|
double precision,allocatable :: Omega(:,:)
|
|
double precision,allocatable :: XpY(:,:,:)
|
|
double precision,allocatable :: XmY(:,:,:)
|
|
double precision,allocatable :: rho(:,:,:,:)
|
|
double precision,allocatable :: rhox(:,:,:,:)
|
|
|
|
double precision,allocatable :: eGWlin(:)
|
|
|
|
! Output variables
|
|
|
|
double precision :: eGW(nBas)
|
|
|
|
! Hello world
|
|
|
|
write(*,*)
|
|
write(*,*)'************************************************'
|
|
write(*,*)'| One-shot G0W0 calculation |'
|
|
write(*,*)'************************************************'
|
|
write(*,*)
|
|
|
|
! SOSEX correction
|
|
|
|
if(SOSEX) write(*,*) 'SOSEX correction activated!'
|
|
write(*,*)
|
|
|
|
! COHSEX approximation
|
|
|
|
if(COHSEX) write(*,*) 'COHSEX approximation activated!'
|
|
write(*,*)
|
|
|
|
! Spin manifold
|
|
|
|
ispin = 1
|
|
|
|
! Memory allocation
|
|
|
|
allocate(SigC(nBas),Z(nBas),Omega(nS,nspin),XpY(nS,nS,nspin),XmY(nS,nS,nspin), &
|
|
rho(nBas,nBas,nS,nspin),rhox(nBas,nBas,nS,nspin),eGWlin(nBas))
|
|
|
|
! Compute linear response
|
|
|
|
call linear_response(ispin,.true.,.false.,.false.,eta,nBas,nC,nO,nV,nR,nS,1d0,eHF,ERI, &
|
|
rho(:,:,:,ispin),EcRPA(ispin),Omega(:,ispin),XpY(:,:,ispin),XmY(:,:,ispin))
|
|
|
|
! Compute correlation part of the self-energy
|
|
|
|
call excitation_density(nBas,nC,nO,nR,nS,ERI,XpY(:,:,ispin),rho(:,:,:,ispin))
|
|
|
|
if(SOSEX) call excitation_density_SOSEX(nBas,nC,nO,nR,nS,ERI,XpY(:,:,ispin),rhox(:,:,:,ispin))
|
|
|
|
call self_energy_correlation_diag(COHSEX,SOSEX,eta,nBas,nC,nO,nV,nR,nS,eHF, &
|
|
Omega(:,ispin),rho(:,:,:,ispin),rhox(:,:,:,ispin),EcGM,SigC)
|
|
|
|
! Compute renormalization factor
|
|
|
|
call renormalization_factor(COHSEX,SOSEX,eta,nBas,nC,nO,nV,nR,nS,eHF, &
|
|
Omega(:,ispin),rho(:,:,:,ispin),rhox(:,:,:,ispin),Z(:))
|
|
|
|
! Solve the quasi-particle equation
|
|
|
|
eGWlin(:) = eHF(:) + Z(:)*SigC(:)
|
|
|
|
if(linearize) then
|
|
|
|
write(*,*) ' *** Quasiparticle energies obtained by linearization *** '
|
|
write(*,*)
|
|
|
|
eGW(:) = eGWlin(:)
|
|
|
|
! Find all the roots of the QP equation if necessary
|
|
|
|
! call QP_roots(nBas,nC,nO,nV,nR,nS,eta,eHF,Omega,rho,eGWlin)
|
|
|
|
else
|
|
|
|
! Find graphical solution of the QP equation
|
|
|
|
call QP_graph(nBas,nC,nO,nV,nR,nS,eta,eHF,Omega,rho,eGWlin,eGW)
|
|
|
|
end if
|
|
|
|
! Dump results
|
|
|
|
if(print_W) call print_excitation('RPA ',ispin,nS,Omega(:,ispin))
|
|
|
|
call print_G0W0(nBas,nO,eHF,ENuc,ERHF,SigC,Z,eGW,EcRPA(ispin),EcGM)
|
|
|
|
! Compute the RPA correlation energy
|
|
|
|
call linear_response(ispin,.true.,TDA,.false.,eta,nBas,nC,nO,nV,nR,nS,1d0,eGW,ERI, &
|
|
rho(:,:,:,ispin),EcRPA(ispin),Omega(:,ispin),XpY(:,:,ispin),XmY(:,:,ispin))
|
|
|
|
write(*,*)
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
write(*,'(2X,A50,F20.10)') 'Tr@RPA@G0W0 correlation energy (singlet) =',EcRPA(1)
|
|
write(*,'(2X,A50,F20.10)') 'Tr@RPA@G0W0 correlation energy (triplet) =',EcRPA(2)
|
|
write(*,'(2X,A50,F20.10)') 'Tr@RPA@G0W0 correlation energy =',EcRPA(1) + EcRPA(2)
|
|
write(*,'(2X,A50,F20.10)') 'Tr@RPA@G0W0 total energy =',ENuc + ERHF + EcRPA(1) + EcRPA(2)
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
write(*,*)
|
|
|
|
! Plot stuff
|
|
|
|
! call plot_GW(nBas,nC,nO,nV,nR,nS,eHF,eGW,Omega(:,ispin),rho(:,:,:,ispin),rhox(:,:,:,ispin))
|
|
|
|
! Perform BSE calculation
|
|
|
|
if(BSE) then
|
|
|
|
call Bethe_Salpeter(TDA,singlet_manifold,triplet_manifold,eta, &
|
|
nBas,nC,nO,nV,nR,nS,ERI,eHF,eGW,Omega,XpY,XmY,rho,EcRPA,EcBSE)
|
|
|
|
if(exchange_kernel) then
|
|
|
|
EcRPA(1) = 0.5d0*EcRPA(1)
|
|
EcRPA(2) = 1.5d0*EcRPA(1)
|
|
|
|
end if
|
|
|
|
write(*,*)
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
write(*,'(2X,A50,F20.10)') 'Tr@BSE@G0W0 correlation energy (singlet) =',EcBSE(1)
|
|
write(*,'(2X,A50,F20.10)') 'Tr@BSE@G0W0 correlation energy (triplet) =',EcBSE(2)
|
|
write(*,'(2X,A50,F20.10)') 'Tr@BSE@G0W0 correlation energy =',EcBSE(1) + EcBSE(2)
|
|
write(*,'(2X,A50,F20.10)') 'Tr@BSE@G0W0 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 correlation energy'
|
|
write(*,*) '------------------------------------------------------'
|
|
write(*,*)
|
|
|
|
if(doXBS) then
|
|
|
|
write(*,*) '*** scaled screening version (XBS) ***'
|
|
write(*,*)
|
|
|
|
end if
|
|
|
|
call ACFDT(exchange_kernel,doXBS,.true.,TDA,BSE,singlet_manifold,triplet_manifold,eta, &
|
|
nBas,nC,nO,nV,nR,nS,ERI,eHF,eGW,Omega,XpY,XmY,rho,EcAC)
|
|
|
|
if(exchange_kernel) then
|
|
|
|
EcAC(1) = 0.5d0*EcAC(1)
|
|
EcAC(2) = 1.5d0*EcAC(1)
|
|
|
|
end if
|
|
|
|
write(*,*)
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
write(*,'(2X,A50,F20.10)') 'AC@BSE@G0W0 correlation energy (singlet) =',EcAC(1)
|
|
write(*,'(2X,A50,F20.10)') 'AC@BSE@G0W0 correlation energy (triplet) =',EcAC(2)
|
|
write(*,'(2X,A50,F20.10)') 'AC@BSE@G0W0 correlation energy =',EcAC(1) + EcAC(2)
|
|
write(*,'(2X,A50,F20.10)') 'AC@BSE@G0W0 total energy =',ENuc + ERHF + EcAC(1) + EcAC(2)
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
write(*,*)
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end subroutine G0W0
|