10
1
mirror of https://github.com/pfloos/quack synced 2024-12-26 14:23:38 +01:00
QuAcK/src/MBPT/excitation_density_Tmatrix.f90

208 lines
4.6 KiB
Fortran
Raw Normal View History

2021-10-17 23:04:22 +02:00
subroutine excitation_density_Tmatrix(ispin,nBas,nC,nO,nV,nR,nOO,nVV,ERI,X1,Y1,rho1,X2,Y2,rho2)
2019-10-06 22:35:36 +02:00
! Compute excitation densities for T-matrix self-energy
implicit none
! Input variables
2020-04-09 14:31:50 +02:00
integer,intent(in) :: ispin
2020-04-06 19:40:42 +02:00
integer,intent(in) :: nBas
integer,intent(in) :: nC
integer,intent(in) :: nO
integer,intent(in) :: nV
integer,intent(in) :: nR
2019-10-06 22:35:36 +02:00
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
2020-04-09 14:31:50 +02:00
integer,intent(in) :: nOO
integer,intent(in) :: nVV
double precision,intent(in) :: X1(nVV,nVV)
double precision,intent(in) :: Y1(nOO,nVV)
double precision,intent(in) :: X2(nVV,nOO)
double precision,intent(in) :: Y2(nOO,nOO)
2019-10-06 22:35:36 +02:00
! Local variables
2021-10-16 15:34:34 +02:00
integer :: k,l
integer :: c,d
integer :: p,q
2019-10-06 22:35:36 +02:00
integer :: ab,cd,ij,kl
2019-10-17 22:07:41 +02:00
double precision,external :: Kronecker_delta
2019-10-06 22:35:36 +02:00
! Output variables
2021-10-16 15:34:34 +02:00
double precision,intent(out) :: rho1(nBas,nBas,nVV)
double precision,intent(out) :: rho2(nBas,nBas,nOO)
2020-04-06 19:40:42 +02:00
! Initialization
2020-04-09 14:31:50 +02:00
rho1(:,:,:) = 0d0
rho2(:,:,:) = 0d0
2019-10-06 22:35:36 +02:00
2019-10-20 08:18:58 +02:00
!----------------------------------------------
! Singlet manifold
!----------------------------------------------
2020-04-09 14:31:50 +02:00
if(ispin == 1) then
do p=nC+1,nBas-nR
2021-10-16 15:34:34 +02:00
do q=nC+1,nBas-nR
2020-04-09 14:31:50 +02:00
do ab=1,nVV
cd = 0
do c=nO+1,nBas-nR
do d=c,nBas-nR
cd = cd + 1
2021-10-17 23:04:22 +02:00
rho1(p,q,ab) = rho1(p,q,ab) + ERI(p,q,c,d)*X1(cd,ab)
2020-04-09 14:31:50 +02:00
end do
2019-10-20 08:18:58 +02:00
end do
2020-04-09 14:31:50 +02:00
kl = 0
do k=nC+1,nO
do l=k,nO
kl = kl + 1
2021-10-17 23:04:22 +02:00
rho1(p,q,ab) = rho1(p,q,ab) + ERI(p,q,k,l)*Y1(kl,ab)
2020-04-09 14:31:50 +02:00
end do
2019-10-20 08:18:58 +02:00
end do
2020-04-09 14:31:50 +02:00
2019-10-20 08:18:58 +02:00
end do
2020-04-09 14:31:50 +02:00
do ij=1,nOO
cd = 0
do c=nO+1,nBas-nR
do d=c,nBas-nR
cd = cd + 1
2021-10-17 23:04:22 +02:00
rho2(p,q,ij) = rho2(p,q,ij) + ERI(p,q,c,d)*X2(cd,ij)
2020-04-09 14:31:50 +02:00
end do
2019-10-20 08:18:58 +02:00
end do
2020-04-09 14:31:50 +02:00
kl = 0
do k=nC+1,nO
do l=k,nO
kl = kl + 1
2021-10-17 23:04:22 +02:00
rho2(p,q,ij) = rho2(p,q,ij) + ERI(p,q,k,l)*Y2(kl,ij)
2020-04-09 14:31:50 +02:00
end do
2019-10-20 08:18:58 +02:00
end do
2020-04-09 14:31:50 +02:00
2019-10-20 08:18:58 +02:00
end do
2021-10-16 15:34:34 +02:00
2020-04-06 19:40:42 +02:00
end do
2019-10-20 08:18:58 +02:00
end do
2020-04-09 14:31:50 +02:00
end if
2019-10-20 08:18:58 +02:00
!----------------------------------------------
! Triplet manifold
!----------------------------------------------
2020-04-13 11:33:48 +02:00
if(ispin == 2 .or. ispin == 4) then
2020-04-09 14:31:50 +02:00
do p=nC+1,nBas-nR
2021-10-16 15:34:34 +02:00
do q=nC+1,nBas-nR
2020-04-09 14:31:50 +02:00
do ab=1,nVV
cd = 0
do c=nO+1,nBas-nR
do d=c+1,nBas-nR
cd = cd + 1
2021-10-16 15:34:34 +02:00
rho1(p,q,ab) = rho1(p,q,ab) &
2021-10-17 23:04:22 +02:00
+ (ERI(p,q,c,d) - ERI(p,q,d,c))*X1(cd,ab)
2020-04-09 14:31:50 +02:00
end do
2019-10-20 08:18:58 +02:00
end do
2020-04-09 14:31:50 +02:00
kl = 0
do k=nC+1,nO
do l=k+1,nO
kl = kl + 1
2021-10-16 15:34:34 +02:00
rho1(p,q,ab) = rho1(p,q,ab) &
2021-10-17 23:04:22 +02:00
+ (ERI(p,q,k,l) - ERI(p,q,l,k))*Y1(kl,ab)
2020-04-09 14:31:50 +02:00
end do
2019-10-20 08:18:58 +02:00
end do
2020-04-09 14:31:50 +02:00
2019-10-20 08:18:58 +02:00
end do
2020-04-09 14:31:50 +02:00
do ij=1,nOO
cd = 0
do c=nO+1,nBas-nR
do d=c+1,nBas-nR
cd = cd + 1
2021-10-16 15:34:34 +02:00
rho2(p,q,ij) = rho2(p,q,ij) &
2021-10-17 23:04:22 +02:00
+ (ERI(p,q,c,d) - ERI(p,q,d,c))*X2(cd,ij)
2020-04-09 14:31:50 +02:00
end do
2019-10-20 08:18:58 +02:00
end do
2020-04-09 14:31:50 +02:00
kl = 0
do k=nC+1,nO
do l=k+1,nO
kl = kl + 1
2021-10-16 15:34:34 +02:00
rho2(p,q,ij) = rho2(p,q,ij) &
2021-10-17 23:04:22 +02:00
+ (ERI(p,q,k,l) - ERI(p,q,l,k))*Y2(kl,ij)
2020-04-09 14:31:50 +02:00
end do
2019-10-20 08:18:58 +02:00
end do
2020-04-09 14:31:50 +02:00
2019-10-20 08:18:58 +02:00
end do
2021-10-16 15:34:34 +02:00
2020-04-06 19:40:42 +02:00
end do
2019-10-23 08:22:36 +02:00
end do
2020-04-09 14:31:50 +02:00
end if
2019-10-23 08:22:36 +02:00
2020-04-13 11:33:48 +02:00
!----------------------------------------------
! alpha-beta block
!----------------------------------------------
if(ispin == 3) then
do p=nC+1,nBas-nR
2021-10-16 15:34:34 +02:00
do q=nC+1,nBas-nR
2020-04-13 11:33:48 +02:00
do ab=1,nVV
cd = 0
do c=nO+1,nBas-nR
do d=nO+1,nBas-nR
cd = cd + 1
2021-10-17 23:04:22 +02:00
rho1(p,q,ab) = rho1(p,q,ab) + ERI(p,q,c,d)*X1(cd,ab)
2020-04-13 11:33:48 +02:00
end do
end do
kl = 0
do k=nC+1,nO
do l=nC+1,nO
kl = kl + 1
2021-10-17 23:04:22 +02:00
rho1(p,q,ab) = rho1(p,q,ab) + ERI(p,q,k,l)*Y1(kl,ab)
2020-04-13 11:33:48 +02:00
end do
end do
end do
do ij=1,nOO
cd = 0
do c=nO+1,nBas-nR
do d=nO+1,nBas-nR
cd = cd + 1
2021-10-17 23:04:22 +02:00
rho2(p,q,ij) = rho2(p,q,ij) + ERI(p,q,c,d)*X2(cd,ij)
2020-04-13 11:33:48 +02:00
end do
end do
kl = 0
do k=nC+1,nO
do l=nC+1,nO
kl = kl + 1
2021-10-17 23:04:22 +02:00
rho2(p,q,ij) = rho2(p,q,ij) + ERI(p,q,k,l)*Y2(kl,ij)
2020-04-13 11:33:48 +02:00
end do
end do
end do
2021-10-16 15:34:34 +02:00
2020-04-13 11:33:48 +02:00
end do
end do
end if
2019-10-06 22:35:36 +02:00
end subroutine excitation_density_Tmatrix