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

Compare commits

...

2 Commits

Author SHA1 Message Date
409ad536e0 Optimized curly_W and Fock 2019-09-23 20:03:13 +02:00
dc915d31d7 Optimized r1_cc 2019-09-23 18:48:48 +02:00
3 changed files with 138 additions and 105 deletions

View File

@ -6,35 +6,40 @@ BEGIN_PROVIDER [ double precision, c_spin_fock_matrix_mo_oo, (spin_occ_num,spin_
integer :: i,j,m,n integer :: i,j,m,n
integer :: a,b,e,f integer :: a,b,e,f
do m=1,spin_occ_num
do i=1,spin_occ_num do i=1,spin_occ_num
do m=1,spin_occ_num
if (m /= i) then if (m /= i) then
c_spin_fock_matrix_mo_oo(m,i) = spin_fock_matrix_mo_oo(m,i) c_spin_fock_matrix_mo_oo(m,i) = spin_fock_matrix_mo_oo(m,i)
else else
c_spin_fock_matrix_mo_oo(m,i) = 0.d0 c_spin_fock_matrix_mo_oo(m,i) = 0.d0
endif endif
end do
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 end do
do e=1,spin_vir_num do e=1,spin_vir_num
do i=1,spin_occ_num
do n=1,spin_occ_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) do m=1,spin_occ_num
c_spin_fock_matrix_mo_oo(m,i) = c_spin_fock_matrix_mo_oo(m,i) +&
OOOV(m,n,i,e) * t1_cc(n,e)
end do end do
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 do call dgemm('N','T', &
end do spin_occ_num, spin_occ_num, spin_vir_num, &
0.5d0, spin_fock_matrix_mo_ov, spin_occ_num, &
t1_cc, spin_occ_num, &
1.d0, c_spin_fock_matrix_mo_oo, spin_occ_num)
call dgemm('N','T', &
spin_occ_num, spin_occ_num, spin_vir_num*spin_occ_num*spin_vir_num,&
0.5d0, OOVV, spin_occ_num, &
taus, spin_occ_num, &
1.d0, c_spin_fock_matrix_mo_oo, spin_occ_num)
END_PROVIDER END_PROVIDER
@ -96,25 +101,32 @@ BEGIN_PROVIDER [ double precision, c_spin_fock_matrix_mo_vv, (spin_vir_num,spin_
c_spin_fock_matrix_mo_vv(a,e) = 0.d0 c_spin_fock_matrix_mo_vv(a,e) = 0.d0
endif endif
do m=1,spin_occ_num end do
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 end do
do m=1,spin_occ_num call dgemm('T','N', &
spin_vir_num, spin_vir_num, spin_occ_num, &
-0.5d0, t1_cc, size(t1_cc,1), &
spin_fock_matrix_mo_ov, size(spin_fock_matrix_mo_ov,1), &
1.d0, c_spin_fock_matrix_mo_vv, size(c_spin_fock_matrix_mo_vv,1))
do e=1,spin_vir_num
do a=1,spin_vir_num
do f=1,spin_vir_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 m=1,spin_occ_num
do n=1,spin_occ_num c_spin_fock_matrix_mo_vv(a,e) = c_spin_fock_matrix_mo_vv(a,e) + &
do f=1,spin_vir_num 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) - 0.5d0*taus(m,n,a,f)*OOVV(m,n,e,f) end do
end do end do
end do end do
end do end do
end do
end do call dgemm('T','N', &
spin_vir_num, spin_vir_num, spin_occ_num*spin_occ_num*spin_vir_num,&
-0.5d0, taus, spin_occ_num*spin_occ_num*spin_vir_num, &
OOVV, spin_occ_num*spin_occ_num*spin_vir_num, &
1.d0, c_spin_fock_matrix_mo_vv, spin_vir_num)
END_PROVIDER END_PROVIDER

View File

@ -33,7 +33,7 @@ BEGIN_PROVIDER [ double precision, cWoooo, (spin_occ_num,spin_occ_num,spin_occ_n
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ double precision, cWovvo_prime, (spin_occ_num,spin_vir_num,spin_vir_num,spin_occ_num) ] BEGIN_PROVIDER [ double precision, cWovvo, (spin_occ_num,spin_vir_num,spin_vir_num,spin_occ_num) ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Curly W in occ-vir-vir-occ block ! Curly W in occ-vir-vir-occ block
@ -43,47 +43,67 @@ BEGIN_PROVIDER [ double precision, cWovvo_prime, (spin_occ_num,spin_vir_num,spin
double precision :: x double precision :: x
cWovvo_prime(:,:,:,:) = OVVO_prime(:,:,:,:) cWovvo(:,:,:,:) = OVVO(:,:,:,:)
call dgemm('N','T', &
spin_occ_num*spin_vir_num*spin_vir_num, spin_occ_num, spin_vir_num, &
1.d0, OVVV, spin_occ_num*spin_vir_num*spin_vir_num, &
t1_cc, spin_occ_num, &
1.d0, cWovvo, spin_occ_num*spin_vir_num*spin_vir_num)
do f=1,spin_vir_num
do j=1,spin_occ_num
do b=1,spin_vir_num
do e=1,spin_vir_num
do m=1,spin_occ_num
cWovvo_prime(m,e,b,j) = cWovvo_prime(m,e,b,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 j=1,spin_occ_num
do e=1,spin_vir_num do e=1,spin_vir_num
do b=1,spin_vir_num call dgemm('N','N', &
do n=1,spin_occ_num spin_occ_num, spin_vir_num, spin_occ_num, &
do m=1,spin_occ_num -1.d0, OOVO(1,1,e,j), spin_occ_num, &
cWovvo_prime(m,e,b,j) = cWovvo_prime(m,e,b,j) - t1_cc(n,b)*OOVO(m,n,e,j) t1_cc, spin_occ_num, &
end do 1.d0, cWovvo(1,1,e,j), spin_occ_num)
end do
end do
end do end do
end do end do
double precision, allocatable :: tmp(:,:,:)
allocate ( tmp(spin_occ_num,spin_vir_num,spin_vir_num) )
do j=1,spin_occ_num do j=1,spin_occ_num
do f=1,spin_vir_num do f=1,spin_vir_num
do b=1,spin_vir_num do b=1,spin_vir_num
do n=1,spin_occ_num do n=1,spin_occ_num
x = 0.5d0*t2_cc(j,n,f,b) + t1_cc(j,f)*t1_cc(n,b) tmp(n,b,f) = - 0.5d0*t2_cc(j,n,f,b) - t1_cc(j,f)*t1_cc(n,b)
enddo
enddo
enddo
do f=1,spin_vir_num
do e=1,spin_vir_num
call dgemm('N','N', &
spin_occ_num, spin_vir_num, spin_occ_num, &
1.d0, OOVV(1,1,e,f), spin_occ_num, &
tmp(1,1,f), spin_occ_num, &
1.d0, cWovvo(1,1,e,j), spin_occ_num)
enddo
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, cWovvo_prime, (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 :: m,b,e,j
do j=1,spin_occ_num
do b=1,spin_vir_num
do e=1,spin_vir_num do e=1,spin_vir_num
do m=1,spin_occ_num do m=1,spin_occ_num
cWovvo_prime(m,e,b,j) = cWovvo_prime(m,e,b,j) - x *OOVV(m,n,e,f) cWovvo_prime(m,e,b,j) = cWovvo(m,b,e,j)
end do
end do
end do end do
end do end do
end do end do
end do end do
END_PROVIDER END_PROVIDER

View File

@ -9,47 +9,48 @@ BEGIN_PROVIDER [ double precision, r1_cc, (spin_occ_num,spin_vir_num) ]
r1_cc(:,:) = spin_fock_matrix_mo_ov(:,:) r1_cc(:,:) = spin_fock_matrix_mo_ov(:,:)
do i=1,spin_occ_num call dgemm('N','T', &
spin_occ_num, spin_vir_num, spin_vir_num, &
1.d0, t1_cc, size(t1_cc,1), &
c_spin_fock_matrix_mo_vv, size(c_spin_fock_matrix_mo_vv,1), &
1.d0, r1_cc, size(r1_cc,1))
call dgemm('T','N', &
spin_occ_num, spin_vir_num, spin_occ_num, &
-1.d0, c_spin_fock_matrix_mo_oo, size(c_spin_fock_matrix_mo_oo,1),&
t1_cc, size(t1_cc,1), &
1.d0, r1_cc, size(r1_cc,1))
call dgemv('T', spin_occ_num*spin_vir_num, &
spin_occ_num*spin_vir_num, &
1.d0, t2_cc2, spin_occ_num*spin_vir_num, &
c_spin_fock_matrix_mo_ov, 1, &
1.d0, r1_cc, 1)
double precision, external :: u_dot_v
do f=1,spin_vir_num
do a=1,spin_vir_num do a=1,spin_vir_num
do i=1,spin_occ_num
r1_cc(i,a) = r1_cc(i,a) - u_dot_v(t1_cc(1,f), OVOV(1,a,i,f),spin_occ_num)
end do
end do
do e=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) call dgemm('N','N', &
end do spin_occ_num, spin_vir_num, spin_occ_num, &
-0.5d0, t2_cc(1,1,e,f), spin_occ_num, &
OVVV(1,1,e,f), spin_occ_num, &
1.d0, r1_cc, spin_occ_num)
enddo
enddo
do m=1,spin_occ_num call dgemm('T','N', &
r1_cc(i,a) = r1_cc(i,a) - t1_cc(m,a)*c_spin_fock_matrix_mo_oo(m,i) spin_occ_num, spin_vir_num, spin_occ_num*spin_occ_num*spin_vir_num, &
end do -0.5d0, OOVO, spin_occ_num*spin_occ_num*spin_vir_num, &
t2_cc, spin_occ_num*spin_occ_num*spin_vir_num, &
do m=1,spin_occ_num 1.d0, r1_cc, 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 ! Final expression for t1 residue