remove_hash_table_entry Subroutine

public subroutine remove_hash_table_entry(hash_table, nI, ind)


Type IntentOptional Attributes Name
type(ll_node), intent(inout), pointer :: hash_table(:)
integer, intent(in) :: nI(:)
integer, intent(in) :: ind


Source Code

    subroutine remove_hash_table_entry(hash_table, nI, ind)

        ! Find and remove the entry in hash_table corresponding to nI, which
        ! must have index ind in the hash table. If not found then an error
        ! will be thrown.

        type(ll_node), pointer, intent(inout) :: hash_table(:)
        integer, intent(in) :: nI(:)
        integer, intent(in) :: ind

        integer :: hash_val
        type(ll_node), pointer :: prev, curr
        logical :: found
#ifdef DEBUG_
        character(len=*), parameter :: this_routine = "remove_hash_table_entry"

        ASSERT(all(nI <= nBasis))
        ASSERT(all(nI > 0))

        found = .false.

        ! Find the hash value corresponding to this determinant.
        hash_val = FindWalkerHash(nI, size(hash_table))
        ! Point at the start of the linked list for this hash value.
        curr => hash_table(hash_val)
        prev => null()
        ! Loop over all entries in the linked list until we find the one equal
        ! to ind, the entry that we want to remove.
        do while (associated(curr))
            if (curr%ind == ind) then
                ! If this is the state to be removed.
                found = .true.
                call remove_node(prev, curr)
            end if
            prev => curr
            curr => curr%next
        end do


    end subroutine remove_hash_table_entry