2023-07-12 22:37:04 +02:00
|
|
|
subroutine ppLR_D(ispin,nBas,nC,nO,nV,nR,nOO,lambda,e,ERI,Dpp)
|
2019-10-05 22:06:25 +02:00
|
|
|
|
|
|
|
! Compute the D 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
|
2021-10-18 23:12:43 +02:00
|
|
|
double precision,intent(in) :: lambda
|
2019-10-05 22:06:25 +02:00
|
|
|
double precision,intent(in) :: e(nBas),ERI(nBas,nBas,nBas,nBas)
|
|
|
|
|
|
|
|
! Local variables
|
|
|
|
|
2019-10-06 20:08:38 +02:00
|
|
|
double precision :: eF
|
2019-10-05 22:06:25 +02:00
|
|
|
double precision,external :: Kronecker_delta
|
|
|
|
|
|
|
|
integer :: i,j,k,l,ij,kl
|
|
|
|
|
|
|
|
! Output variables
|
|
|
|
|
2023-07-12 22:37:04 +02:00
|
|
|
double precision,intent(out) :: Dpp(nOO,nOO)
|
2019-10-05 22:06:25 +02:00
|
|
|
|
2019-10-07 22:31:45 +02:00
|
|
|
! Define the chemical potential
|
2019-10-05 22:06:25 +02:00
|
|
|
|
2021-12-13 11:40:16 +01:00
|
|
|
! eF = e(nO) + e(nO+1)
|
|
|
|
eF = 0d0
|
2019-10-07 22:31:45 +02:00
|
|
|
|
|
|
|
! Build the D matrix for the singlet manifold
|
|
|
|
|
|
|
|
if(ispin == 1) then
|
|
|
|
|
|
|
|
ij = 0
|
|
|
|
do i=nC+1,nO
|
2020-03-19 10:21:18 +01:00
|
|
|
do j=i,nO
|
2019-10-07 22:31:45 +02:00
|
|
|
ij = ij + 1
|
|
|
|
kl = 0
|
|
|
|
do k=nC+1,nO
|
2020-03-19 10:21:18 +01:00
|
|
|
do l=k,nO
|
2019-10-07 22:31:45 +02:00
|
|
|
kl = kl + 1
|
|
|
|
|
2023-07-12 22:37:04 +02:00
|
|
|
Dpp(ij,kl) = - (e(i) + e(j) - eF)*Kronecker_delta(i,k)*Kronecker_delta(j,l) &
|
|
|
|
+ lambda*(ERI(i,j,k,l) + ERI(i,j,l,k))/sqrt((1d0 + Kronecker_delta(i,j))*(1d0 + Kronecker_delta(k,l)))
|
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
|
|
|
|
2020-04-13 11:33:48 +02:00
|
|
|
! Build the D matrix for the triplet manifold, the alpha-alpha block, or in the spin-orbital basis
|
2019-10-05 22:06:25 +02:00
|
|
|
|
2020-04-13 11:33:48 +02:00
|
|
|
if(ispin == 2 .or. ispin == 4) then
|
2019-10-06 20:08:38 +02:00
|
|
|
|
2019-10-07 22:31:45 +02:00
|
|
|
ij = 0
|
|
|
|
do i=nC+1,nO
|
2020-03-19 10:21:18 +01:00
|
|
|
do j=i+1,nO
|
2019-10-07 22:31:45 +02:00
|
|
|
ij = ij + 1
|
|
|
|
kl = 0
|
|
|
|
do k=nC+1,nO
|
2020-03-19 10:21:18 +01:00
|
|
|
do l=k+1,nO
|
2019-10-07 22:31:45 +02:00
|
|
|
kl = kl + 1
|
|
|
|
|
2023-07-12 22:37:04 +02:00
|
|
|
Dpp(ij,kl) = - (e(i) + e(j) - eF)*Kronecker_delta(i,k)*Kronecker_delta(j,l) &
|
|
|
|
+ lambda*(ERI(i,j,k,l) - ERI(i,j,l,k))
|
2019-10-05 22:06:25 +02:00
|
|
|
|
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
|
|
|
|
2020-04-13 11:33:48 +02:00
|
|
|
! Build the alpha-beta block of the D matrix
|
2019-10-23 08:22:36 +02:00
|
|
|
|
|
|
|
if(ispin == 3) then
|
|
|
|
|
|
|
|
ij = 0
|
|
|
|
do i=nC+1,nO
|
2020-04-13 11:33:48 +02:00
|
|
|
do j=nC+1,nO
|
2019-10-23 08:22:36 +02:00
|
|
|
ij = ij + 1
|
|
|
|
kl = 0
|
|
|
|
do k=nC+1,nO
|
2020-04-13 11:33:48 +02:00
|
|
|
do l=nC+1,nO
|
2019-10-23 08:22:36 +02:00
|
|
|
kl = kl + 1
|
|
|
|
|
2023-07-12 22:37:04 +02:00
|
|
|
Dpp(ij,kl) = - (e(i) + e(j) - eF)*Kronecker_delta(i,k)*Kronecker_delta(j,l) &
|
|
|
|
+ lambda*ERI(i,j,k,l)
|
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
|