cc_hash_update Subroutine

private subroutine cc_hash_update(hash_table, hash_val, tgt, amp)

Arguments

Type IntentOptional Attributes Name
type(cc_hash), intent(inout), pointer :: hash_table(:)
integer, intent(in) :: hash_val
integer(kind=n_int), intent(in) :: tgt(:)
real(kind=dp), intent(in) :: amp

Contents

Source Code


Source Code

    subroutine cc_hash_update(hash_table, hash_val, tgt, amp)
        ! routine to update the amplitude of a found entry
        type(cc_hash), pointer, intent(inout) :: hash_table(:)
        integer, intent(in) :: hash_val
        integer(n_int), intent(in) :: tgt(:)
        real(dp), intent(in) :: amp
        character(*), parameter :: this_routine = "cc_hash_update"

        type(cc_hash), pointer :: temp_node
        logical :: found

        found = .false.

        temp_node => hash_table(hash_val)

        do while (associated(temp_node))
            if (all(temp_node%ind == tgt)) then
                ! this is the correct entry!
                found = .true.
                temp_node%amp = temp_node%amp + amp
                exit
            end if
            temp_node => temp_node%next
        end do

        ASSERT(found)

    end subroutine cc_hash_update