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

Removed t1, t2

This commit is contained in:
Anthony Scemama 2019-09-14 14:20:55 +02:00
parent a6e87526b1
commit 56c3466c42
12 changed files with 116 additions and 166 deletions

View File

@ -36,8 +36,6 @@ subroutine CCSD
double precision,allocatable :: r1(:,:)
double precision,allocatable :: r2(:,:,:,:)
double precision,allocatable :: t1(:,:)
double precision,allocatable :: t2(:,:,:,:)
double precision,allocatable :: tau(:,:,:,:)
double precision,allocatable :: taus(:,:,:,:)
@ -67,10 +65,7 @@ subroutine CCSD
! Guess amplitudes
allocate(t1(spin_occ_num,spin_vir_num),t2(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num),tau(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num),taus(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num))
t1(:,:) = t1_guess(:,:)
t2(:,:,:,:) = t2_guess(:,:,:,:)
allocate(tau(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num),taus(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num))
! Initialization
@ -81,8 +76,8 @@ subroutine CCSD
Conv = 1d0
nSCF = 0
call form_taus_nc(t1,t2,taus)
call form_tau_nc (t1,t2,tau)
call form_taus_nc(taus)
call form_tau_nc (tau)
EcMP2 = 0.25d0*u_dot_v(OOVV,tau,size(OOVV))
write(*,'(1X,A10,1X,F10.6)') 'Ec(MP2) = ',EcMP2
@ -105,21 +100,21 @@ subroutine CCSD
nSCF = nSCF + 1
call form_cf_nc (t1,taus, &
call form_cf_nc (taus, &
spin_fock_matrix_mo_oo, &
spin_fock_matrix_mo_ov, &
spin_fock_matrix_mo_vv, &
cFoo,cFov,cFvv)
call form_cw_nc (t1,t2,tau, &
call form_cw_nc (tau, &
cWoooo,cWovvo,cWvvvv)
! Compute residuals
call form_r1_nc(t1,t2,spin_fock_matrix_mo_ov, &
call form_r1_nc(spin_fock_matrix_mo_ov, &
cFoo,cFov,cFvv,r1)
call form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv, &
call form_r2_nc(tau,cFoo,cFov,cFvv, &
cWoooo,cWvvvv,cWovvo,r2)
! Check convergence
@ -128,15 +123,16 @@ subroutine CCSD
! Update
t1(:,:) = t1(:,:) - r1(:,:) /delta_OV (:,:)
t2(:,:,:,:) = t2(:,:,:,:) - r2(:,:,:,:)/delta_OOVV(:,:,:,:)
t1_cc(:,:) = t1_cc(:,:) - r1(:,:) /delta_OV (:,:)
t2_cc(:,:,:,:) = t2_cc(:,:,:,:) - r2(:,:,:,:)/delta_OOVV(:,:,:,:)
TOUCH t1_cc t2_cc
call form_taus_nc(t1,t2,taus)
call form_tau_nc (t1,t2,tau)
call form_taus_nc(taus)
call form_tau_nc (tau)
! Compute correlation energy
call CCSD_Ec_nc(t1,t2,spin_fock_matrix_mo_ov,EcCCSD)
call CCSD_Ec_nc(spin_fock_matrix_mo_ov,EcCCSD)
! Dump results
@ -179,7 +175,7 @@ subroutine CCSD
if(doCCSDT) then
write(*,*) "Starting (T) calculation"
! call cpu_time(start_CCSDT)V
call CCSDT(t1,t2,EcCCT)
call CCSDT(EcCCT)
! call cpu_time(end_CCSDT)
call write_time(6)

View File

@ -1,14 +1,9 @@
subroutine CCSDT(t1,t2,EcCCT)
subroutine CCSDT(EcCCT)
! Compute the (T) correction of the CCSD(T) energy
implicit none
! Input variables
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)
! Local variables
double precision,allocatable :: ub(:,:,:,:,:,:)
@ -24,9 +19,9 @@ subroutine CCSDT(t1,t2,EcCCT)
! Form CCSD(T) quantities
call form_ub(t1,ub)
call form_ub(ub)
call form_ubb(t2,ubb)
call form_ubb(ubb)
call form_T(ub,ubb,EcCCT)

View File

@ -1,4 +1,4 @@
subroutine CCSD_Ec_nc(t1,t2,Fov,EcCCSD)
subroutine CCSD_Ec_nc(Fov,EcCCSD)
! Compute the CCSD correlatio energy in non-conanical form
@ -6,9 +6,6 @@ subroutine CCSD_Ec_nc(t1,t2,Fov,EcCCSD)
! Input variables
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) :: Fov(spin_occ_num,spin_vir_num)
! Local variables
@ -28,7 +25,7 @@ subroutine CCSD_Ec_nc(t1,t2,Fov,EcCCSD)
do i=1,spin_occ_num
do a=1,spin_vir_num
EcCCSD = EcCCSD + Fov(i,a)*t1(i,a)
EcCCSD = EcCCSD + Fov(i,a)*t1_cc(i,a)
end do
end do
@ -41,8 +38,8 @@ subroutine CCSD_Ec_nc(t1,t2,Fov,EcCCSD)
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

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

View File

@ -1,4 +1,4 @@
subroutine form_cF_nc(t1,taus,Foo,Fov,Fvv,cFoo,cFov,cFvv)
subroutine form_cF_nc(taus,Foo,Fov,Fvv,cFoo,cFov,cFvv)
! Compute F terms in CCSD
@ -6,7 +6,6 @@ subroutine form_cF_nc(t1,taus,Foo,Fov,Fvv,cFoo,cFov,cFvv)
! Input variables
double precision,intent(in) :: t1(spin_occ_num,spin_vir_num)
double precision,intent(in) :: taus(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num)
double precision,intent(in) :: Foo(spin_occ_num,spin_occ_num)
@ -33,12 +32,12 @@ subroutine form_cF_nc(t1,taus,Foo,Fov,Fvv,cFoo,cFov,cFvv)
cFoo(m,i) = (1d0 - Kronecker_delta(m,i))*Foo(m,i)
do e=1,spin_vir_num
cFoo(m,i) = cFoo(m,i) + 0.5d0*t1(i,e)*Fov(m,e)
cFoo(m,i) = cFoo(m,i) + 0.5d0*t1_cc(i,e)*Fov(m,e)
end do
do e=1,spin_vir_num
do n=1,spin_occ_num
cFoo(m,i) = cFoo(m,i) + t1(n,e)*OOOV(m,n,i,e)
cFoo(m,i) = cFoo(m,i) + t1_cc(n,e)*OOOV(m,n,i,e)
end do
end do
@ -62,7 +61,7 @@ subroutine form_cF_nc(t1,taus,Foo,Fov,Fvv,cFoo,cFov,cFvv)
do n=1,spin_occ_num
do f=1,spin_vir_num
cFov(m,e) = cFov(m,e) + t1(n,f)*OOVV(m,n,e,f)
cFov(m,e) = cFov(m,e) + t1_cc(n,f)*OOVV(m,n,e,f)
end do
end do
@ -77,12 +76,12 @@ subroutine form_cF_nc(t1,taus,Foo,Fov,Fvv,cFoo,cFov,cFvv)
cFvv(a,e) = (1d0 - Kronecker_delta(a,e))*Fvv(a,e)
do m=1,spin_occ_num
cFvv(a,e) = cFvv(a,e) - 0.5d0*t1(m,a)*Fov(m,e)
cFvv(a,e) = cFvv(a,e) - 0.5d0*t1_cc(m,a)*Fov(m,e)
end do
do m=1,spin_occ_num
do f=1,spin_vir_num
cFvv(a,e) = cFvv(a,e) + t1(m,f)*OVVV(m,a,f,e)
cFvv(a,e) = cFvv(a,e) + t1_cc(m,f)*OVVV(m,a,f,e)
end do
end do

View File

@ -1,4 +1,4 @@
subroutine form_cW_nc(t1,t2,tau,cWoooo,cWovvo,cWvvvv)
subroutine form_cW_nc(tau,cWoooo,cWovvo,cWvvvv)
! Compute W terms in CCSD
@ -6,8 +6,6 @@ subroutine form_cW_nc(t1,t2,tau,cWoooo,cWovvo,cWvvvv)
! Input variables
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
@ -33,7 +31,7 @@ subroutine form_cW_nc(t1,t2,tau,cWoooo,cWovvo,cWvvvv)
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(j,e)*OOOV(m,n,i,e) - t1(i,e)*OOOV(m,n,j,e)
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
@ -64,7 +62,7 @@ subroutine form_cW_nc(t1,t2,tau,cWoooo,cWovvo,cWvvvv)
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(j,f)*OVVV(m,b,e,f)
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
@ -76,7 +74,7 @@ subroutine form_cW_nc(t1,t2,tau,cWoooo,cWovvo,cWvvvv)
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(n,b)*OOVO(m,n,e,j)
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
@ -87,7 +85,7 @@ subroutine form_cW_nc(t1,t2,tau,cWoooo,cWovvo,cWvvvv)
do f=1,spin_vir_num
do b=1,spin_vir_num
do n=1,spin_occ_num
x = 0.5d0*t2(j,n,f,b) + t1(j,f)*t1(n,b)
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)
@ -107,7 +105,7 @@ subroutine form_cW_nc(t1,t2,tau,cWoooo,cWovvo,cWvvvv)
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(m,b)*VOVV(a,m,e,f) + t1(m,a)*VOVV(b,m,e,f)
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

