read_op_sparse Subroutine

private subroutine read_op_sparse(this, indices, entries)

This is the operation to be performed for sparse storage on each block of data read from an hdf5 file both arguments may or may not be still allocated upon return. @param[in,out] indices chunk of indices read in from the file @param[in,out] entries chunk of corresponding values

Type Bound



Type IntentOptional Attributes Name
class(sparse_lMat_t), intent(inout) :: this
integer(kind=int64), intent(inout), allocatable :: indices(:,:)
integer(kind=int64), intent(inout), allocatable :: entries(:,:)


Source Code

Source Code

    subroutine read_op_sparse(this, indices, entries)
        use IntegralsData, only: nFrozen
        class(sparse_lMat_t), intent(inout) :: this
        ! We allow deallocation of indices/entries
        integer(int64), allocatable, intent(inout) :: indices(:, :), entries(:, :)

        integer(int64) :: block_size, i
        integer(int64), allocatable :: combined_inds(:)
        integer(int64) :: dummy
        HElement_t(dp) :: rVal

        block_size = size(indices, dim=2)
        ! Transfer the 6 orbitals to one contiguous index
        do i = 1, block_size
            if(nFrozen > 0) then
                ! Take care of freezing orbitals here
                call map_indices(indices(:,i))
                ! Only freeze once, when filling in the values (this read_op can be called
                ! multiple times for the same block)
                if(this%htable%known_conflicts()) then
#ifdef CMPLX_
                    call stop_all(this_routine, "not implemented for complex")
                    rVal = transfer(entries(1, i), rVal)
                    call add_core_en(rVal,indices(:,i))
                    entries(1,i) = transfer(rVal,entries(1,i))
                end if
            end if

            combined_inds(i) = this%indexFunc(indices(1, i), indices(2, i), indices(3, i), &
                indices(4, i), indices(5, i), indices(6, i))

            ! If the entry is frozen, do not count it
            if(t_freeze(indices)) combined_inds(i) = 0
        end do
        ! We might need this memory - all these operations can be memory critical

        if (this%htable%known_conflicts()) then
            call this%read_data(combined_inds, entries(1, :))
            call this%count_conflicts(combined_inds)
        end if

    end subroutine read_op_sparse