10
1
mirror of https://github.com/pfloos/quack synced 2024-12-22 20:34:46 +01:00

introduce nBas_MOs in AOtoMO_ERI_RHF

This commit is contained in:
Abdallah Ammar 2024-08-28 18:59:55 +02:00
parent d823cdcd20
commit 56db8456b9
8 changed files with 45 additions and 26 deletions

View File

@ -1,4 +1,7 @@
subroutine AOtoMO_ERI_RHF(nBas,c,ERI_AO,ERI_MO)
! ---
subroutine AOtoMO_ERI_RHF(nBas_AOs, nBas_MOs, c, ERI_AO, ERI_MO)
! AO to MO transformation of two-electron integrals via the semi-direct O(N^5) algorithm
@ -7,32 +10,51 @@ subroutine AOtoMO_ERI_RHF(nBas,c,ERI_AO,ERI_MO)
! Input variables
integer,intent(in) :: nBas
double precision,intent(in) :: ERI_AO(nBas,nBas,nBas,nBas)
double precision,intent(in) :: c(nBas,nBas)
integer,intent(in) :: nBas_AOs, nBas_MOs
double precision,intent(in) :: ERI_AO(nBas_AOs,nBas_AOs,nBas_AOs,nBas_AOs)
double precision,intent(in) :: c(nBas_AOs,nBas_MOs)
! Local variables
double precision,allocatable :: scr(:,:,:,:)
integer :: mu,nu,la,si
integer :: i,j,k,l
double precision,allocatable :: a1(:,:,:,:)
double precision,allocatable :: a2(:,:,:,:)
! Output variables
double precision,intent(out) :: ERI_MO(nBas,nBas,nBas,nBas)
double precision,intent(out) :: ERI_MO(nBas_MOs,nBas_MOs,nBas_MOs,nBas_MOs)
! Memory allocation
allocate(scr(nBas,nBas,nBas,nBas))
allocate(a2(nBas_AOs,nBas_AOs,nBas_AOs,nBas_MOs))
allocate(a1(nBas_AOs,nBas_AOs,nBas_MOs,nBas_MOs))
! Four-index transform via semi-direct O(N^5) algorithm
call dgemm('T','N',nBas**3,nBas,nBas,1d0,ERI_AO,nBas,c(1,1),size(c,1),0d0,scr,nBas**3)
call dgemm( 'T', 'N', nBas_AOs*nBas_AOs*nBas_AOs, nBas_MOs, nBas_AOs, 1.d0 &
, ERI_AO(1,1,1,1), nBas_AOs, c(1,1), nBas_AOs &
, 0.d0, a2(1,1,1,1), nBas_AOs*nBas_AOs*nBas_AOs)
call dgemm('T','N',nBas**3,nBas,nBas,1d0,scr,nBas,c(1,1),size(c,1),0d0,ERI_MO,nBas**3)
call dgemm( 'T', 'N', nBas_AOs*nBas_AOs*nBas_MOs, nBas_MOs, nBas_AOs, 1.d0 &
, a2(1,1,1,1), nBas_AOs, c(1,1), nBas_AOs &
, 0.d0, a1(1,1,1,1), nBas_AOs*nBas_AOs*nBas_MOs)
call dgemm('T','N',nBas**3,nBas,nBas,1d0,ERI_MO,nBas,c(1,1),size(c,1),0d0,scr,nBas**3)
deallocate(a2)
allocate(a2(nBas_AOs,nBas_MOs,nBas_MOs,nBas_MOs))
call dgemm('T','N',nBas**3,nBas,nBas,1d0,scr,nBas,c(1,1),size(c,1),0d0,ERI_MO,nBas**3)
call dgemm( 'T', 'N', nBas_AOs*nBas_MOs*nBas_MOs, nBas_MOs, nBas_AOs, 1.d0 &
, a1(1,1,1,1), nBas_AOs, c(1,1), nBas_AOs &
, 0.d0, a2(1,1,1,1), nBas_AOs*nBas_MOs*nBas_MOs)
deallocate(a1)
call dgemm( 'T', 'N', nBas_MOs*nBas_MOs*nBas_MOs, nBas_MOs, nBas_AOs, 1.d0 &
, a2(1,1,1,1), nBas_AOs, c(1,1), nBas_AOs &
, 0.d0, ERI_MO(1,1,1,1), nBas_MOs*nBas_MOs*nBas_MOs)
deallocate(a2)
end subroutine

View File

