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

97 lines
1.9 KiB
Fortran
Raw Permalink Normal View History

2023-07-12 22:37:04 +02:00
subroutine ppLR_B(ispin,nBas,nC,nO,nV,nR,nOO,nVV,lambda,ERI,Bpp)
2019-10-05 22:06:25 +02:00
! Compute the B matrix of the pp channel
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: ispin
2022-08-17 14:32:14 +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) :: nOO
integer,intent(in) :: nVV
2021-10-18 23:12:43 +02:00
double precision,intent(in) :: lambda
2021-11-18 13:34:08 +01:00
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
2019-10-05 22:06:25 +02:00
! Local variables
double precision,external :: Kronecker_delta
integer :: a,b,i,j,ab,ij
! Output variables
2023-07-12 22:37:04 +02:00
double precision,intent(out) :: Bpp(nVV,nOO)
2019-10-05 22:06:25 +02:00
2019-10-07 22:31:45 +02:00
! Build B matrix for the singlet manifold
if(ispin == 1) then
ab = 0
do a=nO+1,nBas-nR
2022-08-17 14:32:14 +02:00
do b=a,nBas-nR
2019-10-07 22:31:45 +02:00
ab = ab + 1
ij = 0
do i=nC+1,nO
2022-08-17 14:32:14 +02:00
do j=i,nO
2019-10-07 22:31:45 +02:00
ij = ij + 1
2023-07-12 22:37:04 +02:00
Bpp(ab,ij) = lambda*(ERI(a,b,i,j) + ERI(a,b,j,i))/sqrt((1d0 + Kronecker_delta(a,b))*(1d0 + Kronecker_delta(i,j)))
2019-10-07 22:31:45 +02:00
end do
end do
end do
end do
2019-10-05 22:06:25 +02:00
2019-10-07 22:31:45 +02:00
end if
2019-10-05 22:06:25 +02:00
2022-08-17 14:32:14 +02:00
! Build the B matrix for the triplet manifold, or alpha-alpha, or in the spin-orbital basis
2019-10-05 22:06:25 +02:00
2022-08-17 14:32:14 +02:00
if(ispin == 2 .or. ispin == 4) then
2019-10-05 22:06:25 +02:00
2019-10-07 22:31:45 +02:00
ab = 0
do a=nO+1,nBas-nR
2022-08-17 14:32:14 +02:00
do b=a+1,nBas-nR
2019-10-07 22:31:45 +02:00
ab = ab + 1
ij = 0
do i=nC+1,nO
2022-08-17 14:32:14 +02:00
do j=i+1,nO
2019-10-07 22:31:45 +02:00
ij = ij + 1
2019-10-05 22:06:25 +02:00
2023-07-12 22:37:04 +02:00
Bpp(ab,ij) = lambda*(ERI(a,b,i,j) - ERI(a,b,j,i))
2019-10-07 22:31:45 +02:00
end do
end do
end do
end do
end if
2019-10-05 22:06:25 +02:00
2022-08-17 14:32:14 +02:00
! Build the alpha-beta block of the B matrix
2019-10-23 08:22:36 +02:00
2022-08-17 14:32:14 +02:00
if(ispin == 3) then
2019-10-23 08:22:36 +02:00
ab = 0
do a=nO+1,nBas-nR
2022-08-17 14:32:14 +02:00
do b=nO+1,nBas-nR
2019-10-23 08:22:36 +02:00
ab = ab + 1
ij = 0
do i=nC+1,nO
2022-08-17 14:32:14 +02:00
do j=nC+1,nO
2019-10-23 08:22:36 +02:00
ij = ij + 1
2023-07-12 22:37:04 +02:00
Bpp(ab,ij) = lambda*ERI(a,b,i,j)
2019-10-23 08:22:36 +02:00
end do
end do
end do
end do
end if
2023-07-12 22:37:04 +02:00
end subroutine