2020-06-14 13:18:56 +02:00
|
|
|
subroutine Bethe_Salpeter_dynamic_perturbation_iterative(TDA,dTDA,eta,nBas,nC,nO,nV,nR,nS,eGW,OmRPA,OmBSE,XpY,XmY,rho)
|
2020-05-21 16:13:52 +02:00
|
|
|
|
|
|
|
! Compute self-consistently the dynamical effects via perturbation theory for BSE
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
include 'parameters.h'
|
|
|
|
|
|
|
|
! Input variables
|
|
|
|
|
|
|
|
logical,intent(in) :: TDA
|
2020-06-14 13:18:56 +02:00
|
|
|
logical,intent(in) :: dTDA
|
2020-05-21 16:13:52 +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) :: eGW(nBas)
|
|
|
|
double precision,intent(in) :: OmRPA(nS)
|
|
|
|
double precision,intent(in) :: OmBSE(nS)
|
|
|
|
double precision,intent(in) :: XpY(nS,nS)
|
|
|
|
double precision,intent(in) :: XmY(nS,nS)
|
|
|
|
double precision,intent(in) :: rho(nBas,nBas,nS)
|
|
|
|
|
|
|
|
! Local variables
|
|
|
|
|
|
|
|
integer :: ia
|
2020-06-14 13:18:56 +02:00
|
|
|
|
2020-05-21 16:13:52 +02:00
|
|
|
integer,parameter :: maxS = 10
|
|
|
|
double precision :: gapGW
|
|
|
|
|
|
|
|
integer :: nSCF
|
|
|
|
integer :: maxSCF = 10
|
|
|
|
double precision :: Conv
|
2020-06-14 20:51:02 +02:00
|
|
|
double precision :: thresh = 1d-3
|
2020-05-21 16:13:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
double precision,allocatable :: OmDyn(:)
|
|
|
|
double precision,allocatable :: OmOld(:)
|
|
|
|
double precision,allocatable :: X(:)
|
|
|
|
double precision,allocatable :: Y(:)
|
2020-06-14 13:18:56 +02:00
|
|
|
|
|
|
|
double precision,allocatable :: Ap_dyn(:,:)
|
|
|
|
double precision,allocatable :: Am_dyn(:,:)
|
|
|
|
double precision,allocatable :: Bp_dyn(:,:)
|
|
|
|
double precision,allocatable :: Bm_dyn(:,:)
|
2020-05-21 16:13:52 +02:00
|
|
|
|
|
|
|
! Memory allocation
|
|
|
|
|
2020-06-14 13:18:56 +02:00
|
|
|
allocate(OmDyn(nS),OmOld(nS),X(nS),Y(nS),Ap_dyn(nS,nS))
|
|
|
|
|
|
|
|
if(.not.dTDA) allocate(Am_dyn(nS,nS),Bp_dyn(nS,nS),Bm_dyn(nS,nS))
|
|
|
|
|
|
|
|
! Print main components of transition vectors
|
|
|
|
|
|
|
|
call print_transition_vectors(nBas,nC,nO,nV,nR,nS,OmBSE,XpY,XmY)
|
2020-05-21 16:13:52 +02:00
|
|
|
|
2020-06-14 13:18:56 +02:00
|
|
|
if(dTDA) then
|
|
|
|
write(*,*)
|
|
|
|
write(*,*) '*** dynamical TDA activated ***'
|
|
|
|
write(*,*)
|
|
|
|
end if
|
2020-05-21 16:13:52 +02:00
|
|
|
|
|
|
|
gapGW = eGW(nO+1) - eGW(nO)
|
|
|
|
|
|
|
|
Conv = 1d0
|
|
|
|
nSCF = 0
|
|
|
|
OmOld(:) = OmBSE(:)
|
|
|
|
|
|
|
|
write(*,*) '---------------------------------------------------------------------------------------------------'
|
2020-06-14 13:18:56 +02:00
|
|
|
write(*,*) ' First-order dynamical correction to static Bethe-Salpeter excitation energies '
|
2020-05-21 16:13:52 +02:00
|
|
|
write(*,*) '---------------------------------------------------------------------------------------------------'
|
2020-06-14 13:18:56 +02:00
|
|
|
write(*,'(A57,F10.6,A3)') ' BSE neutral excitation must be lower than the GW gap = ',gapGW*HaToeV,' eV'
|
2020-06-14 15:09:33 +02:00
|
|
|
write(*,*) '---------------------------------------------------------------------------------------------------'
|
2020-05-21 16:13:52 +02:00
|
|
|
write(*,*)
|
|
|
|
|
|
|
|
do while(Conv > thresh .and. nSCF < maxSCF)
|
|
|
|
|
|
|
|
nSCF = nSCF + 1
|
|
|
|
|
|
|
|
write(*,*) '---------------------------------------------------------------------------------------------------'
|
|
|
|
write(*,'(2X,A15,I3)') 'Iteration n.',nSCF
|
|
|
|
write(*,*) '---------------------------------------------------------------------------------------------------'
|
2020-06-14 15:09:33 +02:00
|
|
|
write(*,'(2X,A5,1X,A20,1X,A20,1X,A20,A20)') '#','Static (eV)','Dynamic (eV)','Correction (eV)','Convergence (eV)'
|
2020-05-21 16:13:52 +02:00
|
|
|
write(*,*) '---------------------------------------------------------------------------------------------------'
|
|
|
|
|
|
|
|
do ia=1,min(nS,maxS)
|
|
|
|
|
|
|
|
|
|
|
|
X(:) = 0.5d0*(XpY(ia,:) + XmY(ia,:))
|
|
|
|
Y(:) = 0.5d0*(XpY(ia,:) - XmY(ia,:))
|
|
|
|
|
|
|
|
! First-order correction
|
|
|
|
|
2020-06-01 11:35:17 +02:00
|
|
|
if(dTDA) then
|
|
|
|
|
|
|
|
! Resonant part of the BSE correction
|
|
|
|
|
2020-06-01 17:26:52 +02:00
|
|
|
call Bethe_Salpeter_A_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),OmOld(ia),rho(:,:,:), &
|
2020-06-14 13:18:56 +02:00
|
|
|
Ap_dyn(:,:))
|
2020-05-21 16:13:52 +02:00
|
|
|
|
2020-06-14 13:18:56 +02:00
|
|
|
OmDyn(ia) = dot_product(X(:),matmul(Ap_dyn(:,:),X(:)))
|
2020-05-21 16:13:52 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
! Anti-resonant part of the BSE correction
|
|
|
|
|
2020-06-01 11:35:17 +02:00
|
|
|
call Bethe_Salpeter_AB_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),OmOld(ia),rho(:,:,:), &
|
2020-06-14 13:18:56 +02:00
|
|
|
Ap_dyn(:,:),Am_dyn(:,:),Bp_dyn(:,:),Bm_dyn(:,:))
|
2020-05-21 16:13:52 +02:00
|
|
|
|
2020-06-14 13:18:56 +02:00
|
|
|
OmDyn(ia) = dot_product(X(:),matmul(Ap_dyn(:,:),X(:))) &
|
|
|
|
- dot_product(Y(:),matmul(Am_dyn(:,:),Y(:))) &
|
|
|
|
+ dot_product(X(:),matmul(Bp_dyn(:,:),Y(:))) &
|
|
|
|
- dot_product(Y(:),matmul(Bm_dyn(:,:),X(:)))
|
2020-06-01 11:35:17 +02:00
|
|
|
|
2020-05-21 16:13:52 +02:00
|
|
|
end if
|
|
|
|
|
2020-06-14 15:09:33 +02:00
|
|
|
write(*,'(2X,I5,5X,F15.6,5X,F15.6,5X,F15.6,5X,F15.6)') &
|
|
|
|
ia,OmBSE(ia)*HaToeV,(OmBSE(ia)+OmDyn(ia))*HaToeV,OmDyn(ia)*HaToeV,(OmBSE(ia) + OmDyn(ia) - OmOld(ia))*HaToeV
|
2020-05-21 16:13:52 +02:00
|
|
|
|
|
|
|
end do
|
|
|
|
|
2020-06-14 20:51:02 +02:00
|
|
|
Conv = maxval(abs(OmBSE(:) + OmDyn(:) - OmOld(:)))*HaToeV
|
2020-05-21 16:13:52 +02:00
|
|
|
OmOld(:) = OmBSE(:) + OmDyn(:)
|
|
|
|
|
|
|
|
write(*,*) '---------------------------------------------------------------------------------------------------'
|
|
|
|
write(*,'(2X,A20,1X,F10.6)') ' Convergence = ',Conv
|
|
|
|
write(*,*) '---------------------------------------------------------------------------------------------------'
|
|
|
|
write(*,*)
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
! Did it actually converge?
|
|
|
|
|
|
|
|
if(nSCF == maxSCF) then
|
|
|
|
|
|
|
|
write(*,*)
|
|
|
|
write(*,*)'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
|
|
|
|
write(*,*)' Convergence failed '
|
|
|
|
write(*,*)'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
|
|
|
|
write(*,*)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
end subroutine Bethe_Salpeter_dynamic_perturbation_iterative
|