1
0
mirror of https://gitlab.com/scemama/qp_plugins_scemama.git synced 2024-11-09 07:33:41 +01:00

Compare commits

..

7 Commits

Author SHA1 Message Date
1fa7c93458 Cleaning 2019-09-14 15:07:26 +02:00
34c08ae5a6 Removed r1 and r2 2019-09-14 15:01:09 +02:00
8b131877c4 Curly Fock 2019-09-14 14:42:46 +02:00
3e6b874f9e Removed tau 2019-09-14 14:32:41 +02:00
10ae28d78d Removed taus 2019-09-14 14:28:30 +02:00
56c3466c42 Removed t1, t2 2019-09-14 14:25:53 +02:00
a6e87526b1 Removed nO nV 2019-09-14 14:15:25 +02:00
24 changed files with 867 additions and 1162 deletions

View File

@ -18,31 +18,13 @@ subroutine CCSD
integer :: p,q,r,s
double precision :: start_CCSDT,end_CCSDT,t_CCSDT
integer :: nBas2
integer :: nO
integer :: nV
integer :: nSCF
double precision :: Conv
double precision :: EcMP2
double precision :: ECCSD,EcCCSD
double precision :: ECCSD
double precision :: EcCCT
double precision :: get_two_e_integral,u_dot_v
double precision,allocatable :: cFvv(:,:)
double precision,allocatable :: cFoo(:,:)
double precision,allocatable :: cFov(:,:)
double precision,allocatable :: cWoooo(:,:,:,:)
double precision,allocatable :: cWvvvv(:,:,:,:)
double precision,allocatable :: cWovvo(:,:,:,:)
double precision,allocatable :: r1(:,:)
double precision,allocatable :: r2(:,:,:,:)
double precision,allocatable :: t1(:,:)
double precision,allocatable :: t2(:,:,:,:)
double precision,allocatable :: tau(:,:,:,:)
double precision,allocatable :: taus(:,:,:,:)
! Hello world
write(*,*)
@ -67,31 +49,12 @@ subroutine CCSD
nBas2 = spin_mo_num
! Define occupied and virtual spaces
nO = spin_occ_num
nV = spin_vir_num
! Guess amplitudes
allocate(t1(nO,nV),t2(nO,nO,nV,nV),tau(nO,nO,nV,nV),taus(nO,nO,nV,nV))
t1(:,:) = t1_guess(:,:)
t2(:,:,:,:) = t2_guess(:,:,:,:)
! Initialization
allocate(cFvv(nV,nV),cFoo(nO,nO),cFov(nO,nV), &
cWoooo(nO,nO,nO,nO),cWvvvv(nV,nV,nV,nV),cWovvo(nO,nV,nV,nO), &
r1(nO,nV),r2(nO,nO,nV,nV))
Conv = 1d0
nSCF = 0
call form_taus_nc(nO,nV,t1,t2,taus)
call form_tau_nc (nO,nV,t1,t2,tau)
EcMP2 = 0.25d0*u_dot_v(OOVV,tau,size(OOVV))
EcMP2 = 0.25d0*u_dot_v(OOVV,tau_cc,size(OOVV))
write(*,'(1X,A10,1X,F10.6)') 'Ec(MP2) = ',EcMP2
write(*,'(1X,A10,1X,F10.6)') 'E (MP2) = ',EcMP2 + ERHF
@ -108,42 +71,17 @@ subroutine CCSD
do while(Conv > thresh .and. nSCF < maxSCF)
! Excrement
nSCF = nSCF + 1
call form_cf_nc (nO,nV,t1,taus, &
spin_fock_matrix_mo_oo, &
spin_fock_matrix_mo_ov, &
spin_fock_matrix_mo_vv, &
cFoo,cFov,cFvv)
call form_cw_nc (nO,nV,t1,t2,tau, &
cWoooo,cWovvo,cWvvvv)
! Compute residuals
call form_r1_nc(nO,nV,t1,t2,spin_fock_matrix_mo_ov, &
cFoo,cFov,cFvv,r1)
call form_r2_nc(nO,nV,t1,t2,tau,cFoo,cFov,cFvv, &
cWoooo,cWvvvv,cWovvo,r2)
! Check convergence
Conv = max(maxval(abs(r1(:,:))),maxval(abs(r2(:,:,:,:))))
Conv = max(maxval(abs(r1_cc(:,:))),maxval(abs(r2_cc(:,:,:,:))))
! Update
t1(:,:) = t1(:,:) - r1(:,:) /delta_OV (:,:)
t2(:,:,:,:) = t2(:,:,:,:) - r2(:,:,:,:)/delta_OOVV(:,:,:,:)
call form_taus_nc(nO,nV,t1,t2,taus)
call form_tau_nc (nO,nV,t1,t2,tau)
! Compute correlation energy
call CCSD_Ec_nc(nO,nV,t1,t2,spin_fock_matrix_mo_ov,EcCCSD)
t1_cc(:,:) = t1_cc(:,:) - r1_cc(:,:) /delta_OV (:,:)
t2_cc(:,:,:,:) = t2_cc(:,:,:,:) - r2_cc(:,:,:,:)/delta_OOVV(:,:,:,:)
TOUCH t1_cc t2_cc
! Dump results
@ -172,22 +110,13 @@ subroutine CCSD
end if
! Deallocate memory
deallocate( &
cFvv,cFoo,cFov, &
cWoooo,cWvvvv,cWovvo, &
tau,taus, &
r1,r2)
!------------------------------------------------------------------------
! (T) correction
!------------------------------------------------------------------------
if(doCCSDT) then
write(*,*) "Starting (T) calculation"
! call cpu_time(start_CCSDT)V
call CCSDT(nO,nV,t1,t2,EcCCT)
! call cpu_time(end_CCSDT)
call CCSDT(EcCCT)
call write_time(6)
! t_CCSDT = end_CCSDT - start_CCSDT

View File

@ -1,16 +1,9 @@
subroutine CCSDT(nO,nV,t1,t2,EcCCT)
subroutine CCSDT(EcCCT)
! Compute the (T) correction of the CCSD(T) energy
implicit none
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: t2(nO,nO,nV,nV)
! Local variables
double precision,allocatable :: ub(:,:,:,:,:,:)
@ -22,14 +15,14 @@ subroutine CCSDT(nO,nV,t1,t2,EcCCT)
! Memory allocation
allocate(ub(nO,nO,nO,nV,nV,nV),ubb(nO,nO,nO,nV,nV,nV))
allocate(ub(spin_occ_num,spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num,spin_vir_num),ubb(spin_occ_num,spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num,spin_vir_num))
! Form CCSD(T) quantities
call form_ub(nO,nV,t1,ub)
call form_ub(ub)
call form_ubb(nO,nV,t2,ubb)
call form_ubb(ubb)
call form_T(nO,nV,ub,ubb,EcCCT)
call form_T(ub,ubb,EcCCT)
end subroutine CCSDT

View File

@ -1,54 +1,40 @@
subroutine CCSD_Ec_nc(nO,nV,t1,t2,Fov,EcCCSD)
! Compute the CCSD correlatio energy in non-conanical form
BEGIN_PROVIDER [ double precision, EcCCSD ]
implicit none
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: t2(nO,nO,nV,nV)
double precision,intent(in) :: Fov(nO,nV)
BEGIN_DOC
! CCSD correlation energy in non-canonical form
END_DOC
! Local variables
integer :: i,j,a,b
! Output variables
double precision,intent(out) :: EcCCSD
! Compute CCSD correlation energy
EcCCSD = 0d0
! Singles contribution
do i=1,nO
do a=1,nV
do i=1,spin_occ_num
do a=1,spin_vir_num
EcCCSD = EcCCSD + Fov(i,a)*t1(i,a)
EcCCSD = EcCCSD + spin_fock_matrix_mo_ov(i,a)*t1_cc(i,a)
end do
end do
! Doubles contribution
do i=1,nO
do j=1,nO
do a=1,nV
do b=1,nV
do i=1,spin_occ_num
do j=1,spin_occ_num
do a=1,spin_vir_num
do b=1,spin_vir_num
EcCCSD = EcCCSD &
+ 0.5d0*OOVV(i,j,a,b)*t1(i,a)*t1(j,b) &
+ 0.25d0*OOVV(i,j,a,b)*t2(i,j,a,b)
+ 0.5d0*OOVV(i,j,a,b)*t1_cc(i,a)*t1_cc(j,b) &
+ 0.25d0*OOVV(i,j,a,b)*t2_cc(i,j,a,b)
end do
end do
end do
end do
end subroutine CCSD_Ec_nc
END_PROVIDER

