4
1
mirror of https://github.com/pfloos/quack synced 2024-06-02 11:25:28 +02:00
quack/src/LR/phLR_B.f90

97 lines
1.7 KiB
Fortran
Raw Permalink Normal View History

2023-07-12 22:37:04 +02:00
subroutine phLR_B(ispin,dRPA,nBas,nC,nO,nV,nR,nS,lambda,ERI,Bph)
2019-03-19 10:13:33 +01:00
2023-07-12 22:37:04 +02:00
! Compute the coupling block of the ph channel
2019-03-19 10:13:33 +01:00
implicit none
include 'parameters.h'
! Input variables
logical,intent(in) :: dRPA
integer,intent(in) :: ispin,nBas,nC,nO,nV,nR,nS
2020-01-08 10:17:19 +01:00
double precision,intent(in) :: lambda
2019-03-19 10:13:33 +01:00
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
! Local variables
2020-09-18 13:52:35 +02:00
double precision :: delta_dRPA
2019-03-19 10:13:33 +01:00
integer :: i,j,a,b,ia,jb
! Output variables
2023-07-12 22:37:04 +02:00
double precision,intent(out) :: Bph(nS,nS)
2019-03-19 10:13:33 +01:00
! Direct RPA
delta_dRPA = 0d0
if(dRPA) delta_dRPA = 1d0
2020-09-18 13:52:35 +02:00
! Build B matrix for singlet manifold
if(ispin == 1) then
ia = 0
do i=nC+1,nO
do a=nO+1,nBas-nR
ia = ia + 1
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
2023-07-12 22:37:04 +02:00
Bph(ia,jb) = 2d0*lambda*ERI(i,j,a,b) - (1d0 - delta_dRPA)*lambda*ERI(i,j,b,a)
2020-09-18 13:52:35 +02:00
end do
end do
end do
end do
end if
! Build B matrix for triplet manifold
if(ispin == 2) then
ia = 0
do i=nC+1,nO
do a=nO+1,nBas-nR
ia = ia + 1
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
2023-07-12 22:37:04 +02:00
Bph(ia,jb) = - (1d0 - delta_dRPA)*lambda*ERI(i,j,b,a)
2020-09-18 13:52:35 +02:00
end do
end do
end do
end do
end if
! Build B matrix for spin orbitals
if(ispin == 3) then
ia = 0
do i=nC+1,nO
do a=nO+1,nBas-nR
ia = ia + 1
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
2023-07-12 22:37:04 +02:00
Bph(ia,jb) = lambda*ERI(i,j,a,b) - (1d0 - delta_dRPA)*lambda*ERI(i,j,b,a)
2020-09-18 13:52:35 +02:00
end do
end do
end do
end do
end if
2019-03-19 10:13:33 +01:00
2023-07-12 22:37:04 +02:00
end subroutine