10
1
mirror of https://github.com/pfloos/quack synced 2025-01-10 21:18:23 +01:00
QuAcK/src/GF/GF2_phBSE2.f90

115 lines
3.6 KiB
Fortran
Raw Normal View History

2023-07-25 10:46:56 +02:00
subroutine GF2_phBSE2(TDA,dBSE,dTDA,singlet,triplet,eta,nBas,nC,nO,nV,nR,nS,ERI,dipole_int,eGF,EcBSE)
2020-06-01 17:30:02 +02:00
! Compute the second-order Bethe-Salpeter excitation energies
2020-06-01 17:30:02 +02:00
implicit none
include 'parameters.h'
! Input variables
logical,intent(in) :: TDA
2020-06-15 23:04:07 +02:00
logical,intent(in) :: dBSE
logical,intent(in) :: dTDA
logical,intent(in) :: singlet
logical,intent(in) :: triplet
2020-06-01 17:30:02 +02:00
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) :: eGF(nBas)
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
double precision,intent(in) :: dipole_int(nBas,nBas,ncart)
2020-06-01 17:30:02 +02:00
! Local variables
2023-07-19 11:03:55 +02:00
logical :: dRPA = .false.
2020-06-01 17:30:02 +02:00
integer :: ispin
2023-07-12 22:56:20 +02:00
double precision,allocatable :: OmBSE(:)
double precision,allocatable :: XpY(:,:)
double precision,allocatable :: XmY(:,:)
double precision,allocatable :: A_sta(:,:)
double precision,allocatable :: B_sta(:,:)
2023-07-19 11:03:55 +02:00
double precision,allocatable :: KA_sta(:,:)
double precision,allocatable :: KB_sta(:,:)
2020-06-01 17:30:02 +02:00
! Output variables
double precision,intent(out) :: EcBSE(nspin)
! Memory allocation
2023-07-19 11:03:55 +02:00
allocate(OmBSE(nS),XpY(nS,nS),XmY(nS,nS),A_sta(nS,nS),KA_sta(nS,nS))
allocate(B_sta(nS,nS),KB_sta(nS,nS))
2020-06-01 17:30:02 +02:00
!-------------------
! Singlet manifold
!-------------------
if(singlet) then
2020-06-01 17:30:02 +02:00
ispin = 1
EcBSE(ispin) = 0d0
2023-07-19 11:03:55 +02:00
call phLR_A(ispin,dRPA,nBas,nC,nO,nV,nR,nS,1d0,eGF,ERI,A_sta)
if(.not.TDA) call phLR_B(ispin,dRPA,nBas,nC,nO,nV,nR,nS,1d0,ERI,B_sta)
! Compute static kernel
2023-07-19 11:03:55 +02:00
call GF2_phBSE2_static_kernel_A(ispin,eta,nBas,nC,nO,nV,nR,nS,1d0,ERI,eGF,KA_sta)
if(.not.TDA) call GF2_phBSE2_static_kernel_B(ispin,eta,nBas,nC,nO,nV,nR,nS,1d0,ERI,eGF,KB_sta)
2023-07-19 11:03:55 +02:00
A_sta(:,:) = A_sta(:,:) + KA_sta(:,:)
if(.not.TDA) B_sta(:,:) = B_sta(:,:) + KB_sta(:,:)
2020-06-01 17:30:02 +02:00
2023-07-19 11:03:55 +02:00
! Compute phBSE2@GF2 excitation energies
2021-03-06 23:08:43 +01:00
2023-07-19 11:03:55 +02:00
call phLR(TDA,nS,A_sta,B_sta,EcBSE(ispin),OmBSE,XpY,XmY)
2023-07-28 14:14:35 +02:00
call print_excitation_energies('phBSE2@GF2',ispin,nS,OmBSE)
call phLR_transition_vectors(.true.,nBas,nC,nO,nV,nR,nS,dipole_int,OmBSE,XpY,XmY)
2020-06-01 17:30:02 +02:00
! Compute dynamic correction for BSE via perturbation theory
2020-06-17 14:32:37 +02:00
2023-07-21 10:21:54 +02:00
if(dBSE) &
2023-07-25 10:46:56 +02:00
call GF2_phBSE2_dynamic_perturbation(dTDA,ispin,eta,nBas,nC,nO,nV,nR,nS,ERI,dipole_int,eGF,KA_sta,KB_sta,OmBSE,XpY,XmY)
2020-06-17 14:32:37 +02:00
2020-06-01 17:30:02 +02:00
end if
!-------------------
! Triplet manifold
!-------------------
if(triplet) then
2020-06-01 17:30:02 +02:00
ispin = 2
EcBSE(ispin) = 0d0
2023-07-19 11:03:55 +02:00
call phLR_A(ispin,dRPA,nBas,nC,nO,nV,nR,nS,1d0,eGF,ERI,A_sta)
if(.not.TDA) call phLR_B(ispin,dRPA,nBas,nC,nO,nV,nR,nS,1d0,ERI,B_sta)
! Compute static kernel
2023-07-19 11:03:55 +02:00
call GF2_phBSE2_static_kernel_A(ispin,eta,nBas,nC,nO,nV,nR,nS,1d0,ERI,eGF,KA_sta)
if(.not.TDA) call GF2_phBSE2_static_kernel_B(ispin,eta,nBas,nC,nO,nV,nR,nS,1d0,ERI,eGF,KB_sta)
A_sta(:,:) = A_sta(:,:) + KA_sta(:,:)
if(.not.TDA) B_sta(:,:) = B_sta(:,:) + KB_sta(:,:)
2023-07-19 11:03:55 +02:00
! Compute phBSE2@GF2 excitation energies
2020-06-01 17:30:02 +02:00
2023-07-19 11:03:55 +02:00
call phLR(TDA,nS,A_sta,B_sta,EcBSE(ispin),OmBSE,XpY,XmY)
2023-07-28 14:14:35 +02:00
call print_excitation_energies('phBSE2@GF2',ispin,nS,OmBSE)
call phLR_transition_vectors(.false.,nBas,nC,nO,nV,nR,nS,dipole_int,OmBSE,XpY,XmY)
2020-06-01 17:30:02 +02:00
! Compute dynamic correction for BSE via perturbation theory
2023-07-21 10:21:54 +02:00
if(dBSE) &
2023-07-25 10:46:56 +02:00
call GF2_phBSE2_dynamic_perturbation(dTDA,ispin,eta,nBas,nC,nO,nV,nR,nS,ERI,dipole_int,eGF,KA_sta,KB_sta,OmBSE,XpY,XmY)
2020-06-01 17:30:02 +02:00
end if
2023-07-04 11:56:00 +02:00
end subroutine