1
0
mirror of https://gitlab.com/scemama/qp_plugins_scemama.git synced 2024-11-07 22:53:42 +01:00
qp_plugins_scemama/devel/cc/form_cW_nc.irp.f
2019-09-14 14:32:41 +02:00

129 lines
2.9 KiB
Fortran

subroutine form_cW_nc(cWoooo,cWovvo,cWvvvv)
! Compute W terms in CCSD
implicit none
! Local variables
integer :: i,j,m,n
integer :: a,b,e,f
double precision,external :: Kronecker_Delta
double precision :: x
! Output variables
double precision,intent(out) :: cWoooo(spin_occ_num,spin_occ_num,spin_occ_num,spin_occ_num)
double precision,intent(out) :: cWovvo(spin_occ_num,spin_vir_num,spin_vir_num,spin_occ_num)
double precision,intent(out) :: cWvvvv(spin_vir_num,spin_vir_num,spin_vir_num,spin_vir_num)
! OOOO block
cWoooo(:,:,:,:) = OOOO(:,:,:,:)
do e=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
do n=1,spin_occ_num
do m=1,spin_occ_num
cWoooo(m,n,i,j) = cWoooo(m,n,i,j) + t1_cc(j,e)*OOOV(m,n,i,e) - t1_cc(i,e)*OOOV(m,n,j,e)
end do
end do
end do
end do
end do
do f=1,spin_vir_num
do e=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
x = 0.25d0*tau_cc(i,j,e,f)
do n=1,spin_occ_num
do m=1,spin_occ_num
cWoooo(m,n,i,j) = cWoooo(m,n,i,j) + x*OOVV(m,n,e,f)
end do
end do
end do
end do
end do
end do
! OVVO block
cWovvo(:,:,:,:) = OVVO(:,:,:,:)
do f=1,spin_vir_num
do j=1,spin_occ_num
do e=1,spin_vir_num
do b=1,spin_vir_num
do m=1,spin_occ_num
cWovvo(m,b,e,j) = cWovvo(m,b,e,j) + t1_cc(j,f)*OVVV(m,b,e,f)
end do
end do
end do
end do
end do
do j=1,spin_occ_num
do e=1,spin_vir_num
do b=1,spin_vir_num
do n=1,spin_occ_num
do m=1,spin_occ_num
cWovvo(m,b,e,j) = cWovvo(m,b,e,j) - t1_cc(n,b)*OOVO(m,n,e,j)
end do
end do
end do
end do
end do
do j=1,spin_occ_num
do f=1,spin_vir_num
do b=1,spin_vir_num
do n=1,spin_occ_num
x = 0.5d0*t2_cc(j,n,f,b) + t1_cc(j,f)*t1_cc(n,b)
do e=1,spin_vir_num
do m=1,spin_occ_num
cWovvo(m,b,e,j) = cWovvo(m,b,e,j) - x *OOVV(m,n,e,f)
end do
end do
end do
end do
end do
end do
! VVVV block
cWvvvv(:,:,:,:) = VVVV(:,:,:,:)
do f=1,spin_vir_num
do e=1,spin_vir_num
do b=1,spin_vir_num
do a=1,spin_vir_num
do m=1,spin_occ_num
cWvvvv(a,b,e,f) = cWvvvv(a,b,e,f) - t1_cc(m,b)*VOVV(a,m,e,f) + t1_cc(m,a)*VOVV(b,m,e,f)
end do
end do
end do
end do
end do
do f=1,spin_vir_num
do e=1,spin_vir_num
do b=1,spin_vir_num
do a=1,spin_vir_num
x = 0.d0
do n=1,spin_occ_num
do m=1,spin_occ_num
x = x + tau_cc(m,n,a,b)*OOVV(m,n,e,f)
end do
end do
cWvvvv(a,b,e,f) = cWvvvv(a,b,e,f) + 0.25d0*x
end do
end do
end do
end do
end subroutine form_cW_nc