subroutine DirectAnnihilation(TotWalkersNew, MaxIndex, iter_data, err)
integer, intent(inout) :: TotWalkersNew, MaxIndex
integer, intent(out) :: err
type(fcimc_iter_data), intent(inout) :: iter_data
! If the semi-stochastic approach is being used then the following routine performs the
! annihilation of the deterministic states. These states are subsequently skipped in the
! AnnihilateSpawnedParts routine.
if (tSemiStochastic) call deterministic_annihilation(iter_data)
! Binary search the main list and copy accross/annihilate determinants which are found.
! This will also remove the found determinants from the spawnedparts lists.
call AnnihilateSpawnedParts(MaxIndex, TotWalkersNew, iter_data, err)
call set_timer(Sort_Time, 30)
call CalcHashTableStats(TotWalkersNew, iter_data)
call halt_timer(Sort_Time)
end subroutine DirectAnnihilation