4
1
mirror of https://github.com/pfloos/quack synced 2024-11-19 04:22:39 +01:00
quack/src/QuAcK/AOtoMO_integral_transform.f90

90 lines
1.9 KiB
Fortran
Raw Normal View History

2020-09-18 13:52:35 +02:00
subroutine AOtoMO_integral_transform(bra,ket,nBas,c,ERI_AO_basis,ERI_MO_basis)
2019-03-19 10:13:33 +01:00
2020-09-18 13:52:35 +02:00
! AO to MO transformation of two-electron integrals via the semi-direct O(N^5) algorithm
! bra and ket are the spin of (bra|ket)
2019-03-19 10:13:33 +01:00
implicit none
2020-09-18 13:52:35 +02:00
include 'parameters.h'
2019-03-19 10:13:33 +01:00
! Input variables
2020-09-18 13:52:35 +02:00
integer,intent(in) :: bra
integer,intent(in) :: ket
2019-03-19 10:13:33 +01:00
integer,intent(in) :: nBas
2020-09-18 13:52:35 +02:00
double precision,intent(in) :: ERI_AO_basis(nBas,nBas,nBas,nBas),c(nBas,nBas,nspin)
2019-03-19 10:13:33 +01:00
! Local variables
double precision,allocatable :: scr(:,:,:,:)
integer :: mu,nu,la,si,i,j,k,l
! Output variables
double precision,intent(out) :: ERI_MO_basis(nBas,nBas,nBas,nBas)
! Memory allocation
2020-09-18 13:52:35 +02:00
2019-03-19 10:13:33 +01:00
allocate(scr(nBas,nBas,nBas,nBas))
2020-09-18 13:52:35 +02:00
! Four-index transform via semi-direct O(N^5) algorithm
2019-03-19 10:13:33 +01:00
scr(:,:,:,:) = 0d0
do l=1,nBas
do si=1,nBas
do la=1,nBas
do nu=1,nBas
do mu=1,nBas
2020-09-18 13:52:35 +02:00
scr(mu,nu,la,l) = scr(mu,nu,la,l) + ERI_AO_basis(mu,nu,la,si)*c(si,l,ket)
2019-03-19 10:13:33 +01:00
enddo
enddo
enddo
enddo
enddo
ERI_MO_basis(:,:,:,:) = 0d0
do l=1,nBas
do la=1,nBas
do nu=1,nBas
do i=1,nBas
do mu=1,nBas
2020-09-18 13:52:35 +02:00
ERI_MO_basis(i,nu,la,l) = ERI_MO_basis(i,nu,la,l) + c(mu,i,bra)*scr(mu,nu,la,l)
2019-03-19 10:13:33 +01:00
enddo
enddo
enddo
enddo
enddo
scr(:,:,:,:) = 0d0
do l=1,nBas
do k=1,nBas
do la=1,nBas
do nu=1,nBas
do i=1,nBas
2020-09-18 13:52:35 +02:00
scr(i,nu,k,l) = scr(i,nu,k,l) + ERI_MO_basis(i,nu,la,l)*c(la,k,bra)
2019-03-19 10:13:33 +01:00
enddo
enddo
enddo
enddo
enddo
ERI_MO_basis(:,:,:,:) = 0d0
do l=1,nBas
do k=1,nBas
do j=1,nBas
do i=1,nBas
do nu=1,nBas
2020-09-18 13:52:35 +02:00
ERI_MO_basis(i,j,k,l) = ERI_MO_basis(i,j,k,l) + c(nu,j,ket)*scr(i,nu,k,l)
2019-03-19 10:13:33 +01:00
enddo
2020-06-14 13:04:16 +02:00
! print*,i,k,j,l,ERI_MO_basis(i,j,k,l)
2019-03-19 10:13:33 +01:00
enddo
enddo
enddo
enddo
2020-06-09 21:24:37 +02:00
2019-03-19 10:13:33 +01:00
end subroutine AOtoMO_integral_transform