subroutine hash_search_trial(ilut, nI, amp, tTrial, tCon)
integer(n_int), intent(in) :: ilut(0:)
integer, intent(in) :: nI(nel)
HElement_t(dp), intent(out) :: amp(:)
logical, intent(out) :: tTrial, tCon
integer :: i, hash_val
amp = 0.0_dp
tTrial = .false.
tCon = .false.
! Note we search the trial space first, and don't add a contribution
! from the connected space if we are also in the trial space.
if (trial_space_size > 0) then
! Find the hash value of this state.
hash_val = FindWalkerHash(nI, trial_space_size)
do i = 1, trial_ht(hash_val)%nclash
if (DetBitEq(ilut, trial_ht(hash_val)%states(0:nifd, i))) then
tTrial = .true.
amp = transfer(trial_ht(hash_val)%states(IlutBits%ind_pop:, i), amp)
return
end if
end do
end if
! If it wasn't in the trial space, check to see if it is in the connected space.
if (con_space_size > 0) then
hash_val = FindWalkerHash(nI, con_space_size)
! Loop over all hash clashes for this hash value.
do i = 1, con_ht(hash_val)%nclash
if (DetBitEq(ilut, con_ht(hash_val)%states(0:nifd, i))) then
tCon = .true.
amp = transfer(con_ht(hash_val)%states(IlutBits%ind_pop:, i), amp)
return
end if
end do
end if
end subroutine hash_search_trial