10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-06-28 16:12:40 +02:00
QuantumPackage/src/utils_complex/import_integrals_ao_cplx.irp.f

160 lines
4.7 KiB
Fortran
Raw Normal View History

2020-02-12 01:23:34 +01:00
program import_ao_integrals_complex
2019-12-02 19:25:35 +01:00
call run
end
subroutine run
use map_module
implicit none
integer :: iunit
integer :: getunitandopen
integer ::i,j,k,l
double precision :: integral
2020-02-13 23:33:11 +01:00
complex*16, allocatable :: C(:,:)
2019-12-02 19:25:35 +01:00
double precision :: tmp_re, tmp_im
2020-01-22 18:35:41 +01:00
integer :: n_integrals_1, n_integrals_2
integer(key_kind), allocatable :: buffer_i_1(:), buffer_i_2(:)
real(integral_kind), allocatable :: buffer_values_1(:), buffer_values_2(:)
logical :: use_map1
integer(key_kind) :: idx_tmp
double precision :: sign
2019-12-02 19:25:35 +01:00
2020-01-30 21:57:49 +01:00
! call ezfio_set_ao_basis_ao_num(ao_num)
2019-12-02 19:25:35 +01:00
2020-02-13 23:33:11 +01:00
allocate (C(ao_num,ao_num))
2019-12-02 19:25:35 +01:00
2020-02-13 23:33:11 +01:00
integral = huge(1.d0)
2019-12-02 19:25:35 +01:00
iunit = getunitandopen('E.qp','r')
2020-02-13 23:33:11 +01:00
read (iunit,*,end=9) integral
2019-12-02 19:25:35 +01:00
9 continue
close(iunit)
2020-02-13 23:33:11 +01:00
if (integral /= huge(1.d0)) then
call ezfio_set_nuclei_nuclear_repulsion(integral)
2019-12-02 19:25:35 +01:00
call ezfio_set_nuclei_io_nuclear_repulsion("Read")
endif
2020-02-13 23:33:11 +01:00
C = (0.d0,0.d0)
2019-12-02 19:25:35 +01:00
iunit = getunitandopen('T.qp','r')
do
read (iunit,*,end=10) i,j, tmp_re, tmp_im
2020-02-13 23:33:11 +01:00
C(i,j) = dcmplx(tmp_re,tmp_im)
2019-12-02 19:25:35 +01:00
if (i.ne.j) then
2020-02-13 23:33:11 +01:00
C(j,i) = dcmplx(tmp_re,-tmp_im)
2019-12-02 19:25:35 +01:00
endif
enddo
10 continue
close(iunit)
2020-02-13 23:33:11 +01:00
call ezfio_set_ao_one_e_ints_ao_integrals_kinetic_complex(C)
2019-12-02 19:25:35 +01:00
call ezfio_set_ao_one_e_ints_io_ao_integrals_kinetic("Read")
2020-02-13 23:33:11 +01:00
C = (0.d0,0.d0)
2019-12-02 19:25:35 +01:00
iunit = getunitandopen('S.qp','r')
do
read (iunit,*,end=11) i,j, tmp_re, tmp_im
2020-02-13 23:33:11 +01:00
C(i,j) = dcmplx(tmp_re,tmp_im)
2019-12-02 19:25:35 +01:00
if (i.ne.j) then
2020-02-13 23:33:11 +01:00
C(j,i) = dcmplx(tmp_re,-tmp_im)
2019-12-02 19:25:35 +01:00
endif
enddo
11 continue
close(iunit)
2020-02-13 23:33:11 +01:00
call ezfio_set_ao_one_e_ints_ao_integrals_overlap_complex(C)
2019-12-02 19:25:35 +01:00
call ezfio_set_ao_one_e_ints_io_ao_integrals_overlap("Read")
2020-02-13 23:33:11 +01:00
C = (0.d0,0.d0)
2019-12-02 19:25:35 +01:00
iunit = getunitandopen('P.qp','r')
do
read (iunit,*,end=14) i,j, tmp_re, tmp_im
2020-02-13 23:33:11 +01:00
C(i,j) = dcmplx(tmp_re,tmp_im)
2019-12-02 19:25:35 +01:00
if (i.ne.j) then
2020-02-13 23:33:11 +01:00
C(j,i) = dcmplx(tmp_re,-tmp_im)
2019-12-02 19:25:35 +01:00
endif
enddo
14 continue
close(iunit)
2020-02-13 23:33:11 +01:00
call ezfio_set_ao_one_e_ints_ao_integrals_pseudo_complex(C)
2019-12-02 19:25:35 +01:00
call ezfio_set_ao_one_e_ints_io_ao_integrals_pseudo("Read")
2020-02-13 23:33:11 +01:00
C = (0.d0,0.d0)
2019-12-02 19:25:35 +01:00
iunit = getunitandopen('V.qp','r')
do
read (iunit,*,end=12) i,j, tmp_re, tmp_im
2020-02-13 23:33:11 +01:00
C(i,j) = dcmplx(tmp_re,tmp_im)
2019-12-02 19:25:35 +01:00
if (i.ne.j) then
2020-02-13 23:33:11 +01:00
C(j,i) = dcmplx(tmp_re,-tmp_im)
2019-12-02 19:25:35 +01:00
endif
enddo
12 continue
close(iunit)
2020-02-13 23:33:11 +01:00
call ezfio_set_ao_one_e_ints_ao_integrals_n_e_complex(C)
2019-12-02 19:25:35 +01:00
call ezfio_set_ao_one_e_ints_io_ao_integrals_n_e("Read")
2020-02-13 23:33:11 +01:00
deallocate(C)
2020-01-22 18:35:41 +01:00
allocate(buffer_i_1(ao_num**3), buffer_values_1(ao_num**3))
allocate(buffer_i_2(ao_num**3), buffer_values_2(ao_num**3))
iunit = getunitandopen('W.qp','r')
n_integrals_1=0
n_integrals_2=0
buffer_values_1 = 0.d0
buffer_values_2 = 0.d0
do
read (iunit,*,end=13) i,j,k,l, tmp_re, tmp_im
2020-02-12 01:23:34 +01:00
call ao_two_e_integral_complex_map_idx_sign(i,j,k,l,use_map1,idx_tmp,sign)
2020-01-22 18:35:41 +01:00
print'(4(I4),(L3),(I6),(F7.1))',i,j,k,l,use_map1,idx_tmp,sign
if (use_map1) then
n_integrals_1 += 1
buffer_i_1(n_integrals_1)=idx_tmp
buffer_values_1(n_integrals_1)=tmp_re
print'(A,4(I4),(I6),(E15.7))','map1',i,j,k,l,idx_tmp,tmp_re
if (sign.ne.0.d0) then
n_integrals_1 += 1
buffer_i_1(n_integrals_1)=idx_tmp+1
buffer_values_1(n_integrals_1)=tmp_im*sign
print'(A,4(I4),(I6),(E15.7))','map1',i,j,k,l,idx_tmp+1,tmp_im*sign
endif
if (n_integrals_1 >= size(buffer_i_1)-1) then
call insert_into_ao_integrals_map(n_integrals_1,buffer_i_1,buffer_values_1)
n_integrals_1 = 0
endif
else
n_integrals_2 += 1
buffer_i_2(n_integrals_2)=idx_tmp
buffer_values_2(n_integrals_2)=tmp_re
print'(A,4(I4),(I6),(E15.7))','map2',i,j,k,l,idx_tmp,tmp_re
if (sign.ne.0.d0) then
n_integrals_2 += 1
buffer_i_2(n_integrals_2)=idx_tmp+1
buffer_values_2(n_integrals_2)=tmp_im*sign
print'(A,4(I4),(I6),(E15.7))','map2',i,j,k,l,idx_tmp+1,tmp_im*sign
endif
if (n_integrals_2 >= size(buffer_i_2)-1) then
call insert_into_ao_integrals_map_2(n_integrals_2,buffer_i_2,buffer_values_2)
n_integrals_2 = 0
endif
endif
enddo
13 continue
close(iunit)
if (n_integrals_1 > 0) then
call insert_into_ao_integrals_map(n_integrals_1,buffer_i_1,buffer_values_1)
endif
if (n_integrals_2 > 0) then
call insert_into_ao_integrals_map_2(n_integrals_2,buffer_i_2,buffer_values_2)
endif
call map_sort(ao_integrals_map)
call map_unique(ao_integrals_map)
call map_sort(ao_integrals_map_2)
call map_unique(ao_integrals_map_2)
2020-02-12 01:23:34 +01:00
call map_save_to_disk(trim(ezfio_filename)//'/work/ao_ints_complex_1',ao_integrals_map)
call map_save_to_disk(trim(ezfio_filename)//'/work/ao_ints_complex_2',ao_integrals_map_2)
2020-01-22 18:35:41 +01:00
call ezfio_set_ao_two_e_ints_io_ao_two_e_integrals('Read')
2019-12-02 19:25:35 +01:00
end