add_trial_ht_entries Subroutine

public subroutine add_trial_ht_entries(entries, n_entries, source_ht, source_ht_size)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: entries(0:NConEntry,n_entries)
integer, intent(in) :: n_entries
type(trial_hashtable), intent(inout), allocatable :: source_ht(:)
integer, intent(inout) :: source_ht_size

Contents

Source Code


Source Code

    subroutine add_trial_ht_entries(entries, n_entries, source_ht, source_ht_size)
        ! this adds n_entries entries to the source_ht hashtable
        implicit none
        integer, intent(in) :: n_entries
        integer(n_int), intent(in) :: entries(0:NConEntry, n_entries)
        type(trial_hashtable), allocatable, intent(inout) :: source_ht(:)
        ! in principle, the source_ht can be resized if really required,
        ! thus changing source_ht_size
        integer, intent(inout) :: source_ht_size
        integer :: i, hash_val, nI(nel), clashes
        ! we need to be careful: if the source_ht happens to be empty,
        ! it needs to be resized, as lookups are not possible on
        ! empty hashtables and will throw an error
        if (source_ht_size == 0) then
            call resize_trial_ht(source_ht, source_ht_size, 1)
        end if

        do i = 1, n_entries
            call decode_bit_det(nI, entries(:, i))
            hash_val = FindWalkerHash(nI, source_ht_size)
            ! just add them one by one
            call add_single_trial_ht_entry(entries(:, i), hash_val, source_ht)
        end do
    end subroutine add_trial_ht_entries