10
1
mirror of https://github.com/pfloos/quack synced 2024-12-23 04:43:42 +01:00
QuAcK/src/GW/RGW_ppBSE_dynamic_kernel_C.f90

131 lines
3.9 KiB
Fortran
Raw Normal View History

2024-09-03 16:06:09 +02:00
subroutine RGW_ppBSE_dynamic_kernel_C(ispin,eta,nBas,nC,nO,nV,nR,nS,nVV,lambda,eGW,Om,rho,OmBSE,KC_dyn,ZC_dyn)
2023-07-24 15:21:21 +02:00
! Compute the dynamic part of the Bethe-Salpeter equation matrices
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: ispin
integer,intent(in) :: nBas
integer,intent(in) :: nC
integer,intent(in) :: nO
integer,intent(in) :: nV
integer,intent(in) :: nR
integer,intent(in) :: nS
integer,intent(in) :: nVV
double precision,intent(in) :: eta
double precision,intent(in) :: lambda
double precision,intent(in) :: eGW(nBas)
double precision,intent(in) :: Om(nS)
double precision,intent(in) :: rho(nBas,nBas,nS)
double precision,intent(in) :: OmBSE
! Local variables
2024-07-02 14:41:12 +02:00
double precision,external :: Kronecker_delta
2023-07-24 15:21:21 +02:00
double precision :: dem,num
integer :: m
integer :: a,b,c,d
integer :: ab,cd
! Output variables
double precision,intent(out) :: KC_dyn(nVV,nVV)
double precision,intent(out) :: ZC_dyn(nVV,nVV)
! Initialization
KC_dyn(:,:) = 0d0
ZC_dyn(:,:) = 0d0
! Build dynamic A matrix
if(ispin == 1) then
ab = 0
do a=nO+1,nBas-nR
do b=a,nBas-nR
ab = ab + 1
cd = 0
do c=nO+1,nBas-nR
do d=c,nBas-nR
cd = cd + 1
do m=1,nS
num = (rho(a,c,m)*rho(b,d,m) + rho(b,c,m)*rho(a,d,m))/2
2024-07-04 14:11:04 +02:00
dem = OmBSE - Om(m) - eGW(b) - eGW(d)
KC_dyn(ab,cd) = KC_dyn(ab,cd) + num*dem/(dem**2 + eta**2)
ZC_dyn(ab,cd) = ZC_dyn(ab,cd) - num*(dem**2 - eta**2)/(dem**2 + eta**2)**2
2023-07-24 15:21:21 +02:00
dem = OmBSE - Om(m) - eGW(a) - eGW(c)
KC_dyn(ab,cd) = KC_dyn(ab,cd) + num*dem/(dem**2 + eta**2)
ZC_dyn(ab,cd) = ZC_dyn(ab,cd) - num*(dem**2 - eta**2)/(dem**2 + eta**2)**2
2023-07-24 15:21:21 +02:00
dem = OmBSE - Om(m) - eGW(a) - eGW(d)
KC_dyn(ab,cd) = KC_dyn(ab,cd) + num*dem/(dem**2 + eta**2)
ZC_dyn(ab,cd) = ZC_dyn(ab,cd) - num*(dem**2 - eta**2)/(dem**2 + eta**2)**2
2023-07-24 15:21:21 +02:00
dem = OmBSE - Om(m) - eGW(b) - eGW(c)
KC_dyn(ab,cd) = KC_dyn(ab,cd) + num*dem/(dem**2 + eta**2)
ZC_dyn(ab,cd) = ZC_dyn(ab,cd) - num*(dem**2 - eta**2)/(dem**2 + eta**2)**2
2024-07-02 14:41:12 +02:00
2024-07-04 14:11:04 +02:00
end do
2024-07-04 10:41:57 +02:00
KC_dyn(ab,cd) = KC_dyn(ab,cd)/sqrt((1d0 + Kronecker_delta(a,b))*(1d0 + Kronecker_delta(c,d)))
ZC_dyn(ab,cd) = ZC_dyn(ab,cd)/sqrt((1d0 + Kronecker_delta(a,b))*(1d0 + Kronecker_delta(c,d)))
2024-07-04 10:41:57 +02:00
2023-07-24 15:21:21 +02:00
end do
end do
end do
end do
end if
if(ispin == 2) then
ab = 0
do a=nO+1,nBas-nR
do b=a+1,nBas-nR
ab = ab + 1
cd = 0
do c=nO+1,nBas-nR
do d=c+1,nBas-nR
cd = cd + 1
do m=1,nS
num = (rho(a,c,m)*rho(b,d,m) - rho(b,c,m)*rho(a,d,m))/2
2023-07-24 15:21:21 +02:00
dem = OmBSE - Om(m) - eGW(b) - eGW(d)
KC_dyn(ab,cd) = KC_dyn(ab,cd) + num*dem/(dem**2 + eta**2)
ZC_dyn(ab,cd) = ZC_dyn(ab,cd) - num*(dem**2 - eta**2)/(dem**2 + eta**2)**2
2023-07-24 15:21:21 +02:00
dem = OmBSE - Om(m) - eGW(a) - eGW(c)
KC_dyn(ab,cd) = KC_dyn(ab,cd) + num*dem/(dem**2 + eta**2)
ZC_dyn(ab,cd) = ZC_dyn(ab,cd) - num*(dem**2 - eta**2)/(dem**2 + eta**2)**2
2023-07-24 15:21:21 +02:00
dem = OmBSE - Om(m) - eGW(a) - eGW(d)
KC_dyn(ab,cd) = KC_dyn(ab,cd) + num*dem/(dem**2 + eta**2)
ZC_dyn(ab,cd) = ZC_dyn(ab,cd) - num*(dem**2 - eta**2)/(dem**2 + eta**2)**2
2023-07-24 15:21:21 +02:00
dem = OmBSE - Om(m) - eGW(b) - eGW(c)
KC_dyn(ab,cd) = KC_dyn(ab,cd) + num*dem/(dem**2 + eta**2)
ZC_dyn(ab,cd) = ZC_dyn(ab,cd) - num*(dem**2 - eta**2)/(dem**2 + eta**2)**2
2023-07-24 15:21:21 +02:00
end do
2024-07-04 10:41:57 +02:00
2023-07-24 15:21:21 +02:00
end do
end do
end do
end do
end if
2023-07-24 22:40:00 +02:00
2023-07-24 15:21:21 +02:00
end subroutine