read_sparse Subroutine

private subroutine read_sparse(this, filename)

Read the 6-index integrals from a file to sparse format @param[in] filename name of the file to read from

Type Bound

sparse_lMat_t

Arguments

Type IntentOptional Attributes Name
class(sparse_lMat_t), intent(inout) :: this
character(len=*), intent(in) :: filename

Contents

Source Code


Source Code

    subroutine read_sparse(this, filename)
        class(sparse_lMat_t), intent(inout) :: this
        character(*), intent(in) :: filename
        character(*), parameter :: t_r = "read_sparse"
#ifdef USE_HDF_
        type(lMat_hdf5_read_t) :: reader
        integer(hsize_t) :: nInts
        ! There is no sparse ascii reader yet, so filename is never used
        if (.not. tHDF5LMat) call stop_all(t_r, "Sparse 6-index integrals require hdf5 format")

        call reader%open(filename, nInts)
        call this%alloc(nInts)
        call reader%loop_file(this)
        call this%htable%setup_offsets()
        ! The core energy has already been updated, no need to do so again
        call reader%loop_file(this)
        call this%htable%finalize_setup()
        call reader%close()
#else

        unused_var(this)
        ! unused_var on strings is not supported by some older compilers
        if (len(filename) /= 0) continue
        call stop_all(t_r, "Sparse 6-index integrals are only available for hdf5 format")
#endif
        call this%nonzero_vals%sync()
        call this%htable%sync()
    end subroutine read_sparse