10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-13 17:43:50 +01:00

working on complex 3-index integrals

This commit is contained in:
Kevin Gasperich 2020-02-11 17:35:28 -06:00
parent 8472e71df4
commit 3ca3dc3061
10 changed files with 227 additions and 0 deletions

View File

@ -55,3 +55,8 @@ doc: If |true|, use |AOs| in Cartesian coordinates (6d,10f,...)
interface: ezfio, provider
default: false
[ao_kpt_num]
type: integer
doc: Number of |AOs| per kpt
interface: ezfio

View File

@ -0,0 +1,7 @@
BEGIN_PROVIDER [ integer, ao_kpt_num ]
implicit none
BEGIN_DOC
! number of aos per kpt.
END_DOC
ao_kpt_num = ao_num/kpt_num
END_PROVIDER

View File

@ -23,3 +23,21 @@ type: integer
doc: Size of df basis
interface: ezfio, provider
[io_df_ao_integrals]
type: Disk_access
doc: Read/Write df |AO| integrals from/to disk [ Write | Read | None ]
interface: ezfio,provider,ocaml
default: None
[df_ao_integrals_real]
type: double precision
doc: Real part of the df integrals over AOs
size: (ao_basis.ao_kpt_num,ao_basis.ao_kpt_num,ao_two_e_ints.df_num,nuclei.kpt_pair_num)
interface: ezfio
[df_ao_integrals_imag]
type: double precision
doc: Imaginary part of the df integrals over AOs
size: (ao_basis.ao_kpt_num,ao_basis.ao_kpt_num,ao_two_e_ints.df_num,nuclei.kpt_pair_num)
interface: ezfio

View File

@ -0,0 +1,49 @@
BEGIN_PROVIDER [double precision, df_ao_integrals_real, (ao_kpt_num,ao_kpt_num,df_num,kpt_pair_num)]
&BEGIN_PROVIDER [double precision, df_ao_integrals_imag, (ao_kpt_num,ao_kpt_num,df_num,kpt_pair_num)]
&BEGIN_PROVIDER [complex*16, df_ao_integrals_complex, (ao_kpt_num,ao_kpt_num,df_num,kpt_pair_num)]
implicit none
BEGIN_DOC
! df AO integrals
END_DOC
integer :: i,j,k,l
if (read_df_ao_integrals) then
df_ao_integrals_real = 0.d0
df_ao_integrals_imag = 0.d0
call ezfio_get_ao_two_e_ints_df_ao_integrals_real(df_ao_integrals_real)
call ezfio_get_ao_two_e_ints_df_ao_integrals_imag(df_ao_integrals_imag)
print *, 'df AO integrals read from disk'
do l=1,kpt_pair_num
do k=1,df_num
do j=1,ao_kpt_num
do i=1,ao_kpt_num
df_ao_integrals_complex(i,j,k,l) = dcmplx(df_ao_integrals_real(i,j,k,l), &
df_ao_integrals_imag(i,j,k,l))
enddo
enddo
enddo
enddo
else
print*,'df ao integrals must be provided',irp_here
stop -1
endif
if (write_df_ao_integrals) then
! this probably shouldn't happen
do l=1,kpt_pair_num
do k=1,df_num
do j=1,ao_kpt_num
do i=1,ao_kpt_num
df_ao_integrals_real(i,j,k,l) = dble(df_ao_integrals_complex(i,j,k,l))
df_ao_integrals_imag(i,j,k,l) = dimag(df_ao_integrals_complex(i,j,k,l))
enddo
enddo
enddo
enddo
call ezfio_set_ao_two_e_ints_df_ao_integrals_real(df_ao_integrals_real)
call ezfio_set_ao_two_e_ints_df_ao_integrals_imag(df_ao_integrals_imag)
print *, 'df AO integrals written to disk'
endif
END_PROVIDER

View File

@ -43,3 +43,8 @@ type: character*(32)
doc: MD5 checksum characterizing the |AO| basis set.
interface: ezfio
[mo_kpt_num]
type: integer
doc: Number of |MOs| per kpt
interface: ezfio

View File

@ -1,3 +1,11 @@
BEGIN_PROVIDER [ integer, mo_kpt_num ]
implicit none
BEGIN_DOC
! number of mos per kpt.
END_DOC
mo_kpt_num = mo_num/kpt_num
END_PROVIDER
BEGIN_PROVIDER [ complex*16, mo_coef_complex, (ao_num,mo_num) ]
implicit none
BEGIN_DOC

View File

@ -11,3 +11,21 @@ interface: ezfio,provider,ocaml
default: 1.e-15
ezfio_name: threshold_mo
[io_df_mo_integrals]
type: Disk_access
doc: Read/Write df |MO| integrals from/to disk [ Write | Read | None ]
interface: ezfio,provider,ocaml
default: None
[df_mo_integrals_real]
type: double precision
doc: Real part of the df integrals over MOs
size: (mo_basis.mo_kpt_num,mo_basis.mo_kpt_num,ao_two_e_ints.df_num,nuclei.kpt_pair_num)
interface: ezfio
[df_mo_integrals_imag]
type: double precision
doc: Imaginary part of the df integrals over MOs
size: (mo_basis.mo_kpt_num,mo_basis.mo_kpt_num,ao_two_e_ints.df_num,nuclei.kpt_pair_num)
interface: ezfio

View File

