calc_overlap Function

public function calc_overlap(ilutI, ilutJ) result(overlap)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: ilutI(:,:)
integer(kind=n_int), intent(in) :: ilutJ(:,:)

Return Value real(kind=dp)


Contents

Source Code


Source Code

    function calc_overlap(ilutI, ilutJ) result(overlap)
        ! calculate the overlap between two wavefunction I and J
        integer(n_int), intent(in) :: ilutI(:, :), ilutJ(:, :)
        real(dp) :: overlap
        real(dp) :: signI(lenof_sign), signJ(lenof_sign)

        integer :: i, pos
        ! i am pretty sure the lists are ordered so I can binary search..

        overlap = 0.0_dp

        do i = 1, size(ilutI, 2)
            pos = binary_search_ilut(ilutJ, ilutI(:, i), nifd + 1)

            if (pos > 0) then
                call extract_sign(ilutI(:, i), signI)
                call extract_sign(ilutJ(:, pos), signJ)

                overlap = overlap + signI(1) * signJ(1)

            end if
        end do

    end function calc_overlap