10
1
mirror of https://github.com/pfloos/quack synced 2025-01-10 04:58:20 +01:00
QuAcK/src/GW/GW_phBSE_dynamic_perturbation.f90

134 lines
4.8 KiB
Fortran
Raw Normal View History

2023-07-21 10:21:54 +02:00
subroutine GW_phBSE_dynamic_perturbation(dophBSE2,dTDA,eta,nBas,nC,nO,nV,nR,nS,eW,eGW,ERI,dipole_int, &
OmRPA,rho_RPA,OmBSE,XpY,XmY,KA_sta,KB_sta)
2020-04-22 00:39:52 +02:00
! Compute dynamical effects via perturbation theory for BSE
implicit none
include 'parameters.h'
! Input variables
2023-07-21 10:21:54 +02:00
logical,intent(in) :: dophBSE2
2020-06-14 13:04:16 +02:00
logical,intent(in) :: dTDA
2020-04-22 00:39:52 +02:00
double precision,intent(in) :: eta
2020-04-23 23:13:15 +02:00
integer,intent(in) :: nBas
integer,intent(in) :: nC
integer,intent(in) :: nO
integer,intent(in) :: nV
integer,intent(in) :: nR
integer,intent(in) :: nS
2023-07-21 10:21:54 +02:00
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
2021-02-25 10:55:08 +01:00
double precision,intent(in) :: eW(nBas)
2020-04-23 23:13:15 +02:00
double precision,intent(in) :: eGW(nBas)
double precision,intent(in) :: dipole_int(nBas,nBas,ncart)
2020-04-23 23:13:15 +02:00
double precision,intent(in) :: OmRPA(nS)
2020-09-24 11:56:06 +02:00
double precision,intent(in) :: rho_RPA(nBas,nBas,nS)
2020-04-23 23:13:15 +02:00
double precision,intent(in) :: OmBSE(nS)
double precision,intent(in) :: XpY(nS,nS)
double precision,intent(in) :: XmY(nS,nS)
2023-07-21 10:21:54 +02:00
double precision,intent(in) :: KA_sta(nS,nS)
double precision,intent(in) :: KB_sta(nS,nS)
2020-04-22 00:39:52 +02:00
! Local variables
integer :: ia
2020-06-03 12:06:16 +02:00
2022-01-11 15:23:43 +01:00
integer :: maxS = 10
2020-05-15 13:08:07 +02:00
double precision :: gapGW
2020-04-22 00:39:52 +02:00
2024-07-04 10:41:57 +02:00
double precision,allocatable :: Om_dyn(:)
double precision,allocatable :: Z_dyn(:)
2020-04-22 00:39:52 +02:00
double precision,allocatable :: X(:)
double precision,allocatable :: Y(:)
2020-06-01 11:35:17 +02:00
2023-07-21 10:21:54 +02:00
double precision,allocatable :: KAp_dyn(:,:)
double precision,allocatable :: KAm_dyn(:,:)
2020-06-11 15:36:16 +02:00
double precision,allocatable :: ZAp_dyn(:,:)
double precision,allocatable :: ZAm_dyn(:,:)
2023-07-21 10:21:54 +02:00
double precision,allocatable :: KB_dyn(:,:)
double precision,allocatable :: W(:,:,:,:)
2020-04-22 00:39:52 +02:00
! Memory allocation
2024-07-04 10:41:57 +02:00
allocate(Om_dyn(maxS),Z_dyn(maxS),X(nS),Y(nS),KAp_dyn(nS,nS),ZAp_dyn(nS,nS), &
2023-07-21 10:21:54 +02:00
KAm_dyn(nS,nS),ZAm_dyn(nS,nS),KB_dyn(nS,nS))
2020-05-15 13:08:07 +02:00
2020-06-14 13:04:16 +02:00
if(dTDA) then
write(*,*)
write(*,*) '*** dynamical TDA activated ***'
write(*,*)
end if
2023-07-21 10:21:54 +02:00
if(dophBSE2) then
write(*,*)
2023-07-21 11:18:00 +02:00
write(*,*) '*** Second-order BSE dynamic kernel activated! ***'
2023-07-21 10:21:54 +02:00
write(*,*)
allocate(W(nBas,nBas,nBas,nBas))
2023-07-28 15:00:17 +02:00
call GW_phBSE_static_kernel(eta,nBas,nC,nO,nV,nR,nS,1d0,ERI,OmRPA,rho_RPA,W)
2023-07-21 10:21:54 +02:00
end if
2020-05-15 13:08:07 +02:00
gapGW = eGW(nO+1) - eGW(nO)
2020-04-22 00:39:52 +02:00
2020-04-23 23:13:15 +02:00
write(*,*) '---------------------------------------------------------------------------------------------------'
2020-06-14 13:18:56 +02:00
write(*,*) ' First-order dynamical correction to static Bethe-Salpeter excitation energies '
2020-04-23 23:13:15 +02:00
write(*,*) '---------------------------------------------------------------------------------------------------'
2020-06-03 12:06:16 +02:00
write(*,'(A57,F10.6,A3)') ' BSE neutral excitation must be lower than the GW gap = ',gapGW*HaToeV,' eV'
write(*,*) '---------------------------------------------------------------------------------------------------'
2020-04-23 23:13:15 +02:00
write(*,'(2X,A5,1X,A20,1X,A20,1X,A20,1X,A20)') '#','Static (eV)','Dynamic (eV)','Correction (eV)','Renorm. (eV)'
write(*,*) '---------------------------------------------------------------------------------------------------'
2020-05-15 13:08:07 +02:00
2023-07-21 10:21:54 +02:00
do ia=1,min(nS,maxS)
2020-04-22 00:39:52 +02:00
2020-04-22 09:55:58 +02:00
X(:) = 0.5d0*(XpY(ia,:) + XmY(ia,:))
Y(:) = 0.5d0*(XpY(ia,:) - XmY(ia,:))
2020-04-22 00:39:52 +02:00
2023-07-21 11:28:12 +02:00
! Resonant part of the BSE correction for dynamical TDA
2020-05-20 16:46:07 +02:00
2023-07-21 11:28:12 +02:00
call GW_phBSE_dynamic_kernel_A(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW,OmRPA,rho_RPA,+OmBSE(ia),KAp_dyn,ZAp_dyn)
2020-05-15 13:08:07 +02:00
2023-07-21 11:28:12 +02:00
if(dophBSE2) call GW_phBSE2_dynamic_kernel_A(eta,nBas,nC,nO,nV,nR,nS,eGW,W,OmBSE(ia),KAp_dyn,ZAp_dyn)
2020-04-23 23:13:15 +02:00
2023-07-21 11:28:12 +02:00
if(dTDA) then
2023-07-10 14:50:16 +02:00
2024-07-04 10:41:57 +02:00
Z_dyn(ia) = dot_product(X,matmul(ZAp_dyn,X))
Om_dyn(ia) = dot_product(X,matmul(KAp_dyn - KA_sta,X))
2020-04-22 00:39:52 +02:00
2020-04-23 23:13:15 +02:00
else
2020-04-22 00:39:52 +02:00
2020-06-01 11:35:17 +02:00
! Resonant and anti-resonant part of the BSE correction
2020-05-20 16:46:07 +02:00
2023-07-21 10:21:54 +02:00
call GW_phBSE_dynamic_kernel_A(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW,OmRPA,rho_RPA,-OmBSE(ia),KAm_dyn,ZAm_dyn)
call GW_phBSE_dynamic_kernel_B(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW,OmRPA,rho_RPA,KB_dyn)
2020-04-22 00:39:52 +02:00
2023-07-21 11:18:00 +02:00
if(dophBSE2) call GW_phBSE2_dynamic_kernel_B(eta,nBas,nC,nO,nV,nR,nS,eGW,W,KB_dyn)
2020-06-01 11:35:17 +02:00
! Renormalization factor of the resonant and anti-resonant parts
2020-05-20 16:46:07 +02:00
2024-07-04 10:41:57 +02:00
Z_dyn(ia) = dot_product(X,matmul(ZAp_dyn,X)) &
+ dot_product(Y,matmul(ZAm_dyn,Y))
2023-07-21 10:21:54 +02:00
2024-07-04 10:41:57 +02:00
Om_dyn(ia) = dot_product(X,matmul(KAp_dyn - KA_sta,X)) &
- dot_product(Y,matmul(KAm_dyn - KA_sta,Y)) &
+ dot_product(X,matmul(KB_dyn - KB_sta,Y)) &
- dot_product(Y,matmul(KB_dyn - KB_sta,X))
2020-04-22 09:55:58 +02:00
2020-04-23 23:13:15 +02:00
end if
2020-04-22 09:55:58 +02:00
2024-07-04 10:41:57 +02:00
Z_dyn(ia) = 1d0/(1d0 - Z_dyn(ia))
Om_dyn(ia) = Z_dyn(ia)*Om_dyn(ia)
2020-04-22 00:39:52 +02:00
2020-04-23 23:13:15 +02:00
write(*,'(2X,I5,5X,F15.6,5X,F15.6,5X,F15.6,5X,F15.6)') &
2024-07-04 10:41:57 +02:00
ia,OmBSE(ia)*HaToeV,(OmBSE(ia)+Om_dyn(ia))*HaToeV,Om_dyn(ia)*HaToeV,Z_dyn(ia)
2020-04-22 00:39:52 +02:00
end do
2020-04-23 23:13:15 +02:00
write(*,*) '---------------------------------------------------------------------------------------------------'
2020-04-22 00:39:52 +02:00
write(*,*)
2023-07-19 11:03:55 +02:00
end subroutine