subroutine return_EN_trial_contrib(nI, ilut, amp)
integer, intent(in) :: nI(nel)
integer(n_int), intent(in) :: ilut(0:)
real(dp), intent(out) :: amp(lenof_sign)
integer :: i, istate, hash_val
amp = 0.0_dp
! Search the connected space to see if this state is present.
if (tPairedReplicas) then
if (con_space_size > 0) then
hash_val = FindWalkerHash(nI, con_space_size)
do i = 1, con_ht(hash_val)%nclash
if (DetBitEq(con_ht(hash_val)%states(0:nifd, i), ilut)) then
do istate = 1, lenof_sign.div.2
amp(istate * 2 - 1) = transfer(con_ht(hash_val)%states(nifd + istate, i), amp(istate * 2 - 1))
amp(istate * 2) = amp(istate * 2 - 1)
end do
return
end if
end do
end if
else
if (con_space_size > 0) then
hash_val = FindWalkerHash(nI, con_space_size)
do i = 1, con_ht(hash_val)%nclash
if (DetBitEq(con_ht(hash_val)%states(0:nifd, i), ilut)) then
amp = transfer(con_ht(hash_val)%states(IlutBits%ind_pop:, i), amp)
return
end if
end do
end if
end if
end subroutine return_EN_trial_contrib