9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-21 11:03:29 +01:00

Reduced memory in CCSD

This commit is contained in:
Anthony Scemama 2023-07-12 12:34:48 +02:00
parent 0aed20f53a
commit d4574f24d9
5 changed files with 139 additions and 131 deletions

View File

@ -209,9 +209,9 @@ subroutine compute_r1_space_chol(nO,nV,t1,t2,tau,H_oo,H_vv,H_vo,r1,max_r1)
do iblock = 1, nV, block_size
nVmax = min(block_size,nV-iblock+1)
call dgemm('T','N', nV*nO, nV*nVmax, cholesky_ao_num, 1.d0, &
cc_space_v_vo_chol , cholesky_ao_num, &
cc_space_v_vv_chol(1,1,iblock), cholesky_ao_num, &
call dgemm('T','N', nV*nO, nV*nVmax, cholesky_mo_num, 1.d0, &
cc_space_v_vo_chol , cholesky_mo_num, &
cc_space_v_vv_chol(1,1,iblock), cholesky_mo_num, &
0.d0, W_vvov_tmp, nV*nO)
!$omp parallel &
@ -304,7 +304,7 @@ subroutine compute_H_oo_chol(nO,nV,tau_x,H_oo)
double precision, allocatable :: tau_kau(:,:,:), tmp_vov(:,:,:)
allocate(tau_kau(cholesky_ao_num,nV,nO))
allocate(tau_kau(cholesky_mo_num,nV,nO))
!$omp parallel &
!$omp default(shared) &
!$omp private(i,u,j,k,a,b,tmp_vov)
@ -318,9 +318,9 @@ subroutine compute_H_oo_chol(nO,nV,tau_x,H_oo)
enddo
enddo
enddo
call dgemm('N','T',cholesky_ao_num,nV,nO*nV,1.d0, &
cc_space_v_ov_chol, cholesky_ao_num, tmp_vov, nV, &
0.d0, tau_kau(1,1,u), cholesky_ao_num)
call dgemm('N','T',cholesky_mo_num,nV,nO*nV,1.d0, &
cc_space_v_ov_chol, cholesky_mo_num, tmp_vov, nV, &
0.d0, tau_kau(1,1,u), cholesky_mo_num)
enddo
!$omp end do nowait
deallocate(tmp_vov)
@ -333,8 +333,8 @@ subroutine compute_H_oo_chol(nO,nV,tau_x,H_oo)
!$omp end do nowait
!$omp barrier
!$omp end parallel
call dgemm('T', 'N', nO, nO, cholesky_ao_num*nV, 1.d0, &
tau_kau, cholesky_ao_num*nV, cc_space_v_vo_chol, cholesky_ao_num*nV, &
call dgemm('T', 'N', nO, nO, cholesky_mo_num*nV, 1.d0, &
tau_kau, cholesky_mo_num*nV, cc_space_v_vo_chol, cholesky_mo_num*nV, &
1.d0, H_oo, nO)
end
@ -353,7 +353,7 @@ subroutine compute_H_vv_chol(nO,nV,tau_x,H_vv)
double precision, allocatable :: tau_kia(:,:,:), tmp_oov(:,:,:)
allocate(tau_kia(cholesky_ao_num,nO,nV))
allocate(tau_kia(cholesky_mo_num,nO,nV))
!$omp parallel &
!$omp default(shared) &
!$omp private(i,beta,j,k,a,b,tmp_oov)
@ -367,9 +367,9 @@ subroutine compute_H_vv_chol(nO,nV,tau_x,H_vv)
enddo
enddo
enddo
call dgemm('N','T',cholesky_ao_num,nO,nO*nV,1.d0, &
cc_space_v_ov_chol, cholesky_ao_num, tmp_oov, nO, &
0.d0, tau_kia(1,1,a), cholesky_ao_num)
call dgemm('N','T',cholesky_mo_num,nO,nO*nV,1.d0, &
cc_space_v_ov_chol, cholesky_mo_num, tmp_oov, nO, &
0.d0, tau_kia(1,1,a), cholesky_mo_num)
enddo
!$omp end do nowait
deallocate(tmp_oov)
@ -383,8 +383,8 @@ subroutine compute_H_vv_chol(nO,nV,tau_x,H_vv)
!$omp end do nowait
!$omp barrier
!$omp end parallel
call dgemm('T', 'N', nV, nV, cholesky_ao_num*nO, -1.d0, &
tau_kia, cholesky_ao_num*nO, cc_space_v_ov_chol, cholesky_ao_num*nO, &
call dgemm('T', 'N', nV, nV, cholesky_mo_num*nO, -1.d0, &
tau_kia, cholesky_mo_num*nO, cc_space_v_ov_chol, cholesky_mo_num*nO, &
1.d0, H_vv, nV)
end
@ -407,33 +407,33 @@ subroutine compute_H_vo_chol(nO,nV,t1,H_vo)
enddo
enddo
allocate(tmp_k(cholesky_ao_num))
call dgemm('N', 'N', cholesky_ao_num, 1, nO*nV, 2.d0, &
cc_space_v_ov_chol, cholesky_ao_num, &
t1, nO*nV, 0.d0, tmp_k, cholesky_ao_num)
allocate(tmp_k(cholesky_mo_num))
call dgemm('N', 'N', cholesky_mo_num, 1, nO*nV, 2.d0, &
cc_space_v_ov_chol, cholesky_mo_num, &
t1, nO*nV, 0.d0, tmp_k, cholesky_mo_num)
call dgemm('T','N',nV*nO,1,cholesky_ao_num,1.d0, &
cc_space_v_vo_chol, cholesky_ao_num, tmp_k, cholesky_ao_num, 1.d0, &
call dgemm('T','N',nV*nO,1,cholesky_mo_num,1.d0, &
cc_space_v_vo_chol, cholesky_mo_num, tmp_k, cholesky_mo_num, 1.d0, &
H_vo, nV*nO)
deallocate(tmp_k)
allocate(tmp(cholesky_ao_num,nO,nO))
allocate(tmp2(cholesky_ao_num,nO,nO))
allocate(tmp(cholesky_mo_num,nO,nO))
allocate(tmp2(cholesky_mo_num,nO,nO))
call dgemm('N','T', cholesky_ao_num*nO, nO, nV, 1.d0, &
cc_space_v_ov_chol, cholesky_ao_num*nO, t1, nO, 0.d0, tmp, cholesky_ao_num*nO)
call dgemm('N','T', cholesky_mo_num*nO, nO, nV, 1.d0, &
cc_space_v_ov_chol, cholesky_mo_num*nO, t1, nO, 0.d0, tmp, cholesky_mo_num*nO)
do i=1,nO
do j=1,nO
do k=1,cholesky_ao_num
do k=1,cholesky_mo_num
tmp2(k,j,i) = tmp(k,i,j)
enddo
enddo
enddo
deallocate(tmp)
call dgemm('T','N', nV, nO, cholesky_ao_num*nO, -1.d0, &
cc_space_v_ov_chol, cholesky_ao_num*nO, tmp2, cholesky_ao_num*nO, &
call dgemm('T','N', nV, nO, cholesky_mo_num*nO, -1.d0, &
cc_space_v_ov_chol, cholesky_mo_num*nO, tmp2, cholesky_mo_num*nO, &
1.d0, H_vo, nV)
end
@ -491,32 +491,32 @@ subroutine compute_r2_space_chol(nO,nV,t1,t2,tau,H_oo,H_vv,H_vo,r2,max_r2)
double precision, dimension(:,:,:), allocatable :: B1, tmp_cc, tmpB1
double precision, dimension(:,:), allocatable :: tmp_cc2
allocate(tmp_cc(cholesky_ao_num,nV,nV))
call dgemm('N','N', cholesky_ao_num*nV, nV, nO, 1.d0, &
cc_space_v_vo_chol, cholesky_ao_num*nV, t1, nO, 0.d0, tmp_cc, cholesky_ao_num*nV)
allocate(tmp_cc(cholesky_mo_num,nV,nV))
call dgemm('N','N', cholesky_mo_num*nV, nV, nO, 1.d0, &
cc_space_v_vo_chol, cholesky_mo_num*nV, t1, nO, 0.d0, tmp_cc, cholesky_mo_num*nV)
call set_multiple_levels_omp(.False.)
!$OMP PARALLEL PRIVATE(gam, iblock, B1, tmpB1, tmp_cc2, beta, b, a)
allocate(B1(nV,nV,block_size), tmpB1(nV,block_size,nV), tmp_cc2(cholesky_ao_num,nV))
allocate(B1(nV,nV,block_size), tmpB1(nV,block_size,nV), tmp_cc2(cholesky_mo_num,nV))
!$OMP DO
do gam = 1, nV
do iblock = 1, nV, block_size
call dgemm('T', 'N', nV*min(block_size, nV-iblock+1), nV, cholesky_ao_num, &
-1.d0, tmp_cc(1,1,iblock), cholesky_ao_num, &
cc_space_v_vv_chol(1,1,gam), cholesky_ao_num, &
call dgemm('T', 'N', nV*min(block_size, nV-iblock+1), nV, cholesky_mo_num, &
-1.d0, tmp_cc(1,1,iblock), cholesky_mo_num, &
cc_space_v_vv_chol(1,1,gam), cholesky_mo_num, &
0.d0, tmpB1, nV*block_size)
do a=1,nV
do k=1,cholesky_ao_num
do k=1,cholesky_mo_num
tmp_cc2(k,a) = cc_space_v_vv_chol(k,a,gam) - tmp_cc(k,a,gam)
enddo
enddo
call dgemm('T','N', nV*min(block_size, nV-iblock+1), nV, cholesky_ao_num, 1.d0, &
cc_space_v_vv_chol(1,1,iblock), cholesky_ao_num, &
tmp_cc2, cholesky_ao_num, &
call dgemm('T','N', nV*min(block_size, nV-iblock+1), nV, cholesky_mo_num, 1.d0, &
cc_space_v_vv_chol(1,1,iblock), cholesky_mo_num, &
tmp_cc2, cholesky_mo_num, &
1.d0, tmpB1, nV*block_size)
do beta = iblock, min(nV, iblock+block_size-1)
@ -630,9 +630,9 @@ subroutine compute_r2_space_chol(nO,nV,t1,t2,tau,H_oo,H_vv,H_vo,r2,max_r2)
do iblock = 1, nV, block_size
do gam = iblock, min(nV, iblock+block_size-1)
call dgemm('T','N',nV, nO*nV, cholesky_ao_num, 1.d0, &
cc_space_v_vv_chol(1,1,gam), cholesky_ao_num, cc_space_v_ov_chol, &
cholesky_ao_num, 0.d0, X_vovv(1,1,1,gam-iblock+1), nV)
call dgemm('T','N',nV, nO*nV, cholesky_mo_num, 1.d0, &
cc_space_v_vv_chol(1,1,gam), cholesky_mo_num, cc_space_v_ov_chol, &
cholesky_mo_num, 0.d0, X_vovv(1,1,1,gam-iblock+1), nV)
enddo
call dgemm('N','N',nO,nO*nV*min(block_size, nV-iblock+1),nV, &
@ -663,19 +663,19 @@ subroutine compute_r2_space_chol(nO,nV,t1,t2,tau,H_oo,H_vv,H_vo,r2,max_r2)
double precision, allocatable :: X_ovvo(:,:,:,:)
double precision, allocatable :: tcc(:,:,:), tcc2(:,:,:)
allocate(tcc2(cholesky_ao_num,nV,nO), X_ovvo(nO,nV,nV,nO))
allocate(tcc(cholesky_ao_num,nO,nV))
allocate(tcc2(cholesky_mo_num,nV,nO), X_ovvo(nO,nV,nV,nO))
allocate(tcc(cholesky_mo_num,nO,nV))
call dgemm('N','T', cholesky_ao_num*nV, nO, nV, 1.d0, &
cc_space_v_vv_chol, cholesky_ao_num*nV, t1, nO, &
0.d0, tcc2, cholesky_ao_num*nV)
call dgemm('N','T', cholesky_mo_num*nV, nO, nV, 1.d0, &
cc_space_v_vv_chol, cholesky_mo_num*nV, t1, nO, &
0.d0, tcc2, cholesky_mo_num*nV)
call dgemm('N','N', cholesky_ao_num*nO, nV, nO, 1.d0, &
cc_space_v_oo_chol, cholesky_ao_num*nO, t1, nO, &
0.d0, tcc, cholesky_ao_num*nO)
call dgemm('N','N', cholesky_mo_num*nO, nV, nO, 1.d0, &
cc_space_v_oo_chol, cholesky_mo_num*nO, t1, nO, &
0.d0, tcc, cholesky_mo_num*nO)
call dgemm('T','N', nO*nV, nV*nO, cholesky_ao_num, 1.d0, &
tcc, cholesky_ao_num, tcc2, cholesky_ao_num, 0.d0, &
call dgemm('T','N', nO*nV, nV*nO, cholesky_mo_num, 1.d0, &
tcc, cholesky_mo_num, tcc2, cholesky_mo_num, 0.d0, &
X_ovvo, nO*nV)
deallocate(tcc, tcc2)
@ -1160,23 +1160,23 @@ subroutine compute_g_vir_chol(nO,nV,t1,t2,H_vv,g_vir)
0d0, g_vir, size(g_vir,1))
double precision, allocatable :: tmp_k(:), tmp_vo(:,:,:), tmp_vo2(:,:,:)
allocate(tmp_k(cholesky_ao_num))
call dgemm('N','N', cholesky_ao_num, 1, nO*nV, 1.d0, &
cc_space_v_ov_chol, cholesky_ao_num, t1, nO*nV, 0.d0, tmp_k, cholesky_ao_num)
allocate(tmp_k(cholesky_mo_num))
call dgemm('N','N', cholesky_mo_num, 1, nO*nV, 1.d0, &
cc_space_v_ov_chol, cholesky_mo_num, t1, nO*nV, 0.d0, tmp_k, cholesky_mo_num)
call dgemm('T','N', nV*nV, 1, cholesky_ao_num, 2.d0, &
cc_space_v_vv_chol, cholesky_ao_num, tmp_k, cholesky_ao_num, 1.d0, &
call dgemm('T','N', nV*nV, 1, cholesky_mo_num, 2.d0, &
cc_space_v_vv_chol, cholesky_mo_num, tmp_k, cholesky_mo_num, 1.d0, &
g_vir, nV*nV)
deallocate(tmp_k)
allocate(tmp_vo(cholesky_ao_num,nV,nO))
call dgemm('N','T',cholesky_ao_num*nV, nO, nV, 1.d0, &
cc_space_v_vv_chol, cholesky_ao_num*nV, t1, nO, 0.d0, tmp_vo, cholesky_ao_num*nV)
allocate(tmp_vo(cholesky_mo_num,nV,nO))
call dgemm('N','T',cholesky_mo_num*nV, nO, nV, 1.d0, &
cc_space_v_vv_chol, cholesky_mo_num*nV, t1, nO, 0.d0, tmp_vo, cholesky_mo_num*nV)
allocate(tmp_vo2(cholesky_ao_num,nO,nV))
allocate(tmp_vo2(cholesky_mo_num,nO,nV))
do beta=1,nV
do i=1,nO
do k=1,cholesky_ao_num
do k=1,cholesky_mo_num
tmp_vo2(k,i,beta) = -tmp_vo(k,beta,i)
enddo
enddo
@ -1189,9 +1189,9 @@ subroutine compute_g_vir_chol(nO,nV,t1,t2,H_vv,g_vir)
enddo
enddo
call dgemm('T','N', nV, nV, nO*cholesky_ao_num, 1.d0, &
cc_space_v_ov_chol, cholesky_ao_num*nO, &
tmp_vo2, cholesky_ao_num*nO, 1.d0, g_vir, nV)
call dgemm('T','N', nV, nV, nO*cholesky_mo_num, 1.d0, &
cc_space_v_ov_chol, cholesky_mo_num*nO, &
tmp_vo2, cholesky_mo_num*nO, 1.d0, g_vir, nV)
end
@ -1265,15 +1265,15 @@ subroutine compute_J1_chol(nO,nV,t1,t2,v_ovvo,v_ovoo,v_vvoo,J1)
deallocate(X_ovoo)
double precision, allocatable :: tmp_cc(:,:,:), J1_tmp(:,:,:,:)
allocate(tmp_cc(cholesky_ao_num,nV,nO), J1_tmp(nV,nO,nV,nO))
allocate(tmp_cc(cholesky_mo_num,nV,nO), J1_tmp(nV,nO,nV,nO))
call dgemm('N','T', cholesky_ao_num*nV, nO, nV, 1.d0, &
cc_space_v_vv_chol, cholesky_ao_num*nV, &
call dgemm('N','T', cholesky_mo_num*nV, nO, nV, 1.d0, &
cc_space_v_vv_chol, cholesky_mo_num*nV, &
t1, nO, &
0.d0, tmp_cc, cholesky_ao_num*nV)
0.d0, tmp_cc, cholesky_mo_num*nV)
call dgemm('T','N', nV*nO, nV*nO, cholesky_ao_num, 1.d0, &
tmp_cc, cholesky_ao_num, cc_space_v_vo_chol, cholesky_ao_num, &
call dgemm('T','N', nV*nO, nV*nO, cholesky_mo_num, 1.d0, &
tmp_cc, cholesky_mo_num, cc_space_v_vo_chol, cholesky_mo_num, &
0.d0, J1_tmp, nV*nO)
deallocate(tmp_cc)
@ -1464,14 +1464,14 @@ subroutine compute_K1_chol(nO,nV,t1,t2,v_ovoo,v_vvoo,v_ovov,K1)
1d0, K1 , size(K1,1) * size(K1,2) * size(K1,3))
double precision, allocatable :: K1tmp(:,:,:,:), t1v(:,:,:)
allocate(K1tmp(nO,nO,nV,nV), t1v(cholesky_ao_num,nO,nO))
allocate(K1tmp(nO,nO,nV,nV), t1v(cholesky_mo_num,nO,nO))
call dgemm('N','T', cholesky_ao_num*nO, nO, nV, 1.d0, &
cc_space_v_ov_chol, cholesky_ao_num*nO, t1, nO, 0.d0, &
t1v, cholesky_ao_num*nO)
call dgemm('N','T', cholesky_mo_num*nO, nO, nV, 1.d0, &
cc_space_v_ov_chol, cholesky_mo_num*nO, t1, nO, 0.d0, &
t1v, cholesky_mo_num*nO)
call dgemm('T','N', nO*nO, nV*nV, cholesky_ao_num, 1.d0, &
t1v, cholesky_ao_num, cc_space_v_vv_chol, cholesky_ao_num, 0.d0, &
call dgemm('T','N', nO*nO, nV*nV, cholesky_mo_num, 1.d0, &
t1v, cholesky_mo_num, cc_space_v_vv_chol, cholesky_mo_num, 0.d0, &
K1tmp, nO*nO)
deallocate(t1v)

View File

@ -1,4 +1,12 @@
BEGIN_PROVIDER [ double precision, cholesky_mo, (mo_num, mo_num, cholesky_ao_num) ]
BEGIN_PROVIDER [ integer, cholesky_mo_num ]
implicit none
BEGIN_DOC
! Number of Cholesky vectors in MO basis
END_DOC
cholesky_mo_num = cholesky_ao_num
END_PROVIDER
BEGIN_PROVIDER [ double precision, cholesky_mo, (mo_num, mo_num, cholesky_mo_num) ]
implicit none
BEGIN_DOC
! Cholesky vectors in MO basis
@ -8,7 +16,7 @@ BEGIN_PROVIDER [ double precision, cholesky_mo, (mo_num, mo_num, cholesky_ao_num
call set_multiple_levels_omp(.False.)
!$OMP PARALLEL DO PRIVATE(k)
do k=1,cholesky_ao_num
do k=1,cholesky_mo_num
do j=1,mo_num
do i=1,mo_num
cholesky_mo(i,j,k) = cholesky_mo_transp(k,i,j)
@ -19,7 +27,7 @@ BEGIN_PROVIDER [ double precision, cholesky_mo, (mo_num, mo_num, cholesky_ao_num
END_PROVIDER
BEGIN_PROVIDER [ double precision, cholesky_mo_transp, (cholesky_ao_num, mo_num, mo_num) ]
BEGIN_PROVIDER [ double precision, cholesky_mo_transp, (cholesky_mo_num, mo_num, mo_num) ]
implicit none
BEGIN_DOC
! Cholesky vectors in MO basis
@ -29,14 +37,14 @@ BEGIN_PROVIDER [ double precision, cholesky_mo_transp, (cholesky_ao_num, mo_num,
integer :: ierr
print *, 'AO->MO Transformation of Cholesky vectors'
allocate(X(mo_num,cholesky_ao_num,ao_num), stat=ierr)
allocate(X(mo_num,cholesky_mo_num,ao_num), stat=ierr)
if (ierr /= 0) then
print *, irp_here, ': Allocation failed'
endif
call dgemm('T','N', ao_num*cholesky_ao_num, mo_num, ao_num, 1.d0, &
cholesky_ao, ao_num, mo_coef, ao_num, 0.d0, X, ao_num*cholesky_ao_num)
call dgemm('T','N', cholesky_ao_num*mo_num, mo_num, ao_num, 1.d0, &
X, ao_num, mo_coef, ao_num, 0.d0, cholesky_mo_transp, cholesky_ao_num*mo_num)
call dgemm('T','N', ao_num*cholesky_mo_num, mo_num, ao_num, 1.d0, &
cholesky_ao, ao_num, mo_coef, ao_num, 0.d0, X, ao_num*cholesky_mo_num)
call dgemm('T','N', cholesky_mo_num*mo_num, mo_num, ao_num, 1.d0, &
X, ao_num, mo_coef, ao_num, 0.d0, cholesky_mo_transp, cholesky_mo_num*mo_num)
deallocate(X)
END_PROVIDER

View File

@ -13,14 +13,14 @@
if (do_ao_cholesky) then
double precision, allocatable :: buffer_jj(:,:), buffer(:,:,:)
allocate(buffer_jj(cholesky_ao_num,mo_num), buffer(mo_num,mo_num,mo_num))
allocate(buffer_jj(cholesky_mo_num,mo_num), buffer(mo_num,mo_num,mo_num))
do j=1,mo_num
buffer_jj(:,j) = cholesky_mo_transp(:,j,j)
enddo
call dgemm('T','N', mo_num*mo_num,mo_num,cholesky_ao_num, 1.d0, &
cholesky_mo_transp, cholesky_ao_num, &
buffer_jj, cholesky_ao_num, 0.d0, &
call dgemm('T','N', mo_num*mo_num,mo_num,cholesky_mo_num, 1.d0, &
cholesky_mo_transp, cholesky_mo_num, &
buffer_jj, cholesky_mo_num, 0.d0, &
buffer, mo_num*mo_num)
do k = 1, mo_num
@ -36,9 +36,9 @@
do j = 1, mo_num
call dgemm('T','N',mo_num,mo_num,cholesky_ao_num, 1.d0, &
cholesky_mo_transp(1,1,j), cholesky_ao_num, &
cholesky_mo_transp(1,1,j), cholesky_ao_num, 0.d0, &
call dgemm('T','N',mo_num,mo_num,cholesky_mo_num, 1.d0, &
cholesky_mo_transp(1,1,j), cholesky_mo_num, &
cholesky_mo_transp(1,1,j), cholesky_mo_num, 0.d0, &
buffer_jj, mo_num)
do k=1,mo_num

View File

@ -479,9 +479,9 @@ subroutine add_integrals_to_map_cholesky
!$OMP DO SCHEDULE(dynamic)
do l=1,mo_num
call dgemm('T','N',mo_num*mo_num,mo_num,cholesky_ao_num,1.d0, &
cholesky_mo_transp, cholesky_ao_num, &
cholesky_mo_transp(1,1,l), cholesky_ao_num, 0.d0, &
call dgemm('T','N',mo_num*mo_num,mo_num,cholesky_mo_num,1.d0, &
cholesky_mo_transp, cholesky_mo_num, &
cholesky_mo_transp(1,1,l), cholesky_mo_num, 0.d0, &
Vtmp, mo_num*mo_num)
do k=1,l
@ -1364,20 +1364,20 @@ END_PROVIDER
if (do_ao_cholesky) then
double precision, allocatable :: buffer(:,:)
allocate (buffer(cholesky_ao_num,mo_num))
do k=1,cholesky_ao_num
allocate (buffer(cholesky_mo_num,mo_num))
do k=1,cholesky_mo_num
do i=1,mo_num
buffer(k,i) = cholesky_mo_transp(k,i,i)
enddo
enddo
call dgemm('T','N',mo_num,mo_num,cholesky_ao_num,1.d0, &
buffer, cholesky_ao_num, buffer, cholesky_ao_num, 0.d0, mo_two_e_integrals_jj, mo_num)
call dgemm('T','N',mo_num,mo_num,cholesky_mo_num,1.d0, &
buffer, cholesky_mo_num, buffer, cholesky_mo_num, 0.d0, mo_two_e_integrals_jj, mo_num)
deallocate(buffer)
do j=1,mo_num
do i=1,mo_num
mo_two_e_integrals_jj_exchange(i,j) = 0.d0
do k=1,cholesky_ao_num
do k=1,cholesky_mo_num
mo_two_e_integrals_jj_exchange(i,j) = mo_two_e_integrals_jj_exchange(i,j) + &
cholesky_mo_transp(k,i,j)*cholesky_mo_transp(k,j,i)
enddo

View File

@ -50,15 +50,15 @@ subroutine gen_v_space(n1,n2,n3,n4,list1,list2,list3,list4,v)
if (do_ao_cholesky) then
double precision, allocatable :: buffer(:,:,:,:)
double precision, allocatable :: v1(:,:,:), v2(:,:,:)
allocate(v1(cholesky_ao_num,n1,n3), v2(cholesky_ao_num,n2,n4))
allocate(v1(cholesky_mo_num,n1,n3), v2(cholesky_mo_num,n2,n4))
allocate(buffer(n1,n3,n2,n4))
call gen_v_space_chol(n1,n3,list1,list3,v1,cholesky_ao_num)
call gen_v_space_chol(n2,n4,list2,list4,v2,cholesky_ao_num)
call gen_v_space_chol(n1,n3,list1,list3,v1,cholesky_mo_num)
call gen_v_space_chol(n2,n4,list2,list4,v2,cholesky_mo_num)
call dgemm('T','N', n1*n3, n2*n4, cholesky_ao_num, 1.d0, &
v1, cholesky_ao_num, &
v2, cholesky_ao_num, 0.d0, buffer, n1*n3)
call dgemm('T','N', n1*n3, n2*n4, cholesky_mo_num, 1.d0, &
v1, cholesky_mo_num, &
v2, cholesky_mo_num, 0.d0, buffer, n1*n3)
deallocate(v1,v2)
@ -119,7 +119,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv)
idx3 = list3(i3)
do i1=1,n1
idx1 = list1(i1)
do k=1,cholesky_ao_num
do k=1,cholesky_mo_num
v(k,i1,i3) = cholesky_mo_transp(k,idx1,idx3)
enddo
enddo
@ -137,15 +137,15 @@ BEGIN_PROVIDER [double precision, cc_space_v, (mo_num,mo_num,mo_num,mo_num)]
double precision, allocatable :: buffer(:,:,:)
call set_multiple_levels_omp(.False.)
!$OMP PARALLEL &
!$OMP SHARED(cc_space_v,mo_num,cholesky_mo_transp,cholesky_ao_num) &
!$OMP SHARED(cc_space_v,mo_num,cholesky_mo_transp,cholesky_mo_num) &
!$OMP PRIVATE(i1,i2,i3,i4,k,buffer)&
!$OMP DEFAULT(NONE)
allocate(buffer(mo_num,mo_num,mo_num))
!$OMP DO
do i4 = 1, mo_num
call dgemm('T','N', mo_num*mo_num, mo_num, cholesky_ao_num, 1.d0, &
cholesky_mo_transp, cholesky_ao_num, &
cholesky_mo_transp(1,1,i4), cholesky_ao_num, 0.d0, buffer, mo_num*mo_num)
call dgemm('T','N', mo_num*mo_num, mo_num, cholesky_mo_num, 1.d0, &
cholesky_mo_transp, cholesky_mo_num, &
cholesky_mo_transp(1,1,i4), cholesky_mo_num, 0.d0, buffer, mo_num*mo_num)
do i2 = 1, mo_num
do i3 = 1, mo_num
do i1 = 1, mo_num
@ -203,9 +203,9 @@ BEGIN_PROVIDER [double precision, cc_space_v_oooo, (cc_nOa, cc_nOa, cc_nOa, cc_n
double precision, allocatable :: buffer(:,:,:,:)
allocate(buffer(n1,n3,n2,n4))
call dgemm('T','N', n1*n3, n2*n4, cholesky_ao_num, 1.d0, &
cc_space_v_oo_chol, cholesky_ao_num, &
cc_space_v_oo_chol, cholesky_ao_num, 0.d0, buffer, n1*n3)
call dgemm('T','N', n1*n3, n2*n4, cholesky_mo_num, 1.d0, &
cc_space_v_oo_chol, cholesky_mo_num, &
cc_space_v_oo_chol, cholesky_mo_num, 0.d0, buffer, n1*n3)
!$OMP PARALLEL DO PRIVATE(i1,i2,i3,i4) COLLAPSE(2)
do i4 = 1, n4
@ -246,9 +246,9 @@ BEGIN_PROVIDER [double precision, cc_space_v_vooo, (cc_nVa, cc_nOa, cc_nOa, cc_n
double precision, allocatable :: buffer(:,:,:,:)
allocate(buffer(n1,n3,n2,n4))
call dgemm('T','N', n1*n3, n2*n4, cholesky_ao_num, 1.d0, &
cc_space_v_vo_chol, cholesky_ao_num, &
cc_space_v_oo_chol, cholesky_ao_num, 0.d0, buffer, n1*n3)
call dgemm('T','N', n1*n3, n2*n4, cholesky_mo_num, 1.d0, &
cc_space_v_vo_chol, cholesky_mo_num, &
cc_space_v_oo_chol, cholesky_mo_num, 0.d0, buffer, n1*n3)
!$OMP PARALLEL DO PRIVATE(i1,i2,i3,i4) COLLAPSE(2)
do i4 = 1, n4
@ -392,9 +392,9 @@ BEGIN_PROVIDER [double precision, cc_space_v_vvoo, (cc_nVa, cc_nVa, cc_nOa, cc_n
double precision, allocatable :: buffer(:,:,:,:)
allocate(buffer(n1,n3,n2,n4))
call dgemm('T','N', n1*n3, n2*n4, cholesky_ao_num, 1.d0, &
cc_space_v_vo_chol, cholesky_ao_num, &
cc_space_v_vo_chol, cholesky_ao_num, 0.d0, buffer, n1*n3)
call dgemm('T','N', n1*n3, n2*n4, cholesky_mo_num, 1.d0, &
cc_space_v_vo_chol, cholesky_mo_num, &
cc_space_v_vo_chol, cholesky_mo_num, 0.d0, buffer, n1*n3)
!$OMP PARALLEL DO PRIVATE(i1,i2,i3,i4) COLLAPSE(2)
do i4 = 1, n4
@ -435,9 +435,9 @@ BEGIN_PROVIDER [double precision, cc_space_v_vovo, (cc_nVa, cc_nOa, cc_nVa, cc_n
double precision, allocatable :: buffer(:,:,:,:)
allocate(buffer(n1,n3,n2,n4))
call dgemm('T','N', n1*n3, n2*n4, cholesky_ao_num, 1.d0, &
cc_space_v_vv_chol, cholesky_ao_num, &
cc_space_v_oo_chol, cholesky_ao_num, 0.d0, buffer, n1*n3)
call dgemm('T','N', n1*n3, n2*n4, cholesky_mo_num, 1.d0, &
cc_space_v_vv_chol, cholesky_mo_num, &
cc_space_v_oo_chol, cholesky_mo_num, 0.d0, buffer, n1*n3)
!$OMP PARALLEL DO PRIVATE(i1,i2,i3,i4) COLLAPSE(2)
do i4 = 1, n4
@ -645,35 +645,35 @@ BEGIN_PROVIDER [double precision, cc_space_v_vvvv, (cc_nVa, cc_nVa, cc_nVa, cc_n
END_PROVIDER
BEGIN_PROVIDER [double precision, cc_space_v_vv_chol, (cholesky_ao_num, cc_nVa, cc_nVa)]
BEGIN_PROVIDER [double precision, cc_space_v_vv_chol, (cholesky_mo_num, cc_nVa, cc_nVa)]
implicit none
call gen_v_space_chol(cc_nVa, cc_nVa, cc_list_vir, cc_list_vir, cc_space_v_vv_chol, cholesky_ao_num)
call gen_v_space_chol(cc_nVa, cc_nVa, cc_list_vir, cc_list_vir, cc_space_v_vv_chol, cholesky_mo_num)
END_PROVIDER
BEGIN_PROVIDER [double precision, cc_space_v_vo_chol, (cholesky_ao_num, cc_nVa, cc_nOa)]
BEGIN_PROVIDER [double precision, cc_space_v_vo_chol, (cholesky_mo_num, cc_nVa, cc_nOa)]
implicit none
call gen_v_space_chol(cc_nVa, cc_nOa, cc_list_vir, cc_list_occ, cc_space_v_vo_chol, cholesky_ao_num)
call gen_v_space_chol(cc_nVa, cc_nOa, cc_list_vir, cc_list_occ, cc_space_v_vo_chol, cholesky_mo_num)
END_PROVIDER
BEGIN_PROVIDER [double precision, cc_space_v_ov_chol, (cholesky_ao_num, cc_nOa, cc_nVa)]
BEGIN_PROVIDER [double precision, cc_space_v_ov_chol, (cholesky_mo_num, cc_nOa, cc_nVa)]
implicit none
call gen_v_space_chol(cc_nOa, cc_nVa, cc_list_occ, cc_list_vir, cc_space_v_ov_chol, cholesky_ao_num)
call gen_v_space_chol(cc_nOa, cc_nVa, cc_list_occ, cc_list_vir, cc_space_v_ov_chol, cholesky_mo_num)
END_PROVIDER
BEGIN_PROVIDER [double precision, cc_space_v_oo_chol, (cholesky_ao_num, cc_nOa, cc_nOa)]
BEGIN_PROVIDER [double precision, cc_space_v_oo_chol, (cholesky_mo_num, cc_nOa, cc_nOa)]
implicit none
call gen_v_space_chol(cc_nOa, cc_nOa, cc_list_occ, cc_list_occ, cc_space_v_oo_chol, cholesky_ao_num)
call gen_v_space_chol(cc_nOa, cc_nOa, cc_list_occ, cc_list_occ, cc_space_v_oo_chol, cholesky_mo_num)
END_PROVIDER