@ -143,7 +143,7 @@ subroutine qsRGF2(dotest,maxSCF,thresh,max_diis,dophBSE,doppBSE,TDA,dBSE,dTDA,si
! AO to MO transformation of two-electron integrals
call AOtoMO_ERI_RHF(nBas,c,ERI_AO,ERI_MO)
call AOtoMO_ERI_RHF(nBas,nBas,c,ERI_AO,ERI_MO)
! Compute self-energy and renormalization factor

View File

@ -169,7 +169,7 @@ subroutine qsRGTeh(dotest,maxSCF,thresh,max_diis,doACFDT,exchange_kernel,doXBS,d
! AO to MO transformation of two-electron integrals
call AOtoMO_ERI_RHF(nBas,c,ERI_AO,ERI_MO)
call AOtoMO_ERI_RHF(nBas,nBas,c,ERI_AO,ERI_MO)
! Compute linear response

View File

@ -182,7 +182,7 @@ subroutine qsRGTpp(dotest,maxSCF,thresh,max_diis,doACFDT,exchange_kernel,doXBS,d
! AO to MO transformation of two-electron integrals
call AOtoMO_ERI_RHF(nBas,c,ERI_AO,ERI_MO)
call AOtoMO_ERI_RHF(nBas,nBas,c,ERI_AO,ERI_MO)
! Compute linear response

View File

@ -178,7 +178,7 @@ subroutine SRG_qsGW(dotest,maxSCF,thresh,max_diis,doACFDT,exchange_kernel,doXBS,
call AOtoMO(nBas,nBas,cHF,dipole_int_AO(:,:,ixyz),dipole_int_MO(:,:,ixyz))
end do
call AOtoMO_ERI_RHF(nBas,c,ERI_AO,ERI_MO)
call AOtoMO_ERI_RHF(nBas,nBas,c,ERI_AO,ERI_MO)
call wall_time(tao2)

View File

@ -169,7 +169,7 @@ subroutine qsRGW(dotest,maxSCF,thresh,max_diis,doACFDT,exchange_kernel,doXBS,dop
call AOtoMO(nBas,nBas,c,dipole_int_AO(:,:,ixyz),dipole_int_MO(:,:,ixyz))
end do
call AOtoMO_ERI_RHF(nBas,c,ERI_AO,ERI_MO)
call AOtoMO_ERI_RHF(nBas,nBas,c,ERI_AO,ERI_MO)
! Compute linear response

View File

@ -111,7 +111,7 @@ subroutine RHF_search(maxSCF,thresh,max_diis,guess_type,level_shift,nNuc,ZNuc,rN
do ixyz=1,ncart
call AOtoMO(nBas,nBas,c,dipole_int_AO(:,:,ixyz),dipole_int_MO(:,:,ixyz))
end do
call AOtoMO_ERI_RHF(nBas,c,ERI_AO,ERI_MO)
call AOtoMO_ERI_RHF(nBas,nBas,c,ERI_AO,ERI_MO)
call wall_time(end_AOtoMO)
t_AOtoMO = end_AOtoMO - start_AOtoMO

View File

@ -135,7 +135,6 @@ subroutine RQuAcK(dotest,doRHF,doROHF,dostab,dosearch,doMP2,doMP3,doCCD,dopCCD,d
if(doROHF) then
call wall_time(start_HF)
! TODO
call ROHF(dotest, maxSCF_HF, thresh_HF, max_diis_HF, guess_type, mix, level_shift, nNuc, ZNuc, rNuc, ENuc, &
nBas_AOs, nBas_MOs, nO, S, T, V, Hc, ERI_AO, dipole_int_AO, X, ERHF, eHF, cHF, PHF)
call wall_time(end_HF)
@ -159,14 +158,12 @@ subroutine RQuAcK(dotest,doRHF,doROHF,dostab,dosearch,doMP2,doMP3,doCCD,dopCCD,d
! Read and transform dipole-related integrals
do ixyz = 1, ncart
! TODO
call AOtoMO(nBas_AOs,nBas_MOs,cHF,dipole_int_AO(:,:,ixyz),dipole_int_MO(:,:,ixyz))
call AOtoMO(nBas_AOs, nBas_MOs, cHF, dipole_int_AO(1,1,ixyz), dipole_int_MO(1,1,ixyz))
end do
! 4-index transform
! TODO
call AOtoMO_ERI_RHF(nBas_AOs,cHF,ERI_AO,ERI_MO)
call AOtoMO_ERI_RHF(nBas_AOs, nBas_MOs, cHF, ERI_AO, ERI_MO)
call wall_time(end_AOtoMO)