initialise_shared_rht_expl Subroutine

private subroutine initialise_shared_rht_expl(ilut_list, space_size, hash_table, det_size, ht_size)

Uses

Explicit initializer for shared read-only hash-tables that allows to set the determinant size @param[in] ilut_list list of iluts to be indexed by the hash table @param[in] space_size size of the index space @param[out] hash_table shared read-only hashtable to index the ilut_list @param[in] det_size size of the determinants encoded in ilut_list (for convenience) @param[out] ht_size the size of the hash table, has to be specified herer!

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: ilut_list(0:,:)
integer, intent(in) :: space_size
type(shared_rhash_t), intent(out) :: hash_table
integer, intent(in) :: det_size
integer, intent(in) :: ht_size

Contents


Source Code

    subroutine initialise_shared_rht_expl(ilut_list, space_size, hash_table, det_size, ht_size)
        use bit_reps, only: decode_bit_det
        use hash, only: FindWalkerHash

        integer(n_int), intent(in) :: ilut_list(0:, :)
        integer, intent(in) :: space_size
        type(shared_rhash_t), intent(out) :: hash_table
        integer, intent(in) :: det_size
        ! ht_size cannot be defaulted anymore as this would be ambigious
        integer, intent(in) :: ht_size

        integer :: nI(det_size)
        integer :: i, ierr
        integer(int64) :: hash_val, pos

        call hash_table%alloc(int(space_size, int64), int(ht_size, int64))

        ! Count the number of states with each hash value.
        do i = 1, space_size
            call decode_bit_det(nI, ilut_list(:, i))
            hash_val = FindWalkerHash(nI, ht_size)
            call hash_table%count_value(hash_val)
        end do

        call hash_table%setup_offsets()
        ! Now fill in the indices of the states in the space.
        do i = 1, space_size
            call decode_bit_det(nI, ilut_list(:, i))
            hash_val = FindWalkerHash(nI, ht_size)
            call hash_table%add_value(hash_val, int(i, int64), pos)
        end do

        ! Synchronize the node afterwards to keep tasks from using the un-initialized ht
        call hash_table%sync()
    end subroutine initialise_shared_rht_expl