4
1
mirror of https://github.com/pfloos/quack synced 2024-11-19 20:42:44 +01:00
quack/src/GW/Sangalli_dynamic_perturbation.f90

125 lines
5.0 KiB
Fortran
Raw Normal View History

2020-09-30 00:10:57 +02:00
subroutine Sangalli_dynamic_perturbation(dTDA,eta,nBas,nC,nO,nV,nR,nS,eGW,OmRPA,OmBSE,XpY,XmY,rho)
2020-04-22 00:39:52 +02:00
2020-09-30 00:10:57 +02:00
! Compute dynamical effects via perturbation theory for Sangalli's kernel
2020-04-22 00:39:52 +02:00
implicit none
include 'parameters.h'
! Input variables
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
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)
2020-09-30 00:10:57 +02:00
double precision,intent(in) :: rho(nBas,nBas,nS)
2020-04-22 00:39:52 +02:00
! Local variables
integer :: ia
2020-06-03 12:06:16 +02:00
2020-04-22 00:39:52 +02:00
integer,parameter :: maxS = 10
2020-05-15 13:08:07 +02:00
double precision :: gapGW
2020-04-22 00:39:52 +02:00
double precision,allocatable :: OmDyn(:)
2020-04-23 23:13:15 +02:00
double precision,allocatable :: ZDyn(:)
2020-04-22 00:39:52 +02:00
double precision,allocatable :: X(:)
double precision,allocatable :: Y(:)
2020-06-01 11:35:17 +02:00
2020-06-11 15:36:16 +02:00
double precision,allocatable :: Ap_dyn(:,:)
double precision,allocatable :: ZAp_dyn(:,:)
2020-06-01 11:35:17 +02:00
2020-06-11 15:36:16 +02:00
double precision,allocatable :: Bp_dyn(:,:)
double precision,allocatable :: ZBp_dyn(:,:)
double precision,allocatable :: Am_dyn(:,:)
double precision,allocatable :: ZAm_dyn(:,:)
double precision,allocatable :: Bm_dyn(:,:)
double precision,allocatable :: ZBm_dyn(:,:)
2020-04-22 00:39:52 +02:00
! Memory allocation
2020-06-11 15:36:16 +02:00
allocate(OmDyn(nS),ZDyn(nS),X(nS),Y(nS),Ap_dyn(nS,nS),ZAp_dyn(nS,nS))
2020-05-20 16:49:16 +02:00
2020-06-11 15:36:16 +02:00
if(.not.dTDA) allocate(Am_dyn(nS,nS),ZAm_dyn(nS,nS),Bp_dyn(nS,nS),ZBp_dyn(nS,nS),Bm_dyn(nS,nS),ZBm_dyn(nS,nS))
2020-05-15 13:08:07 +02:00
2020-06-14 13:04:16 +02:00
! Print main components of transition vectors
2020-06-03 12:06:16 +02:00
2020-09-30 00:10:57 +02:00
call print_transition_vectors(nBas,nC,nO,nV,nR,nS,OmBSE,XpY,XmY)
2020-06-03 12:06:16 +02:00
2020-06-14 13:04:16 +02:00
if(dTDA) then
write(*,*)
write(*,*) '*** dynamical TDA activated ***'
write(*,*)
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-09-30 00:10:57 +02:00
write(*,*) ' First-order dynamical correction to static BSE excitation energies with Sangalli kernel '
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
2020-04-22 09:55:58 +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
2020-06-01 11:35:17 +02:00
if(dTDA) then
2020-05-15 13:08:07 +02:00
2020-09-30 00:10:57 +02:00
! call Sangalli_A_matrix_dynamic (eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),+OmBSE(ia),rho(:,:,:),Ap_dyn(:,:))
! call Sangalli_ZA_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),-OmBSE(ia),rho(:,:,:),ZAp_dyn(:,:))
ZDyn(ia) = dot_product(X(:),matmul(ZAp_dyn(:,:),X(:)))
OmDyn(ia) = dot_product(X(:),matmul(Ap_dyn(:,:),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-09-30 00:10:57 +02:00
! call Sangalli_A_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),+OmBSE(ia),rho(:,:,:),Ap_dyn(:,:))
! call Sangalli_A_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),-OmBSE(ia),rho(:,:,:),Am_dyn(:,:))
2020-04-22 00:39:52 +02:00
2020-09-30 00:10:57 +02:00
! call Sangalli_B_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),+OmBSE(ia),rho(:,:,:),Bp_dyn(:,:))
! call Sangalli_B_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),-OmBSE(ia),rho(:,:,:),Bm_dyn(:,:))
2020-05-20 16:46:07 +02:00
2020-09-30 00:10:57 +02:00
! call Sangalli_ZA_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),+OmBSE(ia),rho(:,:,:),ZAp_dyn(:,:))
! call Sangalli_ZA_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),-OmBSE(ia),rho(:,:,:),ZAm_dyn(:,:))
! call Sangalli_ZB_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),+OmBSE(ia),rho(:,:,:),ZBp_dyn(:,))
! call Sangalli_ZB_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),-OmBSE(ia),rho(:,:,:),ZBm_dyn(:,))
2020-05-20 16:46:07 +02:00
2020-09-30 00:10:57 +02:00
ZDyn(ia) = dot_product(X(:),matmul(ZAp_dyn(:,:),X(:))) &
+ dot_product(Y(:),matmul(ZAm_dyn(:,:),Y(:))) &
+ dot_product(X(:),matmul(ZBp_dyn(:,:),Y(:))) &
+ dot_product(Y(:),matmul(ZBm_dyn(:,:),X(:)))
2020-05-20 16:46:07 +02:00
2020-09-30 00:10:57 +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-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
2020-09-30 00:10:57 +02:00
ZDyn(ia) = 1d0/(1d0 - ZDyn(ia))
2020-05-15 13:08:07 +02:00
OmDyn(ia) = ZDyn(ia)*OmDyn(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)') &
ia,OmBSE(ia)*HaToeV,(OmBSE(ia)+OmDyn(ia))*HaToeV,OmDyn(ia)*HaToeV,ZDyn(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(*,*)
2020-09-30 00:10:57 +02:00
end subroutine Sangalli_dynamic_perturbation