is_in_list_ilut Function

private function is_in_list_ilut(tgt_ilut, n_states, ilut_list_in, t_sorted_opt)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: tgt_ilut(0:niftot)
integer, intent(in) :: n_states
integer(kind=n_int), intent(in) :: ilut_list_in(0:niftot,n_states)
logical, intent(in), optional :: t_sorted_opt

Return Value logical


Contents

Source Code


Source Code

    logical function is_in_list_ilut(tgt_ilut, n_states, ilut_list_in, t_sorted_opt)
        ! interfaced function for finding a ilut rep. in a ilut list
        integer(n_int), intent(in) :: tgt_ilut(0:niftot)
        integer, intent(in) :: n_states
        integer(n_int), intent(in) :: ilut_list_in(0:niftot, n_states)
        logical, intent(in), optional :: t_sorted_opt

        logical :: t_sorted
        integer :: pos
        integer(n_int) :: ilut_list(0:niftot, n_states)

        if (present(t_sorted_opt)) then
            t_sorted = t_sorted_opt
        else
            ! default it is believed that the list is NOT sorted
            t_sorted = .false.
        end if

        ilut_list = ilut_list_in

        if (.not. t_sorted) then
            call sort(ilut_list, ilut_lt, ilut_gt)
        end if

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

        if (pos > 0) then
            is_in_list_ilut = .true.
        else
            is_in_list_ilut = .false.
        end if

    end function is_in_list_ilut