View File

@ -1,4 +1,4 @@
subroutine MP2(nBas,nC,nO,nV,nR,ERI,ENuc,EHF,e,EcMP2)
subroutine MP2(nBas,nC,nR,ERI,ENuc,EHF,e,EcMP2)
! Perform third-order Moller-Plesset calculation
@ -6,7 +6,7 @@ subroutine MP2(nBas,nC,nO,nV,nR,ERI,ENuc,EHF,e,EcMP2)
! Input variables
integer,intent(in) :: nBas,nC,nO,nV,nR
integer,intent(in) :: nBas,nC,nR
double precision,intent(in) :: ENuc,EHF
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas),e(nBas)
@ -31,10 +31,10 @@ subroutine MP2(nBas,nC,nO,nV,nR,ERI,ENuc,EHF,e,EcMP2)
E2a = 0d0
E2b = 0d0
do i=nC+1,nO
do j=nC+1,nO
do a=nO+1,nBas-nR
do b=nO+1,nBas-nR
do i=nC+1,spin_occ_num
do j=nC+1,spin_occ_num
do a=spin_occ_num+1,nBas-nR
do b=spin_occ_num+1,nBas-nR
eps = e(i) + e(j) - e(a) - e(b)

View File

@ -1,10 +1,10 @@
BEGIN_PROVIDER [ double precision, t1_guess, (spin_occ_num,spin_vir_num) ]
BEGIN_PROVIDER [ double precision, t1_cc, (spin_occ_num,spin_vir_num) ]
implicit none
BEGIN_DOC
! Guess amplitudes for single excitations
! Amplitudes for single excitations
END_DOC
t1_guess(:,:) = 0d0
t1_cc(:,:) = 0d0
if (cc_guess == 1) then
integer :: iunit
integer, external :: getunitandopen
@ -19,34 +19,32 @@ BEGIN_PROVIDER [ double precision, t1_guess, (spin_occ_num,spin_vir_num) ]
read(iunit,*,err=10) i, a, amplitude
i = 2*i-1
a = 2*a-1 - spin_occ_num
t1_guess(i,a) = amplitude
t1_cc(i,a) = amplitude
enddo
10 continue
do
read(iunit,*,end=20) i, a, amplitude
i = 2*i
a = 2*a - spin_occ_num
t1_guess(i,a) = amplitude
t1_cc(i,a) = amplitude
enddo
20 continue
close(iunit)
else if (cc_guess == 2) then
call random_number(t1_guess)
t1_guess *= 1.d-3
endif
END_PROVIDER
BEGIN_PROVIDER [ double precision, t2_guess, (spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num) ]
BEGIN_PROVIDER [ double precision, t2_cc, (spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num) ]
implicit none
BEGIN_DOC
! Guess amplitudes for double excitations
! Amplitudes for double excitations
END_DOC
t2_guess(:,:,:,:) = OOVV(:,:,:,:)/delta_OOVV(:,:,:,:)
if (cc_guess == 0) then
t2_cc(:,:,:,:) = OOVV(:,:,:,:)/delta_OOVV(:,:,:,:)
if (cc_guess == 1) then
t2_guess(:,:,:,:) = 0.d0
else if (cc_guess == 1) then
t2_cc(:,:,:,:) = 0.d0
integer :: iunit
integer, external :: getunitandopen
character :: check
@ -61,9 +59,7 @@ BEGIN_PROVIDER [ double precision, t2_guess, (spin_occ_num,spin_occ_num,spin_vir
j = 2*j-1
a = 2*a-1 - spin_occ_num
b = 2*b-1 - spin_occ_num
!100 format (4(I3,X), 2(F20.10,X))
!print 100, i,j,a,b,t2_guess(i,j,a,b) , amplitude
t2_guess(i,j,a,b) = amplitude
t2_cc(i,j,a,b) = amplitude
enddo
10 continue
do
@ -72,8 +68,7 @@ BEGIN_PROVIDER [ double precision, t2_guess, (spin_occ_num,spin_occ_num,spin_vir
j = 2*j
a = 2*a - spin_occ_num
b = 2*b - spin_occ_num
!print 100, i,j,a,b,t2_guess(i,j,a,b) , amplitude
t2_guess(i,j,a,b) = amplitude
t2_cc(i,j,a,b) = amplitude
enddo
20 continue
do
@ -82,25 +77,18 @@ BEGIN_PROVIDER [ double precision, t2_guess, (spin_occ_num,spin_occ_num,spin_vir
j = 2*j
a = 2*a-1 - spin_occ_num
b = 2*b - spin_occ_num
!print 100, i,j,a,b,t2_guess(i,j,a,b) , amplitude
t2_guess(i,j,a,b) = amplitude
!print 100, i,j,a,b,t2_guess(i,j,b,a) , -amplitude
t2_guess(i,j,b,a) = -amplitude
t2_cc(i,j,a,b) = amplitude
t2_cc(i,j,b,a) = -amplitude
i = i+1
j = j-1
a = a+1
b = b-1
!print 100, i,j,a,b,t2_guess(i,j,a,b) , amplitude
t2_guess(i,j,a,b) = amplitude
!print 100, i,j,a,b,t2_guess(i,j,b,a) , -amplitude
t2_guess(i,j,b,a) = -amplitude
t2_cc(i,j,a,b) = amplitude
t2_cc(i,j,b,a) = -amplitude
enddo
30 continue
close(iunit)
else if (cc_guess == 2) then
call random_number(t2_guess)
t2_guess *= 1.d-3
endif
END_PROVIDER

101
devel/cc/curly_Fock.irp.f Normal file
View File

@ -0,0 +1,101 @@
BEGIN_PROVIDER [ double precision, c_spin_fock_matrix_mo_oo, (spin_occ_num,spin_occ_num) ]
implicit none
BEGIN_DOC
! Curly F in Occupied-Occupied block
END_DOC
double precision,external :: Kronecker_Delta
integer :: i,j,m,n
integer :: a,b,e,f
do m=1,spin_occ_num
do i=1,spin_occ_num
c_spin_fock_matrix_mo_oo(m,i) = (1d0 - Kronecker_delta(m,i))*spin_fock_matrix_mo_oo(m,i)
do e=1,spin_vir_num
c_spin_fock_matrix_mo_oo(m,i) = c_spin_fock_matrix_mo_oo(m,i) + 0.5d0*t1_cc(i,e)*spin_fock_matrix_mo_ov(m,e)
end do
do e=1,spin_vir_num
do n=1,spin_occ_num
c_spin_fock_matrix_mo_oo(m,i) = c_spin_fock_matrix_mo_oo(m,i) + t1_cc(n,e)*OOOV(m,n,i,e)
end do
end do
do e=1,spin_vir_num
do n=1,spin_occ_num
do f=1,spin_vir_num
c_spin_fock_matrix_mo_oo(m,i) = c_spin_fock_matrix_mo_oo(m,i) + 0.5d0*taus(i,n,e,f)*OOVV(m,n,e,f)
end do
end do
end do
end do
end do
END_PROVIDER
BEGIN_PROVIDER [ double precision, c_spin_fock_matrix_mo_ov, (spin_occ_num,spin_vir_num) ]
implicit none
BEGIN_DOC
! Curly F in Occupied-Virtual block
END_DOC
integer :: i,j,m,n
integer :: a,b,e,f
c_spin_fock_matrix_mo_ov(:,:) = spin_fock_matrix_mo_ov(:,:)
do m=1,spin_occ_num
do e=1,spin_vir_num
do n=1,spin_occ_num
do f=1,spin_vir_num
c_spin_fock_matrix_mo_ov(m,e) = c_spin_fock_matrix_mo_ov(m,e) + t1_cc(n,f)*OOVV(m,n,e,f)
end do
end do
end do
end do
END_PROVIDER
BEGIN_PROVIDER [ double precision, c_spin_fock_matrix_mo_vv, (spin_vir_num,spin_vir_num) ]
implicit none
BEGIN_DOC
! Curly F in Occupied-Virtual block
END_DOC
double precision,external :: Kronecker_Delta
integer :: i,j,m,n
integer :: a,b,e,f
do a=1,spin_vir_num
do e=1,spin_vir_num
c_spin_fock_matrix_mo_vv(a,e) = (1d0 - Kronecker_delta(a,e))*spin_fock_matrix_mo_vv(a,e)
do m=1,spin_occ_num
c_spin_fock_matrix_mo_vv(a,e) = c_spin_fock_matrix_mo_vv(a,e) - 0.5d0*t1_cc(m,a)*spin_fock_matrix_mo_ov(m,e)
end do
do m=1,spin_occ_num
do f=1,spin_vir_num
c_spin_fock_matrix_mo_vv(a,e) = c_spin_fock_matrix_mo_vv(a,e) + t1_cc(m,f)*OVVV(m,a,f,e)
end do
end do
do m=1,spin_occ_num
do n=1,spin_occ_num
do f=1,spin_vir_num
c_spin_fock_matrix_mo_vv(a,e) = c_spin_fock_matrix_mo_vv(a,e) - 0.5d0*taus(m,n,a,f)*OOVV(m,n,e,f)
end do
end do
end do
end do
end do
END_PROVIDER

138
devel/cc/curly_W.irp.f Normal file
View File

@ -0,0 +1,138 @@
BEGIN_PROVIDER [ double precision, cWoooo, (spin_occ_num,spin_occ_num,spin_occ_num,spin_occ_num) ]
implicit none
BEGIN_DOC
! Curly W in occ-occ-occ-occ block
END_DOC
integer :: i,j,m,n
integer :: a,b,e,f
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
double precision :: x
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
END_PROVIDER
BEGIN_PROVIDER [ double precision, cWovvo, (spin_occ_num,spin_vir_num,spin_vir_num,spin_occ_num) ]
implicit none
BEGIN_DOC
! Curly W in occ-vir-vir-occ block
END_DOC
integer :: i,j,m,n
integer :: a,b,e,f
double precision :: x
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
END_PROVIDER
BEGIN_PROVIDER [ double precision, cWvvvv, (spin_vir_num,spin_vir_num,spin_vir_num,spin_vir_num) ]
implicit none
BEGIN_DOC
! Curly W in vir-vir-vir-vir block
END_DOC
integer :: i,j,m,n
integer :: a,b,e,f
double precision :: x
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_PROVIDER

View File

@ -1,4 +1,4 @@
subroutine form_T(nO,nV,ub,ubb,EcCCT)
subroutine form_T(ub,ubb,EcCCT)
! Compute (T) correction
@ -6,10 +6,8 @@ subroutine form_T(nO,nV,ub,ubb,EcCCT)
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: ub(nO,nO,nO,nV,nV,nV)
double precision,intent(in) :: ubb(nO,nO,nO,nV,nV,nV)
double precision,intent(in) :: ub(spin_occ_num,spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num,spin_vir_num)
double precision,intent(in) :: ubb(spin_occ_num,spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num,spin_vir_num)
! Local variables
@ -22,12 +20,12 @@ subroutine form_T(nO,nV,ub,ubb,EcCCT)
EcCCT = 0d0
do c=1,nV
do b=1,nV
do a=1,nV
do k=1,nO
do j=1,nO
do i=1,nO
do c=1,spin_vir_num
do b=1,spin_vir_num
do a=1,spin_vir_num
do k=1,spin_occ_num
do j=1,spin_occ_num
do i=1,spin_occ_num
EcCCT = EcCCT &
+ (ub(i,j,k,a,b,c) + ubb(i,j,k,a,b,c)) &

View File

@ -1,4 +1,4 @@
subroutine form_abh(nO,nV,t1,tau,aoooo,bvvvv,hovvo)
subroutine form_abh(t1,tau,aoooo,bvvvv,hovvo)
! Scuseria Eqs. (11),(12) and (13)
@ -6,10 +6,8 @@ subroutine form_abh(nO,nV,t1,tau,aoooo,bvvvv,hovvo)
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: tau(nO,nO,nV,nV)
double precision,intent(in) :: t1(spin_occ_num,spin_vir_num)
double precision,intent(in) :: tau(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num)
! Local variables
@ -18,27 +16,27 @@ subroutine form_abh(nO,nV,t1,tau,aoooo,bvvvv,hovvo)
! Output variables
double precision,intent(out) :: aoooo(nO,nO,nO,nO)
double precision,intent(out) :: bvvvv(nV,nV,nV,nV)
double precision,intent(out) :: hovvo(nO,nV,nV,nO)
double precision,intent(out) :: aoooo(spin_occ_num,spin_occ_num,spin_occ_num,spin_occ_num)
double precision,intent(out) :: bvvvv(spin_vir_num,spin_vir_num,spin_vir_num,spin_vir_num)
double precision,intent(out) :: hovvo(spin_occ_num,spin_vir_num,spin_vir_num,spin_occ_num)
aoooo(:,:,:,:) = OOOO(:,:,:,:)
do l=1,nO
do k=1,nO
do j=1,nO
do i=1,nO
do l=1,spin_occ_num
do k=1,spin_occ_num
do j=1,spin_occ_num
do i=1,spin_occ_num
do c=1,nV
do c=1,spin_vir_num
aoooo(i,j,k,l) = aoooo(i,j,k,l) + OVOO(i,c,k,l)*t1(j,c)
end do
do c=1,nV
do c=1,spin_vir_num
aoooo(i,j,k,l) = aoooo(i,j,k,l) - OVOO(j,c,k,l)*t1(i,c)
end do
do d=1,nV
do c=1,nV
do d=1,spin_vir_num
do c=1,spin_vir_num
aoooo(i,j,k,l) = aoooo(i,j,k,l) + OOVV(k,l,c,d)*tau(i,j,c,d)
end do
end do
@ -50,16 +48,16 @@ subroutine form_abh(nO,nV,t1,tau,aoooo,bvvvv,hovvo)
bvvvv(:,:,:,:) = VVVV(:,:,:,:)
do b=1,nV
do a=1,nV
do d=1,nV
do c=1,nV
do b=1,spin_vir_num
do a=1,spin_vir_num
do d=1,spin_vir_num
do c=1,spin_vir_num
do k=1,nO
do k=1,spin_occ_num
bvvvv(c,d,a,b) = bvvvv(c,d,a,b) - VOVV(a,k,c,d)*t1(k,b)
end do
do k=1,nO
do k=1,spin_occ_num
bvvvv(c,d,a,b) = bvvvv(c,d,a,b) + VOVV(b,k,c,d)*t1(k,a)
end do
@ -70,21 +68,21 @@ subroutine form_abh(nO,nV,t1,tau,aoooo,bvvvv,hovvo)
hovvo(:,:,:,:) = OVVO(:,:,:,:)
do k=1,nO
do a=1,nV
do c=1,nV
do i=1,nO
do k=1,spin_occ_num
do a=1,spin_vir_num
do c=1,spin_vir_num
do i=1,spin_occ_num
do l=1,nO
do l=1,spin_occ_num
hovvo(i,c,a,k) = hovvo(i,c,a,k) - OVOO(i,c,l,k)*t1(l,a)
end do
do d=1,nV
do d=1,spin_vir_num
hovvo(i,c,a,k) = hovvo(i,c,a,k) + OVVV(k,a,c,d)*t1(i,d)
end do
do d=1,nV
do l=1,nO
do d=1,spin_vir_num
do l=1,spin_occ_num
hovvo(i,c,a,k) = hovvo(i,c,a,k) - OOVV(k,l,c,d)*tau(i,l,d,a)
end do
end do

View File

@ -1,102 +0,0 @@
subroutine form_cF_nc(nO,nV,t1,taus,Foo,Fov,Fvv,cFoo,cFov,cFvv)
! Compute F terms in CCSD
implicit none
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: taus(nO,nO,nV,nV)
double precision,intent(in) :: Foo(nO,nO)
double precision,intent(in) :: Fov(nO,nV)
double precision,intent(in) :: Fvv(nV,nV)
! Local variables
integer :: i,j,m,n
integer :: a,b,e,f
double precision,external :: Kronecker_Delta
! Output variables
double precision,intent(out) :: cFoo(nO,nO)
double precision,intent(out) :: cFov(nO,nV)
double precision,intent(out) :: cFvv(nV,nV)
! Occupied-occupied block
do m=1,nO
do i=1,nO
cFoo(m,i) = (1d0 - Kronecker_delta(m,i))*Foo(m,i)
do e=1,nV
cFoo(m,i) = cFoo(m,i) + 0.5d0*t1(i,e)*Fov(m,e)
end do
do e=1,nV
do n=1,nO
cFoo(m,i) = cFoo(m,i) + t1(n,e)*OOOV(m,n,i,e)
end do
end do
do e=1,nV
do n=1,nO
do f=1,nV
cFoo(m,i) = cFoo(m,i) + 0.5d0*taus(i,n,e,f)*OOVV(m,n,e,f)
end do
end do
end do
end do
end do
! Occupied-virtual block
cFov(:,:) = Fov(:,:)
do m=1,nO
do e=1,nV
do n=1,nO
do f=1,nV
cFov(m,e) = cFov(m,e) + t1(n,f)*OOVV(m,n,e,f)
end do
end do
end do
end do
! Virtual-virtual block
do a=1,nV
do e=1,nV
cFvv(a,e) = (1d0 - Kronecker_delta(a,e))*Fvv(a,e)
do m=1,nO
cFvv(a,e) = cFvv(a,e) - 0.5d0*t1(m,a)*Fov(m,e)
end do
do m=1,nO
do f=1,nV
cFvv(a,e) = cFvv(a,e) + t1(m,f)*OVVV(m,a,f,e)
end do
end do
do m=1,nO
do n=1,nO
do f=1,nV
cFvv(a,e) = cFvv(a,e) - 0.5d0*taus(m,n,a,f)*OOVV(m,n,e,f)
end do
end do
end do
end do
end do
end subroutine form_cF_nc

View File

@ -1,136 +0,0 @@
subroutine form_cW_nc(nO,nV,t1,t2,tau,cWoooo,cWovvo,cWvvvv)
! Compute W terms in CCSD
implicit none
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: t2(nO,nO,nV,nV)
double precision,intent(in) :: tau(nO,nO,nV,nV)
! 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(nO,nO,nO,nO)
double precision,intent(out) :: cWovvo(nO,nV,nV,nO)
double precision,intent(out) :: cWvvvv(nV,nV,nV,nV)
! OOOO block
cWoooo(:,:,:,:) = OOOO(:,:,:,:)
do e=1,nV
do j=1,nO
do i=1,nO
do n=1,nO
do m=1,nO
cWoooo(m,n,i,j) = cWoooo(m,n,i,j) + t1(j,e)*OOOV(m,n,i,e) - t1(i,e)*OOOV(m,n,j,e)
end do
end do
end do
end do
end do
do f=1,nV
do e=1,nV
do j=1,nO
do i=1,nO
x = 0.25d0*tau(i,j,e,f)
do n=1,nO
do m=1,nO
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,nV
do j=1,nO
do e=1,nV
do b=1,nV
do m=1,nO
cWovvo(m,b,e,j) = cWovvo(m,b,e,j) + t1(j,f)*OVVV(m,b,e,f)
end do
end do
end do
end do
end do
do j=1,nO
do e=1,nV
do b=1,nV
do n=1,nO
do m=1,nO
cWovvo(m,b,e,j) = cWovvo(m,b,e,j) - t1(n,b)*OOVO(m,n,e,j)
end do
end do
end do
end do
end do
do j=1,nO
do f=1,nV
do b=1,nV
do n=1,nO
x = 0.5d0*t2(j,n,f,b) + t1(j,f)*t1(n,b)
do e=1,nV
do m=1,nO
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,nV
do e=1,nV
do b=1,nV
do a=1,nV
do m=1,nO
cWvvvv(a,b,e,f) = cWvvvv(a,b,e,f) - t1(m,b)*VOVV(a,m,e,f) + t1(m,a)*VOVV(b,m,e,f)
end do
end do
end do
end do
end do
do f=1,nV
do e=1,nV
do b=1,nV
do a=1,nV
x = 0.d0
do n=1,nO
do m=1,nO
x = x + tau(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

View File

@ -1,4 +1,4 @@
subroutine form_g(nO,nV,hvv,hoo,t1,gvv,goo)
subroutine form_g(hvv,hoo,t1,gvv,goo)
! Scuseria Eqs. (9), (10)
@ -6,12 +6,10 @@ subroutine form_g(nO,nV,hvv,hoo,t1,gvv,goo)
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: hvv(spin_vir_num,spin_vir_num)
double precision,intent(in) :: hoo(spin_occ_num,spin_occ_num)
double precision,intent(in) :: hvv(nV,nV)
double precision,intent(in) :: hoo(nO,nO)
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: t1(spin_occ_num,spin_vir_num)
! Local variables
@ -20,15 +18,15 @@ subroutine form_g(nO,nV,hvv,hoo,t1,gvv,goo)
! Output variables
double precision,intent(out) :: gvv(nV,nV)
double precision,intent(out) :: goo(nO,nO)
double precision,intent(out) :: gvv(spin_vir_num,spin_vir_num)
double precision,intent(out) :: goo(spin_occ_num,spin_occ_num)
gvv(:,:) = hvv(:,:)
do a=1,nV
do c=1,nV
do d=1,nV
do k=1,nO
do a=1,spin_vir_num
do c=1,spin_vir_num
do d=1,spin_vir_num
do k=1,spin_occ_num
gvv(c,a) = gvv(c,a) + VOVV(a,k,c,d)*t1(k,d)
end do
end do
@ -37,10 +35,10 @@ subroutine form_g(nO,nV,hvv,hoo,t1,gvv,goo)
goo(:,:) = hoo(:,:)
do k=1,nO
do i=1,nO
do c=1,nV
do l=1,nO
do k=1,spin_occ_num
do i=1,spin_occ_num
do c=1,spin_vir_num
do l=1,spin_occ_num
goo(i,k) = goo(i,k) + OOOV(k,l,i,c)*t1(l,c)
end do
end do

View File

@ -1,4 +1,4 @@
subroutine form_h(nO,nV,t1,tau,hvv,hoo,hvo)
subroutine form_h(t1,tau,hvv,hoo,hvo)
! Scuseria Eqs. (5), (6) and (7)
@ -6,10 +6,8 @@ subroutine form_h(nO,nV,t1,tau,hvv,hoo,hvo)
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: tau(nO,nO,nV,nV)
double precision,intent(in) :: t1(spin_occ_num,spin_vir_num)
double precision,intent(in) :: tau(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num)
! Local variables
@ -18,18 +16,18 @@ subroutine form_h(nO,nV,t1,tau,hvv,hoo,hvo)
! Output variables
double precision,intent(out) :: hvv(nV,nV)
double precision,intent(out) :: hoo(nO,nO)
double precision,intent(out) :: hvo(nV,nO)
double precision,intent(out) :: hvv(spin_vir_num,spin_vir_num)
double precision,intent(out) :: hoo(spin_occ_num,spin_occ_num)
double precision,intent(out) :: hvo(spin_vir_num,spin_occ_num)
hvv(:,:) = 0d0
do b=1,nV
do b=1,spin_vir_num
hvv(b,b) = eV(b)
do a=1,nV
do j=1,nO
do k=1,nO
do c=1,nV
do a=1,spin_vir_num
do j=1,spin_occ_num
do k=1,spin_occ_num
do c=1,spin_vir_num
hvv(b,a) = hvv(b,a) - OOVV(j,k,b,c)*tau(j,k,a,c)
@ -41,12 +39,12 @@ subroutine form_h(nO,nV,t1,tau,hvv,hoo,hvo)
hoo(:,:) = 0d0
do i=1,nO
do i=1,spin_occ_num
hoo(i,i) = eO(i)
do j=1,nO
do k=1,nO
do b=1,nV
do c=1,nV
do j=1,spin_occ_num
do k=1,spin_occ_num
do b=1,spin_vir_num
do c=1,spin_vir_num
hoo(i,j) = hoo(i,j) + OOVV(j,k,b,c)*tau(i,k,b,c)
@ -58,10 +56,10 @@ subroutine form_h(nO,nV,t1,tau,hvv,hoo,hvo)
hvo(:,:) = 0d0
do j=1,nO
do b=1,nV
do c=1,nV
do k=1,nO
do j=1,spin_occ_num
do b=1,spin_vir_num
do c=1,spin_vir_num
do k=1,spin_occ_num
hvo(b,j) = hvo(b,j) + OOVV(j,k,b,c)*t1(k,c)

View File

@ -1,72 +0,0 @@
subroutine form_r1(nO,nV,hvv,hoo,hvo,t1,t2,tau,r1)
! Form tau in CCSD
implicit none
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: hvv(nV,nV)
double precision,intent(in) :: hoo(nO,nO)
double precision,intent(in) :: hvo(nV,nO)
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: t2(nO,nO,nV,nV)
double precision,intent(in) :: tau(nO,nO,nV,nV)
! Local variables
integer :: i,j,k,l
integer :: a,b,c,d
! Output variables
double precision,intent(out) :: r1(nO,nV)
r1(:,:) = 0d0
do a=1,nV
do i=1,nO
do b=1,nV
r1(i,a) = r1(i,a) + hvv(b,a)*t1(i,b)
end do
do j=1,nO
r1(i,a) = r1(i,a) - hoo(i,j)*t1(j,a)
end do
do j=1,nO
do b=1,nV
r1(i,a) = r1(i,a) + hvo(b,j)*(t2(i,j,a,b) + t1(i,b)*t1(j,a))
end do
end do
do b=1,nV
do j=1,nO
r1(i,a) = r1(i,a) + OVVO(i,b,a,j)*t1(j,b)
end do
end do
do c=1,nV
do b=1,nV
do j=1,nO
r1(i,a) = r1(i,a) - OVVV(j,a,b,c)*tau(i,j,b,c)
end do
end do
end do
do b=1,nV
do k=1,nO
do j=1,nO
r1(i,a) = r1(i,a) - OOOV(j,k,i,b)*tau(j,k,a,b)
end do
end do
end do
end do
end do
end subroutine form_r1

View File

@ -1,77 +0,0 @@
subroutine form_r1_nc(nO,nV,t1,t2,Fov,cFoo,cFov,cFvv,r1)
! Form residues for t1 in non-canonical CCSD
implicit none
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: t2(nO,nO,nV,nV)
double precision,intent(in) :: Fov(nO,nV)
double precision,intent(in) :: cFoo(nO,nO)
double precision,intent(in) :: cFov(nO,nV)
double precision,intent(in) :: cFvv(nV,nV)
! Local variables
integer :: i,j,m,n
integer :: a,b,e,f
! Output variables
double precision,intent(out) :: r1(nO,nV)
r1(:,:) = Fov(:,:)
do i=1,nO
do a=1,nV
do e=1,nV
r1(i,a) = r1(i,a) + t1(i,e)*cFvv(a,e)
end do
do m=1,nO
r1(i,a) = r1(i,a) - t1(m,a)*cFoo(m,i)
end do
do m=1,nO
do e=1,nV
r1(i,a) = r1(i,a) + t2(i,m,a,e)*cFov(m,e)
end do
end do
do n=1,nO
do f=1,nV
r1(i,a) = r1(i,a) - t1(n,f)*OVOV(n,a,i,f)
end do
end do
do m=1,nO
do e=1,nV
do f=1,nV
r1(i,a) = r1(i,a) - 0.5d0*t2(i,m,e,f)*OVVV(m,a,e,f)
end do
end do
end do
do m=1,nO
do n=1,nO
do e=1,nV
r1(i,a) = r1(i,a) - 0.5d0*t2(m,n,a,e)*OOVO(n,m,e,i)
end do
end do
end do
end do
end do
! Final expression for t1 residue
r1(:,:) = delta_ov(:,:)*t1(:,:) - r1(:,:)
end subroutine form_r1_nc

View File

@ -1,4 +1,4 @@
subroutine form_r2(nO,nV,gvv,goo,aoooo,bvvvv,hovvo,t1,t2,tau,r2)
subroutine form_r2(gvv,goo,aoooo,bvvvv,hovvo,t1,t2,tau,r2)
! Form tau in CCSD
@ -6,17 +6,15 @@ subroutine form_r2(nO,nV,gvv,goo,aoooo,bvvvv,hovvo,t1,t2,tau,r2)
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: gvv(spin_vir_num,spin_vir_num)
double precision,intent(in) :: goo(spin_occ_num,spin_occ_num)
double precision,intent(in) :: aoooo(spin_occ_num,spin_occ_num,spin_occ_num,spin_occ_num)
double precision,intent(in) :: bvvvv(spin_vir_num,spin_vir_num,spin_vir_num,spin_vir_num)
double precision,intent(in) :: hovvo(spin_occ_num,spin_vir_num,spin_vir_num,spin_occ_num)
double precision,intent(in) :: gvv(nV,nV)
double precision,intent(in) :: goo(nO,nO)
double precision,intent(in) :: aoooo(nO,nO,nO,nO)
double precision,intent(in) :: bvvvv(nV,nV,nV,nV)
double precision,intent(in) :: hovvo(nO,nV,nV,nO)
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: t2(nO,nO,nV,nV)
double precision,intent(in) :: tau(nO,nO,nV,nV)
double precision,intent(in) :: t1(spin_occ_num,spin_vir_num)
double precision,intent(in) :: t2(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num)
double precision,intent(in) :: tau(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num)
! Local variables
@ -25,106 +23,106 @@ subroutine form_r2(nO,nV,gvv,goo,aoooo,bvvvv,hovvo,t1,t2,tau,r2)
! Output variables
double precision,intent(out) :: r2(nO,nO,nV,nV)
double precision,intent(out) :: r2(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num)
r2(:,:,:,:) = OOVV(:,:,:,:)
!$OMP PARALLEL DO DEFAULT(NONE) &
!$OMP SHARED(nO,nV,r2,aoooo,bvvvv,gvv,goo,tau,OVOO,OVVV,t1,t2,hovvo,OVVO) &
!$OMP SHARED(spin_occ_num,spin_vir_num,r2,aoooo,bvvvv,gvv,goo,tau,OVOO,OVVV,t1,t2,hovvo,OVVO) &
!$OMP PRIVATE(i,j,a,b,k,l,c,d)
do b=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
do k=1,nO
do l=1,nO
do k=1,spin_occ_num
do l=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + aoooo(i,j,k,l)*tau(k,l,a,b)
end do
end do
do d=1,nV
do c=1,nV
do d=1,spin_vir_num
do c=1,spin_vir_num
r2(i,j,a,b) = r2(i,j,a,b) + bvvvv(c,d,a,b)*tau(i,j,c,d)
end do
end do
do c=1,nV
do c=1,spin_vir_num
r2(i,j,a,b) = r2(i,j,a,b) + gvv(c,a)*t2(i,j,c,b)
end do
do k=1,nO
do k=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + OVOO(k,a,i,j)*t1(k,b)
end do
do c=1,nV
do c=1,spin_vir_num
r2(i,j,a,b) = r2(i,j,a,b) - gvv(c,b)*t2(i,j,c,a)
end do
do k=1,nO
do k=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - OVOO(k,b,i,j)*t1(k,a)
end do
do k=1,nO
do k=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - goo(i,k)*t2(k,j,a,b)
end do
do c=1,nV
do c=1,spin_vir_num
r2(i,j,a,b) = r2(i,j,a,b) + OVVV(j,c,b,a)*t1(i,c)
end do
do k=1,nO
do k=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + goo(j,k)*t2(k,i,a,b)
end do
do c=1,nV
do c=1,spin_vir_num
r2(i,j,a,b) = r2(i,j,a,b) - OVVV(i,c,b,a)*t1(j,c)
end do
do k=1,nO
do c=1,nV
do k=1,spin_occ_num
do c=1,spin_vir_num
r2(i,j,a,b) = r2(i,j,a,b) + hovvo(i,c,a,k)*t2(j,k,b,c)
end do
end do
do k=1,nO
do c=1,nV
do k=1,spin_occ_num
do c=1,spin_vir_num
r2(i,j,a,b) = r2(i,j,a,b) - OVVO(i,c,a,k)*t1(j,c)*t1(k,b)
end do
end do
do k=1,nO
do c=1,nV
do k=1,spin_occ_num
do c=1,spin_vir_num
r2(i,j,a,b) = r2(i,j,a,b) - hovvo(j,c,a,k)*t2(i,k,b,c)
end do
end do
do c=1,nV
do k=1,nO
do c=1,spin_vir_num
do k=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + OVVO(j,c,a,k)*t1(i,c)*t1(k,b)
end do
end do
do c=1,nV
do k=1,nO
do c=1,spin_vir_num
do k=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - hovvo(i,c,b,k)*t2(j,k,a,c)
end do
end do
do c=1,nV
do k=1,nO
do c=1,spin_vir_num
do k=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + OVVO(i,c,b,k)*t1(j,c)*t1(k,a)
end do
end do
do c=1,nV
do k=1,nO
do c=1,spin_vir_num
do k=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + hovvo(j,c,b,k)*t2(i,k,a,c)
end do
end do
do c=1,nV
do k=1,nO
do c=1,spin_vir_num
do k=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - OVVO(j,c,b,k)*t1(i,c)*t1(k,a)
end do
end do

View File

@ -1,355 +0,0 @@
subroutine form_r2_nc(nO,nV,t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
! Form t2 residues in non-canonical CCSD
implicit none
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: cFoo(nO,nO)
double precision,intent(in) :: cFov(nO,nV)
double precision,intent(in) :: cFvv(nV,nV)
double precision,intent(in) :: cWoooo(nO,nO,nO,nO)
double precision,intent(in) :: cWvvvv(nV,nV,nV,nV)
double precision,intent(in) :: cWovvo(nO,nV,nV,nO)
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: t2(nO,nO,nV,nV)
double precision,intent(in) :: tau(nO,nO,nV,nV)
double precision :: x
! Local variables
integer :: i,j,m,n
integer :: a,b,e,f
! Output variables
double precision,intent(out) :: r2(nO,nO,nV,nV)
r2(:,:,:,:) = OOVV(:,:,:,:)
do e=1,nV
do b=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
r2(i,j,a,b) = r2(i,j,a,b) + t2(i,j,a,e)*cFvv(b,e)
end do
end do
end do
end do
end do
do e=1,nV
do b=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
r2(i,j,a,b) = r2(i,j,a,b) - t2(i,j,b,e)*cFvv(a,e)
end do
end do
end do
end do
end do
do b=1,nV
do e=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
x = 0.5d0*t2(i,j,a,e)
if (x /= 0.d0) then
do m=1,nO
r2(i,j,a,b) = r2(i,j,a,b) - x*t1(m,b)*cFov(m,e)
end do
endif
end do
end do
end do
end do
end do
do e=1,nV
do b=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
x = 0.5d0*t2(i,j,b,e)
if (x /= 0.d0) then
do m=1,nO
r2(i,j,a,b) = r2(i,j,a,b) + x*t1(m,a)*cFov(m,e)
end do
endif
end do
end do
end do
end do
end do
do b=1,nV
do a=1,nV
do j=1,nO
do m=1,nO
x = cFoo(m,j)
do i=1,nO
r2(i,j,a,b) = r2(i,j,a,b) - t2(i,m,a,b)*x
end do
end do
end do
end do
end do
do b=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
do m=1,nO
r2(i,j,a,b) = r2(i,j,a,b) + t2(j,m,a,b)*cFoo(m,i)
end do
end do
end do
end do
end do
do b=1,nV
do a=1,nV
do e=1,nV
do m=1,nO
x = 0.5d0*cFov(m,e)
if (x == 0.d0) cycle
do j=1,nO
do i=1,nO
r2(i,j,a,b) = r2(i,j,a,b) - x*t2(i,m,a,b)*t1(j,e)
end do
end do
end do
end do
end do
end do
do b=1,nV
do a=1,nV
do e=1,nV
do m=1,nO
x = 0.5d0*cFov(m,e)
do j=1,nO
do i=1,nO
r2(i,j,a,b) = r2(i,j,a,b) + x*t2(j,m,a,b)*t1(i,e)
end do
end do
end do
end do
end do
end do
do b=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
do n=1,nO
do m=1,nO
r2(i,j,a,b) = r2(i,j,a,b) + 0.5d0*tau(m,n,a,b)*cWoooo(m,n,i,j)
end do
end do
end do
end do
end do
end do
do f=1,nV
do e=1,nV
do b=1,nV
do a=1,nV
x = 0.5d0*cWvvvv(a,b,e,f)
do j=1,nO
do i=1,nO
r2(i,j,a,b) = r2(i,j,a,b) + x*tau(i,j,e,f)
end do
end do
end do
end do
end do
end do
do b=1,nV
do a=1,nV
do j=1,nO
do e=1,nV
do m=1,nO
do i=1,nO
r2(i,j,a,b) = r2(i,j,a,b) + t2(i,m,a,e)*cWovvo(m,b,e,j)
end do
end do
end do
end do
end do
end do
do b=1,nV
do a=1,nV
do j=1,nO
do e=1,nV
do m=1,nO
x = t1(m,a)*OVVO(m,b,e,j)
do i=1,nO
r2(i,j,a,b) = r2(i,j,a,b) - t1(i,e)*x
end do
end do
end do
end do
end do
end do
do b=1,nV
do e=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
do m=1,nO
r2(i,j,a,b) = r2(i,j,a,b) - t2(j,m,a,e)*cWovvo(m,b,e,i)
end do
end do
end do
end do
end do
end do
do b=1,nV
do a=1,nV
do e=1,nV
do j=1,nO
do i=1,nO
do m=1,nO
r2(i,j,a,b) = r2(i,j,a,b) + t1(j,e)*t1(m,a)*OVVO(m,b,e,i)
end do
end do
end do
end do
end do
end do
do e=1,nV
do b=1,nV
do a=1,nV
do j=1,nO
do m=1,nO
do i=1,nO
r2(i,j,a,b) = r2(i,j,a,b) - t2(i,m,b,e)*cWovvo(m,a,e,j)
end do
end do
end do
end do
end do
end do
do b=1,nV
do a=1,nV
do j=1,nO
do e=1,nV
do i=1,nO
do m=1,nO
r2(i,j,a,b) = r2(i,j,a,b) + t1(i,e)*t1(m,b)*OVVO(m,a,e,j)
end do
end do
end do
end do
end do
end do
do e=1,nV
do b=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
do m=1,nO
r2(i,j,a,b) = r2(i,j,a,b) + t2(j,m,b,e)*cWovvo(m,a,e,i)
end do
end do
end do
end do
end do
end do
do b=1,nV
do e=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
do m=1,nO
r2(i,j,a,b) = r2(i,j,a,b) - t1(j,e)*t1(m,b)*OVVO(m,a,e,i)
end do
end do
end do
end do
end do
end do
do b=1,nV
do a=1,nV
do j=1,nO
do e=1,nV
do i=1,nO
r2(i,j,a,b) = r2(i,j,a,b) + t1(i,e)*VVVO(a,b,e,j)
end do
end do
end do
end do
end do
do b=1,nV
do a=1,nV
do e=1,nV
do i=1,nO
do j=1,nO
r2(i,j,a,b) = r2(i,j,a,b) - t1(j,e)*VVVO(a,b,e,i)
end do
end do
end do
end do
end do
do b=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
do m=1,nO
r2(i,j,a,b) = r2(i,j,a,b) - t1(m,a)*OVOO(m,b,i,j)
end do
end do
end do
end do
end do
do b=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
do m=1,nO
r2(i,j,a,b) = r2(i,j,a,b) + t1(m,b)*OVOO(m,a,i,j)
end do
end do
end do
end do
end do
! Final expression of the t2 residue
r2(:,:,:,:) = delta_oovv(:,:,:,:)*t2(:,:,:,:) - r2(:,:,:,:)
end subroutine form_r2_nc

View File

@ -1,34 +0,0 @@
subroutine form_tau(nO,nV,t1,t2,tau)
! Form tau in CCSD
implicit none
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: t2(nO,nO,nV,nV)
! Local variables
integer :: i,j,k,l
integer :: a,b,c,d
! Output variables
double precision,intent(out) :: tau(nO,nO,nV,nV)
do b=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
tau(i,j,a,b) = 0.5d0*t2(i,j,a,b) + t1(i,a)*t1(j,b)
enddo
enddo
enddo
enddo
end subroutine form_tau

View File

@ -1,34 +1,21 @@
subroutine form_tau_nc(nO,nV,t1,t2,tau)
! Form tau in CCSD
BEGIN_PROVIDER [ double precision, tau_cc, (spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num) ]
implicit none
BEGIN_DOC
! Tau in CCSD
END_DOC
! Input variables
integer :: i,j,a,b
integer,intent(in) :: nO,nV
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: t2(nO,nO,nV,nV)
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
! Local variables
integer :: i,j,k,l
integer :: a,b,c,d
! Output variables
double precision,intent(out) :: tau(nO,nO,nV,nV)
do b=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
tau(i,j,a,b) = t2(i,j,a,b) + t1(i,a)*t1(j,b) - t1(i,b)*t1(j,a)
tau_cc(i,j,a,b) = t2_cc(i,j,a,b) + t1_cc(i,a)*t1_cc(j,b) - t1_cc(i,b)*t1_cc(j,a)
enddo
enddo
enddo
enddo
end subroutine form_tau_nc
END_PROVIDER

View File

@ -1,34 +1,23 @@
subroutine form_taus_nc(nO,nV,t1,t2,taus)
! Form tau in CCSD
BEGIN_PROVIDER [ double precision, taus, (spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num)]
implicit none
BEGIN_DOC
! Tau_s
END_DOC
! Input variables
integer :: i,j,a,b
integer,intent(in) :: nO,nV
double precision,intent(in) :: t1(nO,nV)
double precision,intent(in) :: t2(nO,nO,nV,nV)
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
! Local variables
integer :: i,j,k,l
integer :: a,b,c,d
! Output variables
double precision,intent(out) :: taus(nO,nO,nV,nV)
do b=1,nV
do a=1,nV
do j=1,nO
do i=1,nO
taus(i,j,a,b) = t2(i,j,a,b) + 0.5d0*(t1(i,a)*t1(j,b) - t1(i,b)*t1(j,a))
taus(i,j,a,b) = t2_cc(i,j,a,b) + 0.5d0*( &
t1_cc(i,a)*t1_cc(j,b) - &
t1_cc(i,b)*t1_cc(j,a) )
enddo
enddo
enddo
enddo
end subroutine form_taus_nc
END_PROVIDER

View File

@ -1,15 +1,9 @@
subroutine form_ub(nO,nV,t1,ub)
subroutine form_ub(ub)
! Form 1st term in (T) correction
implicit none
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: t1(nO,nV)
! Local variables
integer :: i,j,k,l
@ -17,24 +11,24 @@ subroutine form_ub(nO,nV,t1,ub)
! Output variables
double precision,intent(out) :: ub(nO,nO,nO,nV,nV,nV)
double precision,intent(out) :: ub(spin_occ_num,spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num,spin_vir_num)
do c=1,nV
do b=1,nV
do a=1,nV
do k=1,nO
do j=1,nO
do i=1,nO
do c=1,spin_vir_num
do b=1,spin_vir_num
do a=1,spin_vir_num
do k=1,spin_occ_num
do j=1,spin_occ_num
do i=1,spin_occ_num
ub(i,j,k,a,b,c) = t1(i,a)*OOVV(j,k,b,c) &
+ t1(i,b)*OOVV(j,k,c,a) &
+ t1(i,c)*OOVV(j,k,a,b) &
+ t1(j,a)*OOVV(k,i,b,c) &
+ t1(j,b)*OOVV(k,i,c,a) &
+ t1(j,c)*OOVV(k,i,a,b) &
+ t1(k,a)*OOVV(i,j,b,c) &
+ t1(k,b)*OOVV(i,j,c,a) &
+ t1(k,c)*OOVV(i,j,a,b)
ub(i,j,k,a,b,c) = t1_cc(i,a)*OOVV(j,k,b,c) &
+ t1_cc(i,b)*OOVV(j,k,c,a) &
+ t1_cc(i,c)*OOVV(j,k,a,b) &
+ t1_cc(j,a)*OOVV(k,i,b,c) &
+ t1_cc(j,b)*OOVV(k,i,c,a) &
+ t1_cc(j,c)*OOVV(k,i,a,b) &
+ t1_cc(k,a)*OOVV(i,j,b,c) &
+ t1_cc(k,b)*OOVV(i,j,c,a) &
+ t1_cc(k,c)*OOVV(i,j,a,b)
end do
end do

View File

@ -1,15 +1,9 @@
subroutine form_ubb(nO,nV,t2,ubb)
subroutine form_ubb(ubb)
! Form 2nd term in (T) correction
implicit none
! Input variables
integer,intent(in) :: nO,nV
double precision,intent(in) :: t2(nO,nO,nV,nV)
! Local variables
integer :: i,j,k,l,m
@ -17,41 +11,41 @@ subroutine form_ubb(nO,nV,t2,ubb)
! Output variables
double precision,intent(out) :: ubb(nO,nO,nO,nV,nV,nV)
double precision,intent(out) :: ubb(spin_occ_num,spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num,spin_vir_num)
ubb(:,:,:,:,:,:) = 0d0
do c=1,nV
do b=1,nV
do a=1,nV
do k=1,nO
do j=1,nO
do i=1,nO
do c=1,spin_vir_num
do b=1,spin_vir_num
do a=1,spin_vir_num
do k=1,spin_occ_num
do j=1,spin_occ_num
do i=1,spin_occ_num
do e=1,nV
do e=1,spin_vir_num
ubb(i,j,k,a,b,c) = ubb(i,j,k,a,b,c) &
+ t2(i,j,a,e)*VVVO(b,c,e,k) &
+ t2(i,j,b,e)*VVVO(c,a,e,k) &
+ t2(i,j,c,e)*VVVO(a,b,e,k) &
+ t2(k,i,a,e)*VVVO(b,c,e,j) &
+ t2(k,i,b,e)*VVVO(c,a,e,j) &
+ t2(k,i,c,e)*VVVO(a,b,e,j) &
+ t2(j,k,a,e)*VVVO(b,c,e,i) &
+ t2(j,k,b,e)*VVVO(c,a,e,i) &
+ t2(j,k,c,e)*VVVO(a,b,e,i)
+ t2_cc(i,j,a,e)*VVVO(b,c,e,k) &
+ t2_cc(i,j,b,e)*VVVO(c,a,e,k) &
+ t2_cc(i,j,c,e)*VVVO(a,b,e,k) &
+ t2_cc(k,i,a,e)*VVVO(b,c,e,j) &
+ t2_cc(k,i,b,e)*VVVO(c,a,e,j) &
+ t2_cc(k,i,c,e)*VVVO(a,b,e,j) &
+ t2_cc(j,k,a,e)*VVVO(b,c,e,i) &
+ t2_cc(j,k,b,e)*VVVO(c,a,e,i) &
+ t2_cc(j,k,c,e)*VVVO(a,b,e,i)
end do
do m=1,nO
do m=1,spin_occ_num
ubb(i,j,k,a,b,c) = ubb(i,j,k,a,b,c) &
+ t2(i,m,a,b)*VOOO(c,m,j,k) &
+ t2(i,m,b,c)*VOOO(a,m,j,k) &
+ t2(i,m,c,a)*VOOO(b,m,j,k) &
+ t2(j,m,a,b)*VOOO(c,m,k,i) &
+ t2(j,m,b,c)*VOOO(a,m,k,i) &
+ t2(j,m,c,a)*VOOO(b,m,k,i) &
+ t2(k,m,a,b)*VOOO(c,m,i,j) &
+ t2(k,m,b,c)*VOOO(a,m,i,j) &
+ t2(k,m,c,a)*VOOO(b,m,i,j)
+ t2_cc(i,m,a,b)*VOOO(c,m,j,k) &
+ t2_cc(i,m,b,c)*VOOO(a,m,j,k) &
+ t2_cc(i,m,c,a)*VOOO(b,m,j,k) &
+ t2_cc(j,m,a,b)*VOOO(c,m,k,i) &
+ t2_cc(j,m,b,c)*VOOO(a,m,k,i) &
+ t2_cc(j,m,c,a)*VOOO(b,m,k,i) &
+ t2_cc(k,m,a,b)*VOOO(c,m,i,j) &
+ t2_cc(k,m,b,c)*VOOO(a,m,i,j) &
+ t2_cc(k,m,c,a)*VOOO(b,m,i,j)
end do
end do

58
devel/cc/r1_cc.irp.f Normal file
View File

@ -0,0 +1,58 @@
BEGIN_PROVIDER [ double precision, r1_cc, (spin_occ_num,spin_vir_num) ]
implicit none
BEGIN_DOC
! Residues for t1 in non-canonical CCSD
END_DOC
integer :: i,j,m,n
integer :: a,b,e,f
r1_cc(:,:) = spin_fock_matrix_mo_ov(:,:)
do i=1,spin_occ_num
do a=1,spin_vir_num
do e=1,spin_vir_num
r1_cc(i,a) = r1_cc(i,a) + t1_cc(i,e)*c_spin_fock_matrix_mo_vv(a,e)
end do
do m=1,spin_occ_num
r1_cc(i,a) = r1_cc(i,a) - t1_cc(m,a)*c_spin_fock_matrix_mo_oo(m,i)
end do
do m=1,spin_occ_num
do e=1,spin_vir_num
r1_cc(i,a) = r1_cc(i,a) + t2_cc(i,m,a,e)*c_spin_fock_matrix_mo_ov(m,e)
end do
end do
do n=1,spin_occ_num
do f=1,spin_vir_num
r1_cc(i,a) = r1_cc(i,a) - t1_cc(n,f)*OVOV(n,a,i,f)
end do
end do
do m=1,spin_occ_num
do e=1,spin_vir_num
do f=1,spin_vir_num
r1_cc(i,a) = r1_cc(i,a) - 0.5d0*t2_cc(i,m,e,f)*OVVV(m,a,e,f)
end do
end do
end do
do m=1,spin_occ_num
do n=1,spin_occ_num
do e=1,spin_vir_num
r1_cc(i,a) = r1_cc(i,a) - 0.5d0*t2_cc(m,n,a,e)*OOVO(n,m,e,i)
end do
end do
end do
end do
end do
! Final expression for t1 residue
r1_cc(:,:) = delta_ov(:,:)*t1_cc(:,:) - r1_cc(:,:)
END_PROVIDER

334
devel/cc/r2_cc.irp.f Normal file
View File

@ -0,0 +1,334 @@
BEGIN_PROVIDER [ double precision, r2_cc, (spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num) ]
implicit none
BEGIN_DOC
! t2 residues in non-canonical CCSD
END_DOC
integer :: i,j,m,n
integer :: a,b,e,f
double precision :: x
r2_cc(:,:,:,:) = OOVV(:,:,:,:)
do e=1,spin_vir_num
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) + t2_cc(i,j,a,e)*c_spin_fock_matrix_mo_vv(b,e)
end do
end do
end do
end do
end do
do e=1,spin_vir_num
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) - t2_cc(i,j,b,e)*c_spin_fock_matrix_mo_vv(a,e)
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do e=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
x = 0.5d0*t2_cc(i,j,a,e)
if (x /= 0.d0) then
do m=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) - x*t1_cc(m,b)*c_spin_fock_matrix_mo_ov(m,e)
end do
endif
end do
end do
end do
end do
end do
do e=1,spin_vir_num
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
x = 0.5d0*t2_cc(i,j,b,e)
if (x /= 0.d0) then
do m=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) + x*t1_cc(m,a)*c_spin_fock_matrix_mo_ov(m,e)
end do
endif
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do m=1,spin_occ_num
x = c_spin_fock_matrix_mo_oo(m,j)
do i=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) - t2_cc(i,m,a,b)*x
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) + t2_cc(j,m,a,b)*c_spin_fock_matrix_mo_oo(m,i)
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do a=1,spin_vir_num
do e=1,spin_vir_num
do m=1,spin_occ_num
x = 0.5d0*c_spin_fock_matrix_mo_ov(m,e)
if (x == 0.d0) cycle
do j=1,spin_occ_num
do i=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) - x*t2_cc(i,m,a,b)*t1_cc(j,e)
end do
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do a=1,spin_vir_num
do e=1,spin_vir_num
do m=1,spin_occ_num
x = 0.5d0*c_spin_fock_matrix_mo_ov(m,e)
do j=1,spin_occ_num
do i=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) + x*t2_cc(j,m,a,b)*t1_cc(i,e)
end do
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do a=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
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) + 0.5d0*tau_cc(m,n,a,b)*cWoooo(m,n,i,j)
end do
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.5d0*cWvvvv(a,b,e,f)
if (x /= 0.d0) then
do j=1,spin_occ_num
do i=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) + x*tau_cc(i,j,e,f)
end do
end do
endif
end do
end do
end do
end do
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do e=1,spin_vir_num
do m=1,spin_occ_num
do i=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) + t2_cc(i,m,a,e)*cWovvo(m,b,e,j)
end do
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do e=1,spin_vir_num
do m=1,spin_occ_num
x = t1_cc(m,a)*OVVO(m,b,e,j)
do i=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) - t1_cc(i,e)*x
end do
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do e=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) - t2_cc(j,m,a,e)*cWovvo(m,b,e,i)
end do
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do a=1,spin_vir_num
do e=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) + t1_cc(j,e)*t1_cc(m,a)*OVVO(m,b,e,i)
end do
end do
end do
end do
end do
end do
do e=1,spin_vir_num
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do m=1,spin_occ_num
do i=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) - t2_cc(i,m,b,e)*cWovvo(m,a,e,j)
end do
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do e=1,spin_vir_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) + t1_cc(i,e)*t1_cc(m,b)*OVVO(m,a,e,j)
end do
end do
end do
end do
end do
end do
do e=1,spin_vir_num
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) + t2_cc(j,m,b,e)*cWovvo(m,a,e,i)
end do
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do e=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) - t1_cc(j,e)*t1_cc(m,b)*OVVO(m,a,e,i)
end do
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do e=1,spin_vir_num
do i=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) + t1_cc(i,e)*VVVO(a,b,e,j)
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do a=1,spin_vir_num
do e=1,spin_vir_num
do i=1,spin_occ_num
do j=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) - t1_cc(j,e)*VVVO(a,b,e,i)
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) - t1_cc(m,a)*OVOO(m,b,i,j)
end do
end do
end do
end do
end do
do b=1,spin_vir_num
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2_cc(i,j,a,b) = r2_cc(i,j,a,b) + t1_cc(m,b)*OVOO(m,a,i,j)
end do
end do
end do
end do
end do
! Final expression of the t2 residue
r2_cc(:,:,:,:) = delta_oovv(:,:,:,:)*t2_cc(:,:,:,:) - r2_cc(:,:,:,:)
END_PROVIDER