4
1
mirror of https://github.com/pfloos/quack synced 2024-11-18 12:03:59 +01:00
quack/src/MBPT/unrestricted_Bethe_Salpeter_A_matrix.f90

153 lines
3.9 KiB
Fortran
Raw Normal View History

2020-09-30 00:10:57 +02:00
subroutine unrestricted_Bethe_Salpeter_A_matrix(ispin,eta,nBas,nC,nO,nV,nR,nSa,nSb,nSt,nS_sc,lambda,eGW, &
2020-10-05 23:00:56 +02:00
ERI_aaaa,ERI_aabb,ERI_bbbb,Omega,rho,A_lr)
2020-09-22 22:14:08 +02:00
! Compute the extra term for Bethe-Salpeter equation for linear response in the unrestricted formalism
implicit none
include 'parameters.h'
! Input variables
2020-09-23 22:48:54 +02:00
integer,intent(in) :: ispin
2020-09-22 22:14:08 +02:00
integer,intent(in) :: nBas
integer,intent(in) :: nC(nspin)
integer,intent(in) :: nO(nspin)
integer,intent(in) :: nV(nspin)
integer,intent(in) :: nR(nspin)
integer,intent(in) :: nSa
integer,intent(in) :: nSb
integer,intent(in) :: nSt
2020-09-24 14:39:37 +02:00
integer,intent(in) :: nS_sc
2020-09-22 22:14:08 +02:00
double precision,intent(in) :: eta
double precision,intent(in) :: lambda
2020-09-30 00:10:57 +02:00
double precision,intent(in) :: eGW(nBas,nspin)
2020-09-22 22:14:08 +02:00
double precision,intent(in) :: ERI_aaaa(nBas,nBas,nBas,nBas)
double precision,intent(in) :: ERI_aabb(nBas,nBas,nBas,nBas)
double precision,intent(in) :: ERI_bbbb(nBas,nBas,nBas,nBas)
2020-09-24 14:39:37 +02:00
double precision,intent(in) :: Omega(nS_sc)
double precision,intent(in) :: rho(nBas,nBas,nS_sc,nspin)
2020-09-22 22:14:08 +02:00
! Local variables
double precision :: chi
double precision :: eps
integer :: i,j,a,b,ia,jb,kc
! Output variables
double precision,intent(out) :: A_lr(nSt,nSt)
2020-09-23 22:48:54 +02:00
!--------------------------------------------------!
! Build BSE matrix for spin-conserving transitions !
!--------------------------------------------------!
2020-09-22 22:14:08 +02:00
2020-09-23 22:48:54 +02:00
if(ispin == 1) then
2020-09-22 22:14:08 +02:00
2020-09-23 22:48:54 +02:00
! aaaa block
ia = 0
do i=nC(1)+1,nO(1)
do a=nO(1)+1,nBas-nR(1)
ia = ia + 1
jb = 0
do j=nC(1)+1,nO(1)
do b=nO(1)+1,nBas-nR(1)
jb = jb + 1
chi = 0d0
2020-09-24 14:39:37 +02:00
do kc=1,nS_sc
2020-09-23 22:48:54 +02:00
eps = Omega(kc)**2 + eta**2
chi = chi + rho(i,j,kc,1)*rho(a,b,kc,1)*Omega(kc)/eps
enddo
2020-09-24 14:39:37 +02:00
A_lr(ia,jb) = A_lr(ia,jb) - lambda*ERI_aaaa(i,b,j,a) + 2d0*lambda*chi
2020-09-22 22:14:08 +02:00
enddo
enddo
enddo
enddo
2020-09-23 22:48:54 +02:00
! bbbb block
ia = 0
do i=nC(2)+1,nO(2)
do a=nO(2)+1,nBas-nR(2)
ia = ia + 1
jb = 0
do j=nC(2)+1,nO(2)
do b=nO(2)+1,nBas-nR(2)
jb = jb + 1
chi = 0d0
2020-09-24 14:39:37 +02:00
do kc=1,nS_sc
2020-09-23 22:48:54 +02:00
eps = Omega(kc)**2 + eta**2
chi = chi + rho(i,j,kc,2)*rho(a,b,kc,2)*Omega(kc)/eps
enddo
2020-09-24 14:39:37 +02:00
A_lr(nSa+ia,nSa+jb) = A_lr(nSa+ia,nSa+jb) - lambda*ERI_bbbb(i,b,j,a) + 2d0*lambda*chi
2020-09-22 22:14:08 +02:00
enddo
enddo
enddo
enddo
2020-09-23 22:48:54 +02:00
end if
2020-09-22 22:14:08 +02:00
2020-09-23 22:48:54 +02:00
!--------------------------------------------!
! Build BSE matrix for spin-flip transitions !
!--------------------------------------------!
2020-09-22 22:14:08 +02:00
2020-09-23 22:48:54 +02:00
if(ispin == 2) then
2020-09-22 22:14:08 +02:00
2020-09-23 22:48:54 +02:00
! abab block
ia = 0
do i=nC(1)+1,nO(1)
do a=nO(2)+1,nBas-nR(2)
ia = ia + 1
jb = 0
do j=nC(1)+1,nO(1)
do b=nO(2)+1,nBas-nR(2)
jb = jb + 1
chi = 0d0
2020-09-24 14:39:37 +02:00
do kc=1,nS_sc
2020-09-23 22:48:54 +02:00
eps = Omega(kc)**2 + eta**2
chi = chi + rho(i,j,kc,1)*rho(a,b,kc,2)*Omega(kc)/eps
enddo
2020-10-05 16:58:19 +02:00
A_lr(ia,jb) = A_lr(ia,jb) - lambda*ERI_aabb(i,b,j,a) + 2d0*lambda*chi
2020-09-23 22:48:54 +02:00
end do
end do
end do
end do
! baba block
ia = 0
do i=nC(2)+1,nO(2)
do a=nO(1)+1,nBas-nR(1)
ia = ia + 1
jb = 0
do j=nC(2)+1,nO(2)
do b=nO(1)+1,nBas-nR(1)
jb = jb + 1
chi = 0d0
2020-09-24 14:39:37 +02:00
do kc=1,nS_sc
2020-09-23 22:48:54 +02:00
eps = Omega(kc)**2 + eta**2
chi = chi + rho(i,j,kc,2)*rho(a,b,kc,1)*Omega(kc)/eps
enddo
2020-10-05 16:58:19 +02:00
A_lr(nSa+ia,nSa+jb) = A_lr(nSa+ia,nSa+jb) - lambda*ERI_aabb(b,i,a,j) + 2d0*lambda*chi
2020-09-23 22:48:54 +02:00
end do
end do
end do
end do
end if
2020-09-22 22:14:08 +02:00
end subroutine unrestricted_Bethe_Salpeter_A_matrix