View File

@ -1,4 +1,4 @@
subroutine form_r1_nc(t1,t2,Fov,cFoo,cFov,cFvv,r1)
subroutine form_r1_nc(Fov,cFoo,cFov,cFvv,r1)
! Form residues for t1 in non-canonical CCSD
@ -6,9 +6,6 @@ subroutine form_r1_nc(t1,t2,Fov,cFoo,cFov,cFvv,r1)
! Input variables
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) :: Fov(spin_occ_num,spin_vir_num)
double precision,intent(in) :: cFoo(spin_occ_num,spin_occ_num)
@ -30,29 +27,29 @@ subroutine form_r1_nc(t1,t2,Fov,cFoo,cFov,cFvv,r1)
do a=1,spin_vir_num
do e=1,spin_vir_num
r1(i,a) = r1(i,a) + t1(i,e)*cFvv(a,e)
r1(i,a) = r1(i,a) + t1_cc(i,e)*cFvv(a,e)
end do
do m=1,spin_occ_num
r1(i,a) = r1(i,a) - t1(m,a)*cFoo(m,i)
r1(i,a) = r1(i,a) - t1_cc(m,a)*cFoo(m,i)
end do
do m=1,spin_occ_num
do e=1,spin_vir_num
r1(i,a) = r1(i,a) + t2(i,m,a,e)*cFov(m,e)
r1(i,a) = r1(i,a) + t2_cc(i,m,a,e)*cFov(m,e)
end do
end do
do n=1,spin_occ_num
do f=1,spin_vir_num
r1(i,a) = r1(i,a) - t1(n,f)*OVOV(n,a,i,f)
r1(i,a) = r1(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(i,a) = r1(i,a) - 0.5d0*t2(i,m,e,f)*OVVV(m,a,e,f)
r1(i,a) = r1(i,a) - 0.5d0*t2_cc(i,m,e,f)*OVVV(m,a,e,f)
end do
end do
end do
@ -60,7 +57,7 @@ subroutine form_r1_nc(t1,t2,Fov,cFoo,cFov,cFvv,r1)
do m=1,spin_occ_num
do n=1,spin_occ_num
do e=1,spin_vir_num
r1(i,a) = r1(i,a) - 0.5d0*t2(m,n,a,e)*OOVO(n,m,e,i)
r1(i,a) = r1(i,a) - 0.5d0*t2_cc(m,n,a,e)*OOVO(n,m,e,i)
end do
end do
end do
@ -70,6 +67,6 @@ subroutine form_r1_nc(t1,t2,Fov,cFoo,cFov,cFvv,r1)
! Final expression for t1 residue
r1(:,:) = delta_ov(:,:)*t1(:,:) - r1(:,:)
r1(:,:) = delta_ov(:,:)*t1_cc(:,:) - r1(:,:)
end subroutine form_r1_nc

View File

@ -1,4 +1,4 @@
subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
subroutine form_r2_nc(tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
! Form t2 residues in non-canonical CCSD
@ -14,8 +14,6 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
double precision,intent(in) :: cWvvvv(spin_vir_num,spin_vir_num,spin_vir_num,spin_vir_num)
double precision,intent(in) :: cWovvo(spin_occ_num,spin_vir_num,spin_vir_num,spin_occ_num)
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)
double precision :: x
@ -35,7 +33,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + t2(i,j,a,e)*cFvv(b,e)
r2(i,j,a,b) = r2(i,j,a,b) + t2_cc(i,j,a,e)*cFvv(b,e)
end do
end do
end do
@ -48,7 +46,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - t2(i,j,b,e)*cFvv(a,e)
r2(i,j,a,b) = r2(i,j,a,b) - t2_cc(i,j,b,e)*cFvv(a,e)
end do
end do
end do
@ -61,10 +59,10 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
x = 0.5d0*t2(i,j,a,e)
x = 0.5d0*t2_cc(i,j,a,e)
if (x /= 0.d0) then
do m=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - x*t1(m,b)*cFov(m,e)
r2(i,j,a,b) = r2(i,j,a,b) - x*t1_cc(m,b)*cFov(m,e)
end do
endif
end do
@ -79,10 +77,10 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do a=1,spin_vir_num
do j=1,spin_occ_num
do i=1,spin_occ_num
x = 0.5d0*t2(i,j,b,e)
x = 0.5d0*t2_cc(i,j,b,e)
if (x /= 0.d0) then
do m=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + x*t1(m,a)*cFov(m,e)
r2(i,j,a,b) = r2(i,j,a,b) + x*t1_cc(m,a)*cFov(m,e)
end do
endif
end do
@ -98,7 +96,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do m=1,spin_occ_num
x = cFoo(m,j)
do i=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - t2(i,m,a,b)*x
r2(i,j,a,b) = r2(i,j,a,b) - t2_cc(i,m,a,b)*x
end do
end do
end do
@ -110,7 +108,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + t2(j,m,a,b)*cFoo(m,i)
r2(i,j,a,b) = r2(i,j,a,b) + t2_cc(j,m,a,b)*cFoo(m,i)
end do
end do
end do
@ -126,7 +124,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
if (x == 0.d0) cycle
do j=1,spin_occ_num
do i=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - x*t2(i,m,a,b)*t1(j,e)
r2(i,j,a,b) = r2(i,j,a,b) - x*t2_cc(i,m,a,b)*t1_cc(j,e)
end do
end do
end do
@ -142,7 +140,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
x = 0.5d0*cFov(m,e)
do j=1,spin_occ_num
do i=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + x*t2(j,m,a,b)*t1(i,e)
r2(i,j,a,b) = r2(i,j,a,b) + x*t2_cc(j,m,a,b)*t1_cc(i,e)
end do
end do
end do
@ -188,7 +186,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do e=1,spin_vir_num
do m=1,spin_occ_num
do i=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + t2(i,m,a,e)*cWovvo(m,b,e,j)
r2(i,j,a,b) = r2(i,j,a,b) + t2_cc(i,m,a,e)*cWovvo(m,b,e,j)
end do
end do
end do
@ -201,9 +199,9 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do j=1,spin_occ_num
do e=1,spin_vir_num
do m=1,spin_occ_num
x = t1(m,a)*OVVO(m,b,e,j)
x = t1_cc(m,a)*OVVO(m,b,e,j)
do i=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - t1(i,e)*x
r2(i,j,a,b) = r2(i,j,a,b) - t1_cc(i,e)*x
end do
end do
end do
@ -217,7 +215,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - t2(j,m,a,e)*cWovvo(m,b,e,i)
r2(i,j,a,b) = r2(i,j,a,b) - t2_cc(j,m,a,e)*cWovvo(m,b,e,i)
end do
end do
end do
@ -231,7 +229,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + t1(j,e)*t1(m,a)*OVVO(m,b,e,i)
r2(i,j,a,b) = r2(i,j,a,b) + t1_cc(j,e)*t1_cc(m,a)*OVVO(m,b,e,i)
end do
end do
end do
@ -245,7 +243,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do j=1,spin_occ_num
do m=1,spin_occ_num
do i=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - t2(i,m,b,e)*cWovvo(m,a,e,j)
r2(i,j,a,b) = r2(i,j,a,b) - t2_cc(i,m,b,e)*cWovvo(m,a,e,j)
end do
end do
end do
@ -259,7 +257,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do e=1,spin_vir_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + t1(i,e)*t1(m,b)*OVVO(m,a,e,j)
r2(i,j,a,b) = r2(i,j,a,b) + t1_cc(i,e)*t1_cc(m,b)*OVVO(m,a,e,j)
end do
end do
end do
@ -273,7 +271,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + t2(j,m,b,e)*cWovvo(m,a,e,i)
r2(i,j,a,b) = r2(i,j,a,b) + t2_cc(j,m,b,e)*cWovvo(m,a,e,i)
end do
end do
end do
@ -287,7 +285,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - t1(j,e)*t1(m,b)*OVVO(m,a,e,i)
r2(i,j,a,b) = r2(i,j,a,b) - t1_cc(j,e)*t1_cc(m,b)*OVVO(m,a,e,i)
end do
end do
end do
@ -301,7 +299,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do j=1,spin_occ_num
do e=1,spin_vir_num
do i=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + t1(i,e)*VVVO(a,b,e,j)
r2(i,j,a,b) = r2(i,j,a,b) + t1_cc(i,e)*VVVO(a,b,e,j)
end do
end do
end do
@ -314,7 +312,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do e=1,spin_vir_num
do i=1,spin_occ_num
do j=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - t1(j,e)*VVVO(a,b,e,i)
r2(i,j,a,b) = r2(i,j,a,b) - t1_cc(j,e)*VVVO(a,b,e,i)
end do
end do
end do
@ -327,7 +325,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) - t1(m,a)*OVOO(m,b,i,j)
r2(i,j,a,b) = r2(i,j,a,b) - t1_cc(m,a)*OVOO(m,b,i,j)
end do
end do
end do
@ -339,7 +337,7 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
do j=1,spin_occ_num
do i=1,spin_occ_num
do m=1,spin_occ_num
r2(i,j,a,b) = r2(i,j,a,b) + t1(m,b)*OVOO(m,a,i,j)
r2(i,j,a,b) = r2(i,j,a,b) + t1_cc(m,b)*OVOO(m,a,i,j)
end do
end do
end do
@ -348,6 +346,6 @@ subroutine form_r2_nc(t1,t2,tau,cFoo,cFov,cFvv,cWoooo,cWvvvv,cWovvo,r2)
! Final expression of the t2 residue
r2(:,:,:,:) = delta_oovv(:,:,:,:)*t2(:,:,:,:) - r2(:,:,:,:)
r2(:,:,:,:) = delta_oovv(:,:,:,:)*t2_cc(:,:,:,:) - r2(:,:,:,:)
end subroutine form_r2_nc