@ -0,0 +1,107 @@
BEGIN_PROVIDER [double precision, df_mo_integrals_real, (mo_kpt_num,mo_kpt_num,df_num,kpt_pair_num)]
&BEGIN_PROVIDER [double precision, df_mo_integrals_imag, (mo_kpt_num,mo_kpt_num,df_num,kpt_pair_num)]
&BEGIN_PROVIDER [complex*16, df_mo_integrals_complex, (mo_kpt_num,mo_kpt_num,df_num,kpt_pair_num)]
implicit none
BEGIN_DOC
! df AO integrals
END_DOC
integer :: i,j,k,l
if (read_df_mo_integrals) then
df_mo_integrals_real = 0.d0
df_mo_integrals_imag = 0.d0
call ezfio_get_mo_two_e_ints_df_mo_integrals_real(df_mo_integrals_real)
call ezfio_get_mo_two_e_ints_df_mo_integrals_imag(df_mo_integrals_imag)
print *, 'df AO integrals read from disk'
do l=1,kpt_pair_num
do k=1,df_num
do j=1,mo_kpt_num
do i=1,mo_kpt_num
df_mo_integrals_complex(i,j,k,l) = dcmplx(df_mo_integrals_real(i,j,k,l), &
df_mo_integrals_imag(i,j,k,l))
enddo
enddo
enddo
enddo
else
call df_mo_from_df_ao(df_mo_integrals_complex,df_ao_integrals_complex,mo_kpt_num,ao_kpt_num,df_num,kpt_pair_num)
endif
if (write_df_mo_integrals) then
do l=1,kpt_pair_num
do k=1,df_num
do j=1,mo_kpt_num
do i=1,mo_kpt_num
df_mo_integrals_real(i,j,k,l) = dble(df_mo_integrals_complex(i,j,k,l))
df_mo_integrals_imag(i,j,k,l) = dimag(df_mo_integrals_complex(i,j,k,l))
enddo
enddo
enddo
enddo
call ezfio_set_mo_two_e_ints_df_mo_integrals_real(df_mo_integrals_real)
call ezfio_set_mo_two_e_ints_df_mo_integrals_imag(df_mo_integrals_imag)
print *, 'df AO integrals written to disk'
endif
END_PROVIDER
subroutine df_mo_from_df_ao(df_mo,df_ao,n_mo,n_ao,n_df,n_k_pairs)
use map_module
implicit none
BEGIN_DOC
! create 3-idx mo ints from 3-idx ao ints
END_DOC
integer,intent(in) :: n_mo,n_ao,n_df,n_k_pairs
complex*16,intent(out) :: df_mo(n_mo,n_mo,n_df,n_k_pairs)
complex*16,intent(in) :: df_ao(n_ao,n_ao,n_df,n_k_pairs)
integer :: kl,kj,kjkl2,mu,p,q
complex*16,allocatable :: coef_l(:,:), coef_j(:,:), ints_jl(:,:), ints_tmp(:,:)
double precision :: wall_1,wall_2,cpu_1,cpu_2
print*,'providing 3-index MO integrals from 3-index AO integrals'
call wall_time(wall_1)
call cpu_time(cpu_1)
allocate( &
coef_l(n_ao,n_mo),&
coef_j(n_ao,n_mo),&
ints_jl(n_ao,n_ao),&
ints_tmp(n_mo,n_ao)&
)
do kl=1, kpt_num
coef_l = mo_coef_kpts(:,:,kl)
do kj=1, kl
coef_j = mo_coef_kpts(:,:,kj)
kjkl2 = kj+shiftr(kl*kl-kl,1)
do mu=1, df_num
ints_jl = df_ao(:,:,mu,kjkl2)
call zgemm('C','N',n_mo,n_ao,n_ao, &
(1.d0,0.d0), coef_j, n_ao, &
ints_jl, n_ao, &
(0.d0,0.d0), ints_tmp, n_mo)
call zgemm('N','N',n_mo,n_mo,n_ao, &
(1.d0,0.d0), ints_tmp, n_mo, &
coef_l, n_ao, &
(0.d0,0.d0), df_mo(:,:,mu,kjkl2), n_mo)
enddo
enddo
call wall_time(wall_2)
print*,100.*float(kl*(kl+1))/(2.*n_k_pairs), '% in ', &
wall_2-wall_1, 's'
enddo
deallocate( &
coef_l, &
coef_j, &
ints_jl, &
ints_tmp &
)
call wall_time(wall_2)
call cpu_time(cpu_2)
print*,' 3-idx MO provided'
print*,' cpu time:',cpu_2-cpu_1,'s'
print*,' wall time:',wall_2-wall_1,'s ( x ',(cpu_2-cpu_1)/(wall_2-wall_1),')'
end subroutine df_mo_from_df_ao

View File

@ -49,6 +49,11 @@ doc: Number of k-points
type: integer
interface: ezfio, provider
[kpt_pair_num]
doc: Number of k-point pairs
type: integer
interface: ezfio
[kconserv]
type: integer
doc: array containing information about k-point symmetry

View File

@ -1,3 +1,8 @@
BEGIN_PROVIDER [integer, kpt_pair_num]
implicit none
kpt_pair_num = shiftr(kpt_num*kpt_num+kpt_num,1)
END_PROVIDER
BEGIN_PROVIDER [integer, kconserv, (kpt_num,kpt_num,kpt_num)]
implicit none
BEGIN_DOC