4
1
mirror of https://github.com/pfloos/quack synced 2024-06-27 23:52:19 +02:00
quack/src/QuAcK/G0W0.f90

235 lines
6.8 KiB
Fortran
Raw Normal View History

2020-09-24 11:56:06 +02:00
subroutine G0W0(doACFDT,exchange_kernel,doXBS,COHSEX,SOSEX,BSE,TDA_W,TDA, &
dBSE,dTDA,evDyn,singlet,triplet,linearize,eta, &
2020-09-22 15:32:26 +02:00
nBas,nC,nO,nV,nR,nS,ENuc,ERHF,Hc,ERI,PHF,cHF,eHF,eGW)
2019-03-19 10:13:33 +01:00
! Perform G0W0 calculation
implicit none
include 'parameters.h'
2020-01-08 10:17:19 +01:00
include 'quadrature.h'
2019-03-19 10:13:33 +01:00
! Input variables
2020-01-14 21:27:34 +01:00
logical,intent(in) :: doACFDT
2020-01-16 21:39:00 +01:00
logical,intent(in) :: exchange_kernel
2020-01-14 21:27:34 +01:00
logical,intent(in) :: doXBS
2019-04-02 22:58:24 +02:00
logical,intent(in) :: COHSEX
logical,intent(in) :: SOSEX
logical,intent(in) :: BSE
2020-06-09 21:24:37 +02:00
logical,intent(in) :: TDA_W
2019-04-02 22:58:24 +02:00
logical,intent(in) :: TDA
2020-06-14 21:20:01 +02:00
logical,intent(in) :: dBSE
2020-06-14 13:04:16 +02:00
logical,intent(in) :: dTDA
2020-06-14 21:20:01 +02:00
logical,intent(in) :: evDyn
2020-09-24 11:56:06 +02:00
logical,intent(in) :: singlet
logical,intent(in) :: triplet
2020-03-14 23:00:44 +01:00
logical,intent(in) :: linearize
2019-09-22 21:15:53 +02:00
double precision,intent(in) :: eta
2019-03-19 10:13:33 +01:00
integer,intent(in) :: nBas,nC,nO,nV,nR,nS
2019-05-23 09:53:23 +02:00
double precision,intent(in) :: ENuc
double precision,intent(in) :: ERHF
2019-04-02 22:58:24 +02:00
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)
2019-05-07 22:55:36 +02:00
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
2019-03-19 10:13:33 +01:00
! Local variables
2020-06-09 21:24:37 +02:00
logical :: print_W = .true.
2020-01-14 16:36:11 +01:00
integer :: ispin
2020-09-24 11:56:06 +02:00
double precision :: EcRPA
2019-05-04 17:13:50 +02:00
double precision :: EcBSE(nspin)
2020-01-14 22:56:20 +01:00
double precision :: EcAC(nspin)
2019-04-02 22:58:24 +02:00
double precision :: EcGM
double precision,allocatable :: SigC(:)
double precision,allocatable :: Z(:)
2020-09-24 11:56:06 +02:00
double precision,allocatable :: OmRPA(:)
double precision,allocatable :: XpY_RPA(:,:)
double precision,allocatable :: XmY_RPA(:,:)
double precision,allocatable :: rho_RPA(:,:,:)
2019-03-19 10:13:33 +01:00
2020-03-12 15:04:16 +01:00
double precision,allocatable :: eGWlin(:)
2019-03-19 10:13:33 +01:00
! Output variables
2020-01-14 21:27:34 +01:00
double precision :: eGW(nBas)
2019-03-19 10:13:33 +01:00
! Hello world
write(*,*)
write(*,*)'************************************************'
write(*,*)'| One-shot G0W0 calculation |'
write(*,*)'************************************************'
write(*,*)
2020-06-17 22:10:08 +02:00
! Initialization
2020-09-24 11:56:06 +02:00
EcRPA = 0d0
2020-06-17 22:10:08 +02:00
2019-03-19 10:13:33 +01:00
! SOSEX correction
2020-09-22 22:13:51 +02:00
if(SOSEX) then
2020-09-24 11:56:06 +02:00
write(*,*) 'SOSEX correction activated but BUG!'
stop
2020-09-22 22:13:51 +02:00
end if
2019-03-19 10:13:33 +01:00
2019-07-15 14:22:32 +02:00
! COHSEX approximation
2020-09-22 22:13:51 +02:00
if(COHSEX) then
write(*,*) 'COHSEX approximation activated!'
write(*,*)
end if
2019-07-15 14:22:32 +02:00
2020-06-09 21:24:37 +02:00
! TDA for W
2020-09-22 22:13:51 +02:00
if(TDA_W) then
write(*,*) 'Tamm-Dancoff approximation for dynamic screening!'
write(*,*)
end if
2020-06-09 21:24:37 +02:00
! TDA
2020-09-22 22:13:51 +02:00
if(TDA) then
write(*,*) 'Tamm-Dancoff approximation activated!'
write(*,*)
end if
2020-06-09 21:24:37 +02:00
2019-03-19 10:13:33 +01:00
! Spin manifold
ispin = 1
! Memory allocation
2020-09-24 11:56:06 +02:00
allocate(SigC(nBas),Z(nBas),OmRPA(nS),XpY_RPA(nS,nS),XmY_RPA(nS,nS),rho_RPA(nBas,nBas,nS),eGWlin(nBas))
2019-03-19 10:13:33 +01:00
2020-09-24 11:56:06 +02:00
!-------------------!
! Compute screening !
!-------------------!
2019-03-19 10:13:33 +01:00
2020-09-24 11:56:06 +02:00
call linear_response(ispin,.true.,TDA_W,.false.,eta,nBas,nC,nO,nV,nR,nS,1d0, &
eHF,ERI,OmRPA,rho_RPA,EcRPA,OmRPA,XpY_RPA,XmY_RPA)
2019-03-19 10:13:33 +01:00
2020-09-24 11:56:06 +02:00
if(print_W) call print_excitation('RPA@HF ',ispin,nS,OmRPA)
2020-07-08 10:55:03 +02:00
2020-09-24 11:56:06 +02:00
!--------------------------!
! Compute spectral weights !
!--------------------------!
2019-03-19 10:13:33 +01:00
2020-09-24 11:56:06 +02:00
call excitation_density(nBas,nC,nO,nR,nS,ERI,XpY_RPA,rho_RPA)
2019-03-19 10:13:33 +01:00
2020-09-24 11:56:06 +02:00
!------------------------!
! Compute GW self-energy !
!------------------------!
2019-03-19 10:13:33 +01:00
2020-09-24 11:56:06 +02:00
call self_energy_correlation_diag(COHSEX,eta,nBas,nC,nO,nV,nR,nS,eHF,OmRPA,rho_RPA,EcGM,SigC)
2019-03-19 10:13:33 +01:00
2020-09-24 11:56:06 +02:00
!--------------------------------!
! Compute renormalization factor !
!--------------------------------!
2019-03-19 10:13:33 +01:00
2020-09-24 11:56:06 +02:00
call renormalization_factor(COHSEX,eta,nBas,nC,nO,nV,nR,nS,eHF,OmRPA,rho_RPA,Z)
2019-03-19 10:13:33 +01:00
2020-09-24 11:56:06 +02:00
!-----------------------------------!
! Solve the quasi-particle equation !
!-----------------------------------!
2019-03-19 10:13:33 +01:00
2020-03-12 15:04:16 +01:00
eGWlin(:) = eHF(:) + Z(:)*SigC(:)
2020-02-12 12:25:24 +01:00
2020-09-24 11:56:06 +02:00
! Linearized or graphical solution?
2020-03-14 23:00:44 +01:00
if(linearize) then
2020-04-16 17:02:01 +02:00
write(*,*) ' *** Quasiparticle energies obtained by linearization *** '
write(*,*)
2020-03-14 23:00:44 +01:00
eGW(:) = eGWlin(:)
else
2020-09-24 11:56:06 +02:00
write(*,*) ' *** Quasiparticle energies obtained by root search (experimental) *** '
write(*,*)
2020-03-14 23:00:44 +01:00
2020-09-24 11:56:06 +02:00
call QP_graph(nBas,nC,nO,nV,nR,nS,eta,eHF,OmRPA,rho_RPA,eGWlin,eGW)
2020-03-12 15:04:16 +01:00
2020-09-24 11:56:06 +02:00
! Find all the roots of the QP equation if necessary
! call QP_roots(nBas,nC,nO,nV,nR,nS,eta,eHF,Omega,rho,eGWlin)
2020-02-12 21:44:35 +01:00
2020-03-14 23:00:44 +01:00
end if
2020-09-24 11:56:06 +02:00
! Compute the RPA correlation energy
call linear_response(ispin,.true.,TDA_W,.false.,eta,nBas,nC,nO,nV,nR,nS,1d0,eGW,ERI,OmRPA, &
rho_RPA,EcRPA,OmRPA,XpY_RPA,XmY_RPA)
2019-03-19 10:13:33 +01:00
2020-09-24 11:56:06 +02:00
!--------------!
! Dump results !
!--------------!
2019-03-19 10:13:33 +01:00
2020-09-24 11:56:06 +02:00
call print_G0W0(nBas,nO,eHF,ENuc,ERHF,SigC,Z,eGW,EcRPA,EcGM)
2020-01-15 22:29:43 +01:00
2020-09-24 11:56:06 +02:00
! Deallocate memory
2020-01-15 22:29:43 +01:00
2020-09-24 11:56:06 +02:00
deallocate(SigC,Z,OmRPA,XpY_RPA,XmY_RPA,rho_RPA,eGWlin)
2020-01-15 22:29:43 +01:00
2019-03-19 10:13:33 +01:00
! Plot stuff
2020-09-24 11:56:06 +02:00
! call plot_GW(nBas,nC,nO,nV,nR,nS,eHF,eGW,OmRPA,rho_RPA)
2020-01-15 22:29:43 +01:00
2019-03-19 10:13:33 +01:00
! Perform BSE calculation
if(BSE) then
2020-09-24 11:56:06 +02:00
call Bethe_Salpeter(TDA_W,TDA,dBSE,dTDA,evDyn,singlet,triplet,eta,nBas,nC,nO,nV,nR,nS,ERI,eHF,eGW,EcBSE)
2019-03-19 10:13:33 +01:00
2020-01-17 13:45:02 +01:00
if(exchange_kernel) then
2020-09-24 11:56:06 +02:00
EcBSE(1) = 0.5d0*EcBSE(1)
EcBSE(2) = 1.5d0*EcBSE(2)
2020-01-17 13:45:02 +01:00
end if
2020-01-14 22:56:20 +01:00
write(*,*)
write(*,*)'-------------------------------------------------------------------------------'
2020-01-23 21:22:41 +01:00
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)
2019-05-04 17:13:50 +02:00
write(*,*)'-------------------------------------------------------------------------------'
write(*,*)
2020-01-08 10:17:19 +01:00
! Compute the BSE correlation energy via the adiabatic connection
2020-01-14 21:27:34 +01:00
if(doACFDT) then
2020-01-08 10:17:19 +01:00
write(*,*) '------------------------------------------------------'
write(*,*) 'Adiabatic connection version of BSE correlation energy'
write(*,*) '------------------------------------------------------'
write(*,*)
2020-01-14 21:27:34 +01:00
if(doXBS) then
2020-01-08 10:17:19 +01:00
2020-01-14 21:27:34 +01:00
write(*,*) '*** scaled screening version (XBS) ***'
2020-01-08 10:17:19 +01:00
write(*,*)
end if
2020-09-24 11:56:06 +02:00
call ACFDT(exchange_kernel,doXBS,.true.,TDA_W,TDA,BSE,singlet,triplet,eta,nBas,nC,nO,nV,nR,nS,ERI,eHF,eGW,EcAC)
2020-01-17 13:45:02 +01:00
2020-01-14 22:56:20 +01:00
write(*,*)
write(*,*)'-------------------------------------------------------------------------------'
2020-01-23 21:22:41 +01:00
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)
2020-01-14 22:56:20 +01:00
write(*,*)'-------------------------------------------------------------------------------'
write(*,*)
2020-01-08 10:17:19 +01:00
end if
end if
2019-03-19 10:13:33 +01:00
end subroutine G0W0