find_states_in_list Subroutine

public subroutine find_states_in_list(n_states, nI_search, ilut_list, nI_weights)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n_states
integer, intent(in) :: nI_search(nel,n_states)
integer(kind=n_int), intent(in) :: ilut_list(0:niftot,n_states)
real(kind=dp), intent(out) :: nI_weights(n_states)

Contents

Source Code


Source Code

    subroutine find_states_in_list(n_states, nI_search, ilut_list, nI_weights)
        ! routine to find the nI in the ilut_list and assign the
        ! corresponding weights. if not found the weights are 0
        integer, intent(in) :: n_states
        integer, intent(in) :: nI_search(nel, n_states)
        integer(n_int), intent(in) :: ilut_list(0:niftot, n_states)
        real(dp), intent(out) :: nI_weights(n_states)
#ifdef DEBUG_
        character(*), PARAMETER :: this_routine = "find_states_in_list"
#endif
        integer(n_int) :: ilut(0:niftot)
        integer :: i, pos
        real(dp) :: temp_sign(lenof_sign)

        nI_weights = 0.0_dp

        do i = 1, n_states
            call EncodeBitDet(nI_search(:, i), ilut)

            pos = binary_search_ilut(ilut_list, ilut, nifd + 1)

            if (pos > 0) then
                call extract_sign(ilut_list(:, pos), temp_sign)

                nI_weights(i) = temp_sign(1)

            end if
        end do

    end subroutine find_states_in_list