2023-05-12 19:17:07 +02:00
|
|
|
! Main
|
|
|
|
|
|
|
|
subroutine ccsd_par_t_space_v3(nO,nV,t1,t2,f_o,f_v,v_vvvo,v_vvoo,v_vooo,energy)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
integer, intent(in) :: nO,nV
|
|
|
|
double precision, intent(in) :: t1(nO,nV), f_o(nO), f_v(nV)
|
|
|
|
double precision, intent(in) :: t2(nO,nO,nV,nV)
|
|
|
|
double precision, intent(in) :: v_vvvo(nV,nV,nV,nO), v_vvoo(nV,nV,nO,nO), v_vooo(nV,nO,nO,nO)
|
|
|
|
double precision, intent(out) :: energy
|
|
|
|
|
|
|
|
double precision, allocatable :: W(:,:,:,:,:,:)
|
|
|
|
double precision, allocatable :: V(:,:,:,:,:,:)
|
2023-05-13 23:29:58 +02:00
|
|
|
double precision, allocatable :: W_abc(:,:,:), W_cab(:,:,:), W_bca(:,:,:)
|
|
|
|
double precision, allocatable :: W_bac(:,:,:), W_cba(:,:,:), W_acb(:,:,:)
|
|
|
|
double precision, allocatable :: V_abc(:,:,:), V_cab(:,:,:), V_bca(:,:,:)
|
|
|
|
double precision, allocatable :: V_bac(:,:,:), V_cba(:,:,:), V_acb(:,:,:)
|
2023-05-13 13:32:52 +02:00
|
|
|
double precision, allocatable :: X_vovv(:,:,:,:), X_ooov(:,:,:,:), X_oovv(:,:,:,:)
|
|
|
|
double precision, allocatable :: T_voov(:,:,:,:), T_oovv(:,:,:,:)
|
2023-05-12 19:17:07 +02:00
|
|
|
integer :: i,j,k,l,a,b,c,d
|
2023-05-14 02:13:55 +02:00
|
|
|
double precision :: e,ta,tb, delta, delta_abc, x1, x2, x3
|
2023-05-12 19:17:07 +02:00
|
|
|
|
2023-05-13 13:32:52 +02:00
|
|
|
allocate(X_vovv(nV,nO,nV,nV), X_ooov(nO,nO,nO,nV), X_oovv(nO,nO,nV,nV))
|
|
|
|
allocate(T_voov(nV,nO,nO,nV),T_oovv(nO,nO,nV,nV))
|
2023-05-12 19:17:07 +02:00
|
|
|
|
2023-05-13 21:48:04 +02:00
|
|
|
call set_multiple_levels_omp(.False.)
|
|
|
|
|
2023-05-12 19:17:07 +02:00
|
|
|
! Temporary arrays
|
|
|
|
!$OMP PARALLEL &
|
2023-05-13 13:32:52 +02:00
|
|
|
!$OMP SHARED(nO,nV,T_voov,T_oovv,X_vovv,X_ooov,X_oovv, &
|
2023-05-12 19:17:07 +02:00
|
|
|
!$OMP t1,t2,v_vvvo,v_vooo,v_vvoo) &
|
|
|
|
!$OMP PRIVATE(a,b,c,d,i,j,k,l) &
|
|
|
|
!$OMP DEFAULT(NONE)
|
|
|
|
|
|
|
|
!v_vvvo(b,a,d,i) * t2(k,j,c,d) &
|
2023-05-13 13:32:52 +02:00
|
|
|
!X_vovv(d,i,b,a,i) * T_voov(d,j,c,k)
|
2023-05-12 19:17:07 +02:00
|
|
|
|
|
|
|
!$OMP DO collapse(3)
|
|
|
|
do i = 1, nO
|
|
|
|
do a = 1, nV
|
|
|
|
do b = 1, nV
|
|
|
|
do d = 1, nV
|
2023-05-13 13:32:52 +02:00
|
|
|
X_vovv(d,i,b,a) = v_vvvo(b,a,d,i)
|
2023-05-12 19:17:07 +02:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
!$OMP END DO nowait
|
|
|
|
|
|
|
|
!$OMP DO collapse(3)
|
|
|
|
do j = 1, nO
|
|
|
|
do k = 1, nO
|
|
|
|
do c = 1, nV
|
|
|
|
do d = 1, nV
|
2023-05-13 13:32:52 +02:00
|
|
|
T_voov(d,k,j,c) = t2(k,j,c,d)
|
2023-05-12 19:17:07 +02:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
!$OMP END DO nowait
|
|
|
|
|
|
|
|
!v_vooo(c,j,k,l) * t2(i,l,a,b) &
|
2023-05-13 13:32:52 +02:00
|
|
|
!X_ooov(l,j,k,c) * T_oovv(l,i,a,b) &
|
2023-05-12 19:17:07 +02:00
|
|
|
|
|
|
|
!$OMP DO collapse(3)
|
2023-05-13 13:32:52 +02:00
|
|
|
do c = 1, nV
|
|
|
|
do k = 1, nO
|
|
|
|
do j = 1, nO
|
2023-05-12 19:17:07 +02:00
|
|
|
do l = 1, nO
|
2023-05-13 13:32:52 +02:00
|
|
|
X_ooov(l,j,k,c) = v_vooo(c,j,k,l)
|
2023-05-12 19:17:07 +02:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
!$OMP END DO nowait
|
|
|
|
|
|
|
|
!$OMP DO collapse(3)
|
|
|
|
do i = 1, nO
|
|
|
|
do b = 1, nV
|
|
|
|
do a = 1, nV
|
|
|
|
do l = 1, nO
|
2023-05-13 13:32:52 +02:00
|
|
|
T_oovv(l,i,a,b) = t2(i,l,a,b)
|
2023-05-12 19:17:07 +02:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
!$OMP END DO nowait
|
|
|
|
|
2023-05-13 13:32:52 +02:00
|
|
|
!X_oovv(j,k,b,c) * T1_vo(a,i) &
|
2023-05-12 19:17:07 +02:00
|
|
|
|
|
|
|
!$OMP DO collapse(3)
|
2023-05-13 13:32:52 +02:00
|
|
|
do c = 1, nV
|
|
|
|
do b = 1, nV
|
|
|
|
do j = 1, nO
|
|
|
|
do k = 1, nO
|
|
|
|
X_oovv(j,k,b,c) = v_vvoo(b,c,j,k)
|
2023-05-12 19:17:07 +02:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
!$OMP END DO nowait
|
|
|
|
|
|
|
|
!$OMP END PARALLEL
|
|
|
|
|
|
|
|
energy = 0d0
|
2023-05-13 23:29:58 +02:00
|
|
|
!$OMP PARALLEL &
|
2023-05-14 02:13:55 +02:00
|
|
|
!$OMP PRIVATE(a,b,c,x1) &
|
2023-05-13 23:29:58 +02:00
|
|
|
!$OMP PRIVATE(W_abc, W_cab, W_bca, W_bac, W_cba, W_acb, &
|
|
|
|
!$OMP V_abc, V_cab, V_bca, V_bac, V_cba, V_acb ) &
|
|
|
|
!$OMP PRIVATE(i,j,k,e,delta,delta_abc) &
|
|
|
|
!$OMP DEFAULT(SHARED)
|
|
|
|
allocate( W_abc(nO,nO,nO), W_cab(nO,nO,nO), W_bca(nO,nO,nO), &
|
|
|
|
W_bac(nO,nO,nO), W_cba(nO,nO,nO), W_acb(nO,nO,nO), &
|
|
|
|
V_abc(nO,nO,nO), V_cab(nO,nO,nO), V_bca(nO,nO,nO), &
|
|
|
|
V_bac(nO,nO,nO), V_cba(nO,nO,nO), V_acb(nO,nO,nO) )
|
2023-05-14 02:13:55 +02:00
|
|
|
e = 0d0
|
2023-05-13 21:48:04 +02:00
|
|
|
!$OMP DO
|
2023-05-14 02:13:55 +02:00
|
|
|
do a = 1, nV
|
|
|
|
do b = 1, a-1
|
|
|
|
do c = 1, b-1
|
2023-05-12 19:17:07 +02:00
|
|
|
delta_abc = f_v(a) + f_v(b) + f_v(c)
|
2023-05-13 23:29:58 +02:00
|
|
|
call form_w_abc(nO,nV,a,b,c,T_voov,T_oovv,X_vovv,X_ooov,W_abc,W_cba,W_bca,W_cab,W_bac,W_acb)
|
|
|
|
call form_v_abc(nO,nV,a,b,c,t1,X_oovv,W_abc,V_abc,W_cba,V_cba,W_bca,V_bca,W_cab,V_cab,W_bac,V_bac,W_acb,V_acb)
|
2023-05-12 19:17:07 +02:00
|
|
|
do i = 1, nO
|
|
|
|
do j = 1, nO
|
|
|
|
do k = 1, nO
|
2023-05-14 02:13:55 +02:00
|
|
|
delta = 1.d0 / (f_o(i) + f_o(j) + f_o(k) - delta_abc)
|
|
|
|
e = e + delta * ( &
|
|
|
|
(4d0 * W_abc(i,j,k) + W_bca(i,j,k) + W_cab(i,j,k)) * (V_abc(i,j,k) - V_cba(i,j,k)) + &
|
|
|
|
(4d0 * W_acb(i,j,k) + W_cba(i,j,k) + W_bac(i,j,k)) * (V_acb(i,j,k) - V_bca(i,j,k)) + &
|
|
|
|
(4d0 * W_bac(i,j,k) + W_acb(i,j,k) + W_cba(i,j,k)) * (V_bac(i,j,k) - V_cab(i,j,k)) + &
|
|
|
|
(4d0 * W_bca(i,j,k) + W_cab(i,j,k) + W_abc(i,j,k)) * (V_bca(i,j,k) - V_acb(i,j,k)) + &
|
|
|
|
(4d0 * W_cba(i,j,k) + W_bac(i,j,k) + W_acb(i,j,k)) * (V_cba(i,j,k) - V_abc(i,j,k)) + &
|
|
|
|
(4d0 * W_cab(i,j,k) + W_abc(i,j,k) + W_bca(i,j,k)) * (V_cab(i,j,k) - V_bac(i,j,k)) + &
|
|
|
|
0.d0)
|
2023-05-12 19:17:07 +02:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
2023-05-14 02:13:55 +02:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
|
|
|
c = a
|
|
|
|
do b = 1, nV
|
|
|
|
delta_abc = f_v(a) + f_v(b) + f_v(c)
|
|
|
|
call form_w_abc(nO,nV,a,b,c,T_voov,T_oovv,X_vovv,X_ooov,W_abc,W_cba,W_bca,W_cab,W_bac,W_acb)
|
|
|
|
call form_v_abc(nO,nV,a,b,c,t1,X_oovv,W_abc,V_abc,W_cba,V_cba,W_bca,V_bca,W_cab,V_cab,W_bac,V_bac,W_acb,V_acb)
|
|
|
|
do i = 1, nO
|
|
|
|
do j = 1, nO
|
|
|
|
do k = 1, nO
|
|
|
|
delta = 1.d0 / (f_o(i) + f_o(j) + f_o(k) - delta_abc)
|
|
|
|
e = e + delta * ( &
|
|
|
|
(4d0 * W_abc(i,j,k) + W_bca(i,j,k) + W_cab(i,j,k)) * (V_abc(i,j,k) - V_cba(i,j,k)) + &
|
|
|
|
(4d0 * W_acb(i,j,k) + W_cba(i,j,k) + W_bac(i,j,k)) * (V_acb(i,j,k) - V_bca(i,j,k)) + &
|
|
|
|
(4d0 * W_bac(i,j,k) + W_acb(i,j,k) + W_cba(i,j,k)) * (V_bac(i,j,k) - V_cab(i,j,k)) + &
|
|
|
|
0.d0)
|
|
|
|
enddo
|
|
|
|
enddo
|
2023-05-12 19:17:07 +02:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
2023-05-13 21:48:04 +02:00
|
|
|
!$OMP END DO
|
2023-05-14 02:13:55 +02:00
|
|
|
!$OMP CRITICAL
|
|
|
|
energy = energy + e
|
|
|
|
!$OMP END CRITICAL
|
2023-05-13 21:48:04 +02:00
|
|
|
|
2023-05-13 23:29:58 +02:00
|
|
|
deallocate(W_abc, W_cab, W_bca, W_bac, W_cba, W_acb, &
|
|
|
|
V_abc, V_cab, V_bca, V_bac, V_cba, V_acb )
|
|
|
|
|
2023-05-13 21:48:04 +02:00
|
|
|
!$OMP END PARALLEL
|
2023-05-12 19:17:07 +02:00
|
|
|
|
2023-05-13 21:48:04 +02:00
|
|
|
energy = energy / 3.d0
|
2023-05-12 19:17:07 +02:00
|
|
|
|
2023-05-13 21:48:04 +02:00
|
|
|
deallocate(X_vovv,X_ooov,T_voov,T_oovv)
|
2023-05-12 19:17:07 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2023-05-13 23:29:58 +02:00
|
|
|
subroutine form_w_abc(nO,nV,a,b,c,T_voov,T_oovv,X_vovv,X_ooov,W_abc,W_cba,W_bca,W_cab,W_bac,W_acb)
|
2023-05-12 19:17:07 +02:00
|
|
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
integer, intent(in) :: nO,nV,a,b,c
|
2023-05-13 13:32:52 +02:00
|
|
|
double precision, intent(in) :: T_voov(nV,nO,nO,nV), T_oovv(nO,nO,nV,nV)
|
|
|
|
double precision, intent(in) :: X_vovv(nV,nO,nV,nV), X_ooov(nO,nO,nO,nV)
|
2023-05-12 19:17:07 +02:00
|
|
|
double precision, intent(out) :: W_abc(nO,nO,nO)
|
2023-05-13 22:23:08 +02:00
|
|
|
double precision, intent(out) :: W_cba(nO,nO,nO)
|
|
|
|
double precision, intent(out) :: W_bca(nO,nO,nO)
|
|
|
|
double precision, intent(out) :: W_cab(nO,nO,nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
double precision, intent(out) :: W_bac(nO,nO,nO)
|
|
|
|
double precision, intent(out) :: W_acb(nO,nO,nO)
|
2023-05-12 19:17:07 +02:00
|
|
|
|
|
|
|
integer :: l,i,j,k,d
|
2023-05-13 22:23:08 +02:00
|
|
|
double precision, allocatable, dimension(:,:,:,:) :: W_ikj
|
2023-05-13 21:25:49 +02:00
|
|
|
double precision, allocatable :: X(:,:,:,:)
|
2023-05-12 19:17:07 +02:00
|
|
|
|
2023-05-13 23:29:58 +02:00
|
|
|
allocate(W_ikj(nO,nO,nO,6))
|
2023-05-13 22:23:08 +02:00
|
|
|
allocate(X(nV,nO,nO,3))
|
2023-05-13 15:34:16 +02:00
|
|
|
|
2023-05-13 21:25:49 +02:00
|
|
|
do k=1,nO
|
|
|
|
do i=1,nO
|
|
|
|
do d=1,nV
|
2023-05-13 23:29:58 +02:00
|
|
|
X(d,i,k,1) = T_voov(d,k,i,a)
|
2023-05-13 21:25:49 +02:00
|
|
|
X(d,i,k,2) = T_voov(d,k,i,b)
|
2023-05-13 23:29:58 +02:00
|
|
|
X(d,i,k,3) = T_voov(d,k,i,c)
|
2023-05-13 21:25:49 +02:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
2023-05-13 15:34:16 +02:00
|
|
|
|
|
|
|
! X_vovv(d,i,c,a) * T_voov(d,j,k,b) : i jk
|
2023-05-13 21:25:49 +02:00
|
|
|
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nV, 1.d0, X_vovv(1,1,c,a), nV, T_voov(1,1,1,b), nV, 0.d0, W_abc, nO)
|
2023-05-14 02:13:55 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nV, 1.d0, X_vovv(1,1,c,b), nV, T_voov(1,1,1,a), nV, 0.d0, W_bac, nO)
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nV, 1.d0, X_vovv(1,1,a,c), nV, T_voov(1,1,1,b), nV, 0.d0, W_cba, nO)
|
|
|
|
call dgemm('T','N', nO, nO*nO, nV, 1.d0, X_vovv(1,1,a,b), nV, T_voov(1,1,1,c), nV, 0.d0, W_bca, nO)
|
|
|
|
call dgemm('T','N', nO, nO*nO, nV, 1.d0, X_vovv(1,1,b,c), nV, T_voov(1,1,1,a), nV, 0.d0, W_cab, nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nV, 1.d0, X_vovv(1,1,b,a), nV, T_voov(1,1,1,c), nV, 0.d0, W_acb, nO)
|
2023-05-13 15:34:16 +02:00
|
|
|
|
|
|
|
! T_voov(d,i,j,a) * X_vovv(d,k,b,c) : ij k
|
2023-05-13 21:25:49 +02:00
|
|
|
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, T_voov(1,1,1,a), nV, X_vovv(1,1,b,c), nV, 1.d0, W_abc, nO*nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, T_voov(1,1,1,b), nV, X_vovv(1,1,a,c), nV, 1.d0, W_bac, nO*nO)
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, T_voov(1,1,1,c), nV, X_vovv(1,1,b,a), nV, 1.d0, W_cba, nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, T_voov(1,1,1,b), nV, X_vovv(1,1,c,a), nV, 1.d0, W_bca, nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, T_voov(1,1,1,c), nV, X_vovv(1,1,a,b), nV, 1.d0, W_cab, nO*nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, T_voov(1,1,1,a), nV, X_vovv(1,1,c,b), nV, 1.d0, W_acb, nO*nO)
|
2023-05-13 22:23:08 +02:00
|
|
|
|
2023-05-13 15:34:16 +02:00
|
|
|
|
2023-05-13 21:25:49 +02:00
|
|
|
! X_vovv(d,k,a,c) * T_voov(d,j,i,b) : k ji
|
2023-05-13 15:34:16 +02:00
|
|
|
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, X(1,1,1,2), nV, X_vovv(1,1,a,c), nV, 1.d0, W_abc, nO*nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, X(1,1,1,1), nV, X_vovv(1,1,b,c), nV, 1.d0, W_bac, nO*nO)
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, X(1,1,1,2), nV, X_vovv(1,1,c,a), nV, 1.d0, W_cba, nO*nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, X(1,1,1,3), nV, X_vovv(1,1,b,a), nV, 1.d0, W_bca, nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, X(1,1,1,1), nV, X_vovv(1,1,c,b), nV, 1.d0, W_cab, nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, X(1,1,1,3), nV, X_vovv(1,1,a,b), nV, 1.d0, W_acb, nO*nO)
|
2023-05-13 15:34:16 +02:00
|
|
|
|
2023-05-13 21:25:49 +02:00
|
|
|
! X_vovv(d,i,b,a) * T_voov(d,k,j,c) : i kj
|
|
|
|
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nV, 1.d0, X_vovv(1,1,b,a), nV, X(1,1,1,3), nV, 1.d0, W_abc, nO)
|
|
|
|
call dgemm('T','N', nO, nO*nO, nV, 1.d0, X_vovv(1,1,a,b), nV, X(1,1,1,3), nV, 1.d0, W_bac, nO)
|
|
|
|
call dgemm('T','N', nO, nO*nO, nV, 1.d0, X_vovv(1,1,b,c), nV, X(1,1,1,1), nV, 1.d0, W_cba, nO)
|
|
|
|
call dgemm('T','N', nO, nO*nO, nV, 1.d0, X_vovv(1,1,c,b), nV, X(1,1,1,1), nV, 1.d0, W_bca, nO)
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nV, 1.d0, X_vovv(1,1,a,c), nV, X(1,1,1,2), nV, 1.d0, W_cab, nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nV, 1.d0, X_vovv(1,1,c,a), nV, X(1,1,1,2), nV, 1.d0, W_acb, nO)
|
2023-05-13 21:25:49 +02:00
|
|
|
|
|
|
|
! T_voov(d,k,i,c) * X_vovv(d,j,a,b) : ki j
|
2023-05-13 15:34:16 +02:00
|
|
|
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, X(1,1,1,3), nV, X_vovv(1,1,a,b), nV, 0.d0, W_ikj(1,1,1,1), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, X(1,1,1,3), nV, X_vovv(1,1,b,a), nV, 0.d0, W_ikj(1,1,1,2), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, X(1,1,1,1), nV, X_vovv(1,1,c,b), nV, 0.d0, W_ikj(1,1,1,3), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, X(1,1,1,1), nV, X_vovv(1,1,b,c), nV, 0.d0, W_ikj(1,1,1,4), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, X(1,1,1,2), nV, X_vovv(1,1,c,a), nV, 0.d0, W_ikj(1,1,1,5), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, X(1,1,1,2), nV, X_vovv(1,1,a,c), nV, 0.d0, W_ikj(1,1,1,6), nO*nO)
|
2023-05-13 15:34:16 +02:00
|
|
|
|
|
|
|
! T_voov(d,i,k,a) * X_vovv(d,j,c,b) : ik j
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, T_voov(1,1,1,a), nV, X_vovv(1,1,c,b), nV, 1.d0, W_ikj(1,1,1,1), nO*nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, T_voov(1,1,1,b), nV, X_vovv(1,1,c,a), nV, 1.d0, W_ikj(1,1,1,2), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, T_voov(1,1,1,c), nV, X_vovv(1,1,a,b), nV, 1.d0, W_ikj(1,1,1,3), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, T_voov(1,1,1,b), nV, X_vovv(1,1,a,c), nV, 1.d0, W_ikj(1,1,1,4), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, T_voov(1,1,1,c), nV, X_vovv(1,1,b,a), nV, 1.d0, W_ikj(1,1,1,5), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nV, 1.d0, T_voov(1,1,1,a), nV, X_vovv(1,1,b,c), nV, 1.d0, W_ikj(1,1,1,6), nO*nO)
|
2023-05-13 15:34:16 +02:00
|
|
|
|
2023-05-13 21:25:49 +02:00
|
|
|
deallocate(X)
|
|
|
|
|
2023-05-13 22:23:08 +02:00
|
|
|
allocate(X(nO,nO,nO,3))
|
2023-05-13 21:25:49 +02:00
|
|
|
|
2023-05-13 15:34:16 +02:00
|
|
|
do k=1,nO
|
|
|
|
do j=1,nO
|
2023-05-13 21:25:49 +02:00
|
|
|
do l=1,nO
|
2023-05-13 23:29:58 +02:00
|
|
|
X(l,j,k,1) = X_ooov(l,k,j,a)
|
|
|
|
X(l,j,k,2) = X_ooov(l,k,j,b)
|
2023-05-13 22:23:08 +02:00
|
|
|
X(l,j,k,3) = X_ooov(l,k,j,c)
|
2023-05-13 15:34:16 +02:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
|
|
|
! - T_oovv(l,i,a,b) * X_ooov(l,j,k,c) : i jk
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nO, -1.d0, T_oovv(1,1,a,b), nO, X_ooov(1,1,1,c), nO, 1.d0, W_abc, nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nO, -1.d0, T_oovv(1,1,b,a), nO, X_ooov(1,1,1,c), nO, 1.d0, W_bac, nO)
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nO, -1.d0, T_oovv(1,1,c,b), nO, X_ooov(1,1,1,a), nO, 1.d0, W_cba, nO)
|
|
|
|
call dgemm('T','N', nO, nO*nO, nO, -1.d0, T_oovv(1,1,b,c), nO, X_ooov(1,1,1,a), nO, 1.d0, W_bca, nO)
|
|
|
|
call dgemm('T','N', nO, nO*nO, nO, -1.d0, T_oovv(1,1,c,a), nO, X_ooov(1,1,1,b), nO, 1.d0, W_cab, nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nO, -1.d0, T_oovv(1,1,a,c), nO, X_ooov(1,1,1,b), nO, 1.d0, W_acb, nO)
|
2023-05-13 21:25:49 +02:00
|
|
|
|
2023-05-13 15:34:16 +02:00
|
|
|
! - T_oovv(l,i,a,c) * X_ooov(l,k,j,b) : i kj
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nO, -1.d0, T_oovv(1,1,a,c), nO, X(1,1,1,2), nO, 1.d0, W_abc, nO)
|
|
|
|
call dgemm('T','N', nO, nO*nO, nO, -1.d0, T_oovv(1,1,b,c), nO, X(1,1,1,1), nO, 1.d0, W_bac, nO)
|
|
|
|
call dgemm('T','N', nO, nO*nO, nO, -1.d0, T_oovv(1,1,c,a), nO, X(1,1,1,2), nO, 1.d0, W_cba, nO)
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nO, -1.d0, T_oovv(1,1,b,a), nO, X(1,1,1,3), nO, 1.d0, W_bca, nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO, nO*nO, nO, -1.d0, T_oovv(1,1,c,b), nO, X(1,1,1,1), nO, 1.d0, W_cab, nO)
|
|
|
|
call dgemm('T','N', nO, nO*nO, nO, -1.d0, T_oovv(1,1,a,b), nO, X(1,1,1,3), nO, 1.d0, W_acb, nO)
|
2023-05-12 19:17:07 +02:00
|
|
|
|
2023-05-13 21:48:04 +02:00
|
|
|
! - X_ooov(l,i,j,b) * T_oovv(l,k,c,a) : ij k
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X_ooov(1,1,1,b), nO, T_oovv(1,1,c,a), nO, 1.d0, W_abc, nO*nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X_ooov(1,1,1,a), nO, T_oovv(1,1,c,b), nO, 1.d0, W_bac, nO*nO)
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X_ooov(1,1,1,b), nO, T_oovv(1,1,a,c), nO, 1.d0, W_cba, nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X_ooov(1,1,1,c), nO, T_oovv(1,1,a,b), nO, 1.d0, W_bca, nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X_ooov(1,1,1,a), nO, T_oovv(1,1,b,c), nO, 1.d0, W_cab, nO*nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X_ooov(1,1,1,c), nO, T_oovv(1,1,b,a), nO, 1.d0, W_acb, nO*nO)
|
2023-05-12 19:17:07 +02:00
|
|
|
|
2023-05-13 21:25:49 +02:00
|
|
|
! - X_ooov(l,j,i,a) * T_oovv(l,k,c,b) : ji k
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X(1,1,1,1), nO, T_oovv(1,1,c,b), nO, 1.d0, W_abc, nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X(1,1,1,2), nO, T_oovv(1,1,c,a), nO, 1.d0, W_bac, nO*nO)
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X(1,1,1,3), nO, T_oovv(1,1,a,b), nO, 1.d0, W_cba, nO*nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X(1,1,1,2), nO, T_oovv(1,1,a,c), nO, 1.d0, W_bca, nO*nO)
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X(1,1,1,3), nO, T_oovv(1,1,b,a), nO, 1.d0, W_cab, nO*nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X(1,1,1,1), nO, T_oovv(1,1,b,c), nO, 1.d0, W_acb, nO*nO)
|
2023-05-13 21:25:49 +02:00
|
|
|
|
|
|
|
! - X_ooov(l,k,i,a) * T_oovv(l,j,b,c) : ki j
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X(1,1,1,1), nO, T_oovv(1,1,b,c), nO, 1.d0, W_ikj(1,1,1,1), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X(1,1,1,2), nO, T_oovv(1,1,a,c), nO, 1.d0, W_ikj(1,1,1,2), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X(1,1,1,3), nO, T_oovv(1,1,b,a), nO, 1.d0, W_ikj(1,1,1,3), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X(1,1,1,2), nO, T_oovv(1,1,c,a), nO, 1.d0, W_ikj(1,1,1,4), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X(1,1,1,3), nO, T_oovv(1,1,a,b), nO, 1.d0, W_ikj(1,1,1,5), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X(1,1,1,1), nO, T_oovv(1,1,c,b), nO, 1.d0, W_ikj(1,1,1,6), nO*nO)
|
2023-05-13 21:25:49 +02:00
|
|
|
|
|
|
|
! - X_ooov(l,i,k,c) * T_oovv(l,j,b,a) : ik j
|
2023-05-13 22:23:08 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X_ooov(1,1,1,c), nO, T_oovv(1,1,b,a), nO, 1.d0, W_ikj(1,1,1,1), nO*nO)
|
2023-05-13 23:29:58 +02:00
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X_ooov(1,1,1,c), nO, T_oovv(1,1,a,b), nO, 1.d0, W_ikj(1,1,1,2), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X_ooov(1,1,1,a), nO, T_oovv(1,1,b,c), nO, 1.d0, W_ikj(1,1,1,3), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X_ooov(1,1,1,a), nO, T_oovv(1,1,c,b), nO, 1.d0, W_ikj(1,1,1,4), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X_ooov(1,1,1,b), nO, T_oovv(1,1,a,c), nO, 1.d0, W_ikj(1,1,1,5), nO*nO)
|
|
|
|
call dgemm('T','N', nO*nO, nO, nO, -1.d0, X_ooov(1,1,1,b), nO, T_oovv(1,1,c,a), nO, 1.d0, W_ikj(1,1,1,6), nO*nO)
|
2023-05-13 21:25:49 +02:00
|
|
|
|
|
|
|
do k=1,nO
|
|
|
|
do j=1,nO
|
|
|
|
do i=1,nO
|
2023-05-13 22:23:08 +02:00
|
|
|
W_abc(i,j,k) = W_abc(i,j,k) + W_ikj(i,k,j,1)
|
2023-05-13 23:29:58 +02:00
|
|
|
W_bac(i,j,k) = W_bac(i,j,k) + W_ikj(i,k,j,2)
|
|
|
|
W_cba(i,j,k) = W_cba(i,j,k) + W_ikj(i,k,j,3)
|
|
|
|
W_bca(i,j,k) = W_bca(i,j,k) + W_ikj(i,k,j,4)
|
|
|
|
W_cab(i,j,k) = W_cab(i,j,k) + W_ikj(i,k,j,5)
|
|
|
|
W_acb(i,j,k) = W_acb(i,j,k) + W_ikj(i,k,j,6)
|
2023-05-12 19:17:07 +02:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
2023-05-13 21:48:04 +02:00
|
|
|
deallocate(X,W_ikj)
|
2023-05-12 19:17:07 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
! V_abc
|
|
|
|
|
2023-05-13 23:29:58 +02:00
|
|
|
subroutine form_v_abc(nO,nV,a,b,c,T_ov,X_oovv,W_abc,V_abc,W_cba,V_cba,W_bca,V_bca,W_cab,V_cab,W_bac,V_bac,W_acb,V_acb)
|
2023-05-12 19:17:07 +02:00
|
|
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
integer, intent(in) :: nO,nV,a,b,c
|
2023-05-13 13:32:52 +02:00
|
|
|
double precision, intent(in) :: T_ov(nO,nV)
|
|
|
|
double precision, intent(in) :: X_oovv(nO,nO,nV,nV)
|
2023-05-13 23:29:58 +02:00
|
|
|
double precision, intent(in) :: W_abc(nO,nO,nO), W_cab(nO,nO,nO), W_bca(nO,nO,nO)
|
|
|
|
double precision, intent(in) :: W_bac(nO,nO,nO), W_cba(nO,nO,nO), W_acb(nO,nO,nO)
|
|
|
|
double precision, intent(out) :: V_abc(nO,nO,nO), V_cab(nO,nO,nO), V_bca(nO,nO,nO)
|
|
|
|
double precision, intent(out) :: V_bac(nO,nO,nO), V_cba(nO,nO,nO), V_acb(nO,nO,nO)
|
2023-05-12 19:17:07 +02:00
|
|
|
|
|
|
|
integer :: i,j,k
|
|
|
|
|
|
|
|
do k = 1, nO
|
|
|
|
do j = 1, nO
|
|
|
|
do i = 1, nO
|
2023-05-13 23:29:58 +02:00
|
|
|
V_abc(i,j,k) = W_abc(i,j,k) &
|
2023-05-13 13:32:52 +02:00
|
|
|
+ X_oovv(j,k,b,c) * T_ov(i,a) &
|
|
|
|
+ X_oovv(i,k,a,c) * T_ov(j,b) &
|
2023-05-13 23:29:58 +02:00
|
|
|
+ X_oovv(i,j,a,b) * T_ov(k,c)
|
|
|
|
|
|
|
|
V_cba(i,j,k) = W_cba(i,j,k) &
|
|
|
|
+ X_oovv(j,k,b,a) * T_ov(i,c) &
|
|
|
|
+ X_oovv(i,k,c,a) * T_ov(j,b) &
|
|
|
|
+ X_oovv(i,j,c,b) * T_ov(k,a)
|
|
|
|
|
|
|
|
V_bca(i,j,k) = W_bca(i,j,k) &
|
|
|
|
+ X_oovv(j,k,c,a) * T_ov(i,b) &
|
|
|
|
+ X_oovv(i,k,b,a) * T_ov(j,c) &
|
|
|
|
+ X_oovv(i,j,b,c) * T_ov(k,a)
|
|
|
|
|
|
|
|
V_cab(i,j,k) = W_cab(i,j,k) &
|
|
|
|
+ X_oovv(j,k,a,b) * T_ov(i,c) &
|
|
|
|
+ X_oovv(i,k,c,b) * T_ov(j,a) &
|
|
|
|
+ X_oovv(i,j,c,a) * T_ov(k,b)
|
|
|
|
|
|
|
|
V_bac(i,j,k) = W_bac(i,j,k) &
|
|
|
|
+ X_oovv(j,k,a,c) * T_ov(i,b) &
|
|
|
|
+ X_oovv(i,k,b,c) * T_ov(j,a) &
|
|
|
|
+ X_oovv(i,j,b,a) * T_ov(k,c)
|
|
|
|
|
|
|
|
V_acb(i,j,k) = W_acb(i,j,k) &
|
|
|
|
+ X_oovv(j,k,c,b) * T_ov(i,a) &
|
|
|
|
+ X_oovv(i,k,a,b) * T_ov(j,c) &
|
|
|
|
+ X_oovv(i,j,a,c) * T_ov(k,b)
|
|
|
|
|
2023-05-12 19:17:07 +02:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
|
|
|
end
|
|
|
|
|