View File

@ -1,14 +1,9 @@
subroutine form_tau_nc(t1,t2,tau)
subroutine form_tau_nc(tau)
! Form tau in CCSD
implicit none
! Input variables
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)
! Local variables
integer :: i,j,k,l
@ -23,7 +18,7 @@ subroutine form_tau_nc(t1,t2,tau)
do j=1,spin_occ_num
do i=1,spin_occ_num
tau(i,j,a,b) = t2(i,j,a,b) + t1(i,a)*t1(j,b) - t1(i,b)*t1(j,a)
tau(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

View File

@ -1,14 +1,9 @@
subroutine form_taus_nc(t1,t2,taus)
subroutine form_taus_nc(taus)
! Form tau in CCSD
implicit none
! Input variables
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)
! Local variables
integer :: i,j,k,l
@ -23,7 +18,7 @@ subroutine form_taus_nc(t1,t2,taus)
do j=1,spin_occ_num
do i=1,spin_occ_num
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

View File

@ -1,13 +1,9 @@
subroutine form_ub(t1,ub)
subroutine form_ub(ub)
! Form 1st term in (T) correction
implicit none
! Input variables
double precision,intent(in) :: t1(spin_occ_num,spin_vir_num)
! Local variables
integer :: i,j,k,l
@ -24,15 +20,15 @@ subroutine form_ub(t1,ub)
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,13 +1,9 @@
subroutine form_ubb(t2,ubb)
subroutine form_ubb(ubb)
! Form 2nd term in (T) correction
implicit none
! Input variables
double precision,intent(in) :: t2(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num)
! Local variables
integer :: i,j,k,l,m
@ -28,28 +24,28 @@ subroutine form_ubb(t2,ubb)
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,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