2019-10-07 22:31:45 +02:00
|
|
|
subroutine linear_response_D_pp(ispin,nBas,nC,nO,nV,nR,nOO,nVV,e,ERI,D_pp)
|
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
|
|
|
|
integer,intent(in) :: nBas,nC,nO,nV,nR,nOO,nVV
|
|
|
|
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
|
|
|
|
|
|
|
|
double precision,intent(out) :: D_pp(nOO,nOO)
|
|
|
|
|
2019-10-07 22:31:45 +02:00
|
|
|
! Define the chemical potential
|
2019-10-05 22:06:25 +02:00
|
|
|
|
2019-10-07 22:31:45 +02:00
|
|
|
eF = e(nO) + e(nO+1)
|
|
|
|
|
|
|
|
! Build the D matrix for the singlet manifold
|
|
|
|
|
|
|
|
if(ispin == 1) then
|
|
|
|
|
|
|
|
ij = 0
|
|
|
|
do i=nC+1,nO
|
|
|
|
do j=nC+1,i
|
|
|
|
ij = ij + 1
|
|
|
|
kl = 0
|
|
|
|
do k=nC+1,nO
|
|
|
|
do l=nC+1,k
|
|
|
|
kl = kl + 1
|
|
|
|
|
|
|
|
D_pp(ij,kl) = - (e(i) + e(j) - eF)*Kronecker_delta(i,k)*Kronecker_delta(j,l) &
|
2019-10-14 23:11:29 +02:00
|
|
|
+ (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
|
|
|
|
2019-10-07 22:31:45 +02:00
|
|
|
! Build the D matrix for the triplet manifold
|
2019-10-05 22:06:25 +02:00
|
|
|
|
2019-10-07 22:31:45 +02:00
|
|
|
if(ispin == 2) then
|
2019-10-06 20:08:38 +02:00
|
|
|
|
2019-10-07 22:31:45 +02:00
|
|
|
ij = 0
|
|
|
|
do i=nC+1,nO
|
|
|
|
do j=nC+1,i-1
|
|
|
|
ij = ij + 1
|
|
|
|
kl = 0
|
|
|
|
do k=nC+1,nO
|
|
|
|
do l=nC+1,k-1
|
|
|
|
kl = kl + 1
|
|
|
|
|
|
|
|
D_pp(ij,kl) = - (e(i) + e(j) - eF)*Kronecker_delta(i,k)*Kronecker_delta(j,l) &
|
2019-10-14 23:11:29 +02:00
|
|
|
+ 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
|
|
|
|
2019-10-23 08:22:36 +02:00
|
|
|
! Build the D matrix for the spinorbital basis
|
|
|
|
|
|
|
|
if(ispin == 3) then
|
|
|
|
|
|
|
|
ij = 0
|
|
|
|
do i=nC+1,nO
|
|
|
|
do j=i+1,nO
|
|
|
|
ij = ij + 1
|
|
|
|
kl = 0
|
|
|
|
do k=nC+1,nO
|
|
|
|
do l=k+1,nO
|
|
|
|
kl = kl + 1
|
|
|
|
|
|
|
|
D_pp(ij,kl) = - (e(i) + e(j) - eF)*Kronecker_delta(i,k)*Kronecker_delta(j,l) &
|
|
|
|
+ ERI(i,j,k,l) - ERI(i,j,l,k)
|
|
|
|
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
2019-10-05 22:06:25 +02:00
|
|
|
end subroutine linear_response_D_pp
|