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

72 lines
1.9 KiB
Fortran
Raw Normal View History

2019-01-25 11:39:31 +01:00
BEGIN_PROVIDER [double precision, big_array_coulomb_integrals, (mo_num,mo_num, mo_num)]
&BEGIN_PROVIDER [double precision, big_array_exchange_integrals,(mo_num,mo_num, mo_num)]
implicit none
BEGIN_DOC
2021-02-09 12:02:14 +01:00
! big_array_coulomb_integrals(j,i,k) = <ij|kj> = (ik|jj)
2019-01-25 11:39:31 +01:00
!
2023-05-17 16:55:29 +02:00
! big_array_exchange_integrals(j,i,k) = <ij|jk> = (ij|kj)
2019-01-25 11:39:31 +01:00
END_DOC
2023-05-17 16:55:29 +02:00
integer :: i,j,k,l,a
2019-01-25 11:39:31 +01:00
double precision :: get_two_e_integral
double precision :: integral
2023-05-17 16:55:29 +02:00
if (do_ao_cholesky) then
double precision, allocatable :: buffer_jj(:,:), buffer(:,:,:)
2023-07-12 12:34:48 +02:00
allocate(buffer_jj(cholesky_mo_num,mo_num), buffer(mo_num,mo_num,mo_num))
2023-05-17 16:55:29 +02:00
do j=1,mo_num
buffer_jj(:,j) = cholesky_mo_transp(:,j,j)
enddo
2023-07-12 12:34:48 +02:00
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, &
2023-05-17 16:55:29 +02:00
buffer, mo_num*mo_num)
do k = 1, mo_num
do i = 1, mo_num
do j = 1, mo_num
big_array_coulomb_integrals(j,i,k) = buffer(i,k,j)
enddo
enddo
enddo
deallocate(buffer_jj)
allocate(buffer_jj(mo_num,mo_num))
do j = 1, mo_num
2023-07-12 12:34:48 +02:00
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, &
2023-05-17 16:55:29 +02:00
buffer_jj, mo_num)
do k=1,mo_num
do i=1,mo_num
big_array_exchange_integrals(j,i,k) = buffer_jj(i,k)
enddo
enddo
enddo
deallocate(buffer_jj)
else
do k = 1, mo_num
do i = 1, mo_num
do j = 1, mo_num
l = j
integral = get_two_e_integral(i,j,k,l,mo_integrals_map)
big_array_coulomb_integrals(j,i,k) = integral
l = j
integral = get_two_e_integral(i,j,l,k,mo_integrals_map)
big_array_exchange_integrals(j,i,k) = integral
enddo
enddo
2019-01-25 11:39:31 +01:00
enddo
2023-05-17 16:55:29 +02:00
endif
2019-01-25 11:39:31 +01:00
END_PROVIDER