1
0
mirror of https://gitlab.com/scemama/qp_plugins_scemama.git synced 2024-12-22 20:34:05 +01:00

Curly Fock

This commit is contained in:
Anthony Scemama 2019-09-14 14:42:46 +02:00
parent 3e6b874f9e
commit 8b131877c4
2 changed files with 60 additions and 65 deletions

View File

@ -25,10 +25,6 @@ subroutine CCSD
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(:,:,:,:)
@ -62,9 +58,11 @@ subroutine CCSD
! Initialization
allocate(cFvv(spin_vir_num,spin_vir_num),cFoo(spin_occ_num,spin_occ_num),cFov(spin_occ_num,spin_vir_num), &
cWoooo(spin_occ_num,spin_occ_num,spin_occ_num,spin_occ_num),cWvvvv(spin_vir_num,spin_vir_num,spin_vir_num,spin_vir_num),cWovvo(spin_occ_num,spin_vir_num,spin_vir_num,spin_occ_num), &
r1(spin_occ_num,spin_vir_num),r2(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num))
allocate(cWoooo(spin_occ_num,spin_occ_num,spin_occ_num,spin_occ_num), &
cWvvvv(spin_vir_num,spin_vir_num,spin_vir_num,spin_vir_num), &
cWovvo(spin_occ_num,spin_vir_num,spin_vir_num,spin_occ_num), &
r1(spin_occ_num,spin_vir_num), &
r2(spin_occ_num,spin_occ_num,spin_vir_num,spin_vir_num))
Conv = 1d0
nSCF = 0
@ -90,20 +88,14 @@ subroutine CCSD
nSCF = nSCF + 1
call form_cf_nc ( &
spin_fock_matrix_mo_oo, &
spin_fock_matrix_mo_ov, &
spin_fock_matrix_mo_vv, &
cFoo,cFov,cFvv)
call form_cw_nc (cWoooo,cWovvo,cWvvvv)
! Compute residuals
call form_r1_nc(spin_fock_matrix_mo_ov, &
cFoo,cFov,cFvv,r1)
c_spin_fock_matrix_mo_oo,c_spin_fock_matrix_mo_ov,c_spin_fock_matrix_mo_vv,r1)
call form_r2_nc(cFoo,cFov,cFvv, &
call form_r2_nc(c_spin_fock_matrix_mo_oo,c_spin_fock_matrix_mo_ov,c_spin_fock_matrix_mo_vv, &
cWoooo,cWvvvv,cWovvo,r2)
! Check convergence
@ -150,7 +142,6 @@ subroutine CCSD
! Deallocate memory
deallocate( &
cFvv,cFoo,cFov, &
cWoooo,cWvvvv,cWovvo, &
r1,r2)

View File

@ -1,97 +1,101 @@
subroutine form_cF_nc(Foo,Fov,Fvv,cFoo,cFov,cFvv)
! Compute F terms in CCSD
BEGIN_PROVIDER [ double precision, c_spin_fock_matrix_mo_oo, (spin_occ_num,spin_occ_num) ]
implicit none
! Input variables
double precision,intent(in) :: Foo(spin_occ_num,spin_occ_num)
double precision,intent(in) :: Fov(spin_occ_num,spin_vir_num)
double precision,intent(in) :: Fvv(spin_vir_num,spin_vir_num)
! Local variables
integer :: i,j,m,n
integer :: a,b,e,f
double precision,external :: Kronecker_Delta
! Output variables
double precision,intent(out) :: cFoo(spin_occ_num,spin_occ_num)
double precision,intent(out) :: cFov(spin_occ_num,spin_vir_num)
double precision,intent(out) :: cFvv(spin_vir_num,spin_vir_num)
! Occupied-occupied block
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
cFoo(m,i) = (1d0 - Kronecker_delta(m,i))*Foo(m,i)
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
cFoo(m,i) = cFoo(m,i) + 0.5d0*t1_cc(i,e)*Fov(m,e)
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
cFoo(m,i) = cFoo(m,i) + t1_cc(n,e)*OOOV(m,n,i,e)
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
cFoo(m,i) = cFoo(m,i) + 0.5d0*taus(i,n,e,f)*OOVV(m,n,e,f)
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
! Occupied-virtual block
cFov(:,:) = Fov(:,:)
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
cFov(m,e) = cFov(m,e) + t1_cc(n,f)*OOVV(m,n,e,f)
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
! Virtual-virtual block
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
cFvv(a,e) = (1d0 - Kronecker_delta(a,e))*Fvv(a,e)
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
cFvv(a,e) = cFvv(a,e) - 0.5d0*t1_cc(m,a)*Fov(m,e)
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
cFvv(a,e) = cFvv(a,e) + t1_cc(m,f)*OVVV(m,a,f,e)
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
cFvv(a,e) = cFvv(a,e) - 0.5d0*taus(m,n,a,f)*OOVV(m,n,e,f)
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
end subroutine form_cF_nc