diff --git a/devel/import_integrals_ao/NEED b/devel/import_integrals_ao/NEED index 2637b96..f2374dd 100644 --- a/devel/import_integrals_ao/NEED +++ b/devel/import_integrals_ao/NEED @@ -1 +1,3 @@ -nuclei ao_one_e_ints ao_two_e_ints +nuclei +ao_one_e_ints ao_two_e_ints +mo_one_e_ints mo_two_e_ints diff --git a/devel/import_integrals_ao/import_integrals_ao.irp.f b/devel/import_integrals_ao/import_integrals_ao.irp.f index fb7a638..140103b 100644 --- a/devel/import_integrals_ao/import_integrals_ao.irp.f +++ b/devel/import_integrals_ao/import_integrals_ao.irp.f @@ -1,4 +1,4 @@ -program print_integrals +program import_integrals_ao print *, 'Number of AOs?' read(*,*) ao_num TOUCH ao_num @@ -8,6 +8,28 @@ end subroutine run use map_module implicit none + BEGIN_DOC +! Program to import integrals in the AO basis. +! +! one-electron integrals : format is : i j value +! two-electron integrals : format is : i j k l value +! Dirac's notation is used : is +! +! These files are read: +! +! E.qp : Contains the nuclear repulsion energy +! +! T.qp : kinetic energy integrals +! +! S.qp : overlap matrix +! +! P.qp : pseudopotential integrals +! +! V.qp : electron-nucleus potential +! +! W.qp : electron repulsion integrals +! + END_DOC integer :: iunit integer :: getunitandopen diff --git a/devel/import_integrals_ao/import_integrals_mo.irp.f b/devel/import_integrals_ao/import_integrals_mo.irp.f new file mode 100644 index 0000000..245a44f --- /dev/null +++ b/devel/import_integrals_ao/import_integrals_mo.irp.f @@ -0,0 +1,116 @@ +program import_integrals_mo + call run +end + +subroutine run + use map_module + implicit none + BEGIN_DOC +! Program to import integrals in the MO basis. +! +! one-electron integrals : format is : i j value +! two-electron integrals : format is : i j k l value +! Dirac's notation is used : is +! +! These files are read: +! +! E.qp : Contains the nuclear repulsion energy +! +! Tmo.qp : kinetic energy integrals +! +! Smo.qp : overlap matrix +! +! Pmo.qp : pseudopotential integrals +! +! Vmo.qp : electron-nucleus potential +! +! Wmo.qp : electron repulsion integrals +! + END_DOC + + integer :: iunit + integer :: getunitandopen + + integer ::i,j,k,l + double precision :: integral + double precision, allocatable :: A(:,:) + + integer :: n_integrals + integer(key_kind), allocatable :: buffer_i(:) + real(integral_kind), allocatable :: buffer_values(:) + + call ezfio_set_mo_basis_mo_num(mo_num) + + allocate (A(mo_num,mo_num)) + + A(1,1) = huge(1.d0) + iunit = getunitandopen('E.qp','r') + read (iunit,*,end=9) A(1,1) + 9 continue + close(iunit) + if (A(1,1) /= huge(1.d0)) then + call ezfio_set_nuclei_nuclear_repulsion(A(1,1)) + call ezfio_set_nuclei_io_nuclear_repulsion("Read") + endif + + A = 0.d0 + iunit = getunitandopen('Tmo.qp','r') + do + read (iunit,*,end=10) i,j, integral + A(i,j) = integral + enddo + 10 continue + close(iunit) + call ezfio_set_mo_one_e_ints_mo_integrals_kinetic(A(1:mo_num, 1:mo_num)) + call ezfio_set_mo_one_e_ints_io_mo_integrals_kinetic("Read") + + A = 0.d0 + iunit = getunitandopen('Pmo.qp','r') + do + read (iunit,*,end=14) i,j, integral + A(i,j) = integral + enddo + 14 continue + close(iunit) + call ezfio_set_mo_one_e_ints_mo_integrals_pseudo(A(1:mo_num,1:mo_num)) + call ezfio_set_mo_one_e_ints_io_mo_integrals_pseudo("Read") + + A = 0.d0 + iunit = getunitandopen('Vmo.qp','r') + do + read (iunit,*,end=12) i,j, integral + A(i,j) = integral + enddo + 12 continue + close(iunit) + call ezfio_set_mo_one_e_ints_mo_integrals_e_n(A(1:mo_num, 1:mo_num)) + call ezfio_set_mo_one_e_ints_io_mo_integrals_e_n("Read") + + allocate(buffer_i(mo_num**3), buffer_values(mo_num**3)) + iunit = getunitandopen('Wmo.qp','r') + n_integrals=0 + buffer_values = 0.d0 + do + read (iunit,*,end=13) i,j,k,l, integral + n_integrals += 1 + call two_e_integrals_index(i, j, k, l, buffer_i(n_integrals) ) + buffer_values(n_integrals) = integral + if (n_integrals == size(buffer_i)) then + call insert_into_mo_integrals_map(n_integrals,buffer_i,buffer_values) + n_integrals = 0 + endif + enddo + 13 continue + close(iunit) + + if (n_integrals > 0) then + call insert_into_mo_integrals_map(n_integrals,buffer_i,buffer_values) + endif + + call map_sort(mo_integrals_map) + call map_unique(mo_integrals_map) + + call map_save_to_disk(trim(ezfio_filename)//'/work/mo_ints',mo_integrals_map) + call ezfio_set_mo_two_e_ints_io_mo_two_e_integrals('Read') + +end