function get_sign_op(ilut) result(xi)
! compute the sign problem indicator xi for a given determinant
implicit none
integer(n_int), intent(in) :: ilut(0:NIfTot)
real(dp) :: xi
integer :: iRef, nI(nel), exLevel
real(dp) :: unsignedCache
HElement_t(dp) :: signedCache
#ifdef DEBUG_
character(*), parameter :: this_routine = "get_sign_op_run"
#endif
integer :: connections
ASSERT(.not. t_3_body_excits)
call initialize_c_caches(signedCache, unsignedCache, connections)
! Sum up all Hij cj for all superinitiators j
do iRef = 1, nRefs
exLevel = FindBitExcitLevel(ilutRefAdi(:, iRef), ilut)
! Of course, only singles/doubles of ilut can contribute
if (exLevel < 3) then
call decode_bit_det(nI, ilut)
call update_coherence_check(ilut, nI, iRef, &
signedCache, unsignedCache, connections)
end if
end do
! Get the ratio of the caches, which is xi
if (abs(unsignedCache) > eps .and. connections >= minSIConnect) then
xi = abs(signedCache) / unsignedCache
else
xi = 0.0_dp
end if
end function get_sign_op