subroutine truncate_overlap_states
use semi_stoch_procs, only: check_determ_flag
use FciMCData, only: HashIndex
use bit_reps, only: nullify_ilut
use hash, only: hash_table_lookup
implicit none
integer :: i, iGf, nI(nel), DetHash, PartInd
logical :: tSuccess
do iGf = 1, gf_count
! For each gf, truncate the corresponding overlap state
do i = 1, overlap_states(iGf)%ndets
call decode_bit_det(nI, overlap_states(iGf)%dets(:, i))
call hash_table_lookup(nI, overlap_states(iGf)%dets(:, i), nifd, HashIndex, &
CurrentDets, PartInd, DetHash, tSuccess)
if (tSuccess) then
! In principle, there are no non-core determinants left when this
! is called, but we do not want to depend on the order in which the
! truncation is carried out
if (.not. check_determ_flag(CurrentDets(:, PartInd))) call nullify_ilut( &
overlap_states(iGf)%dets(:, i))
else
call nullify_ilut(overlap_states(iGf)%dets(:, i))
end if
end do
end do
end subroutine truncate_overlap_states