subroutine HistAnnihilEvent(iLut, Sign1, Sign2, part_type)
! Histogram a possible annihilation event.
integer(kind=n_int), intent(in) :: iLut(0:NIfTot)
real(dp), dimension(lenof_sign), intent(in) :: Sign1, Sign2
integer, intent(in) :: part_type
integer :: ExcitLevel, PartIndex
logical :: tSuc
! We want to histogram where the particle annihilations are taking place.
! No annihilation occuring - particles have the same sign.
if ((Sign1(part_type) * Sign2(part_type)) >= 0.0) return
ExcitLevel = FindBitExcitLevel(iLut, iLutHF, nel)
if (ExcitLevel == NEl) then
call BinSearchParts2(iLut(:), HistMinInd2(ExcitLevel), Det, PartIndex, tSuc)
else if (ExcitLevel == 0) then
PartIndex = 1
tSuc = .true.
else
call BinSearchParts2(iLut(:), HistMinInd2(ExcitLevel), FCIDetIndex(ExcitLevel + 1) - 1, PartIndex, tSuc)
end if
if (tSuc) then
AvAnnihil(part_type, PartIndex) = AvAnnihil(part_type, PartIndex) + &
2 * (min(abs(Sign1(part_type)), abs(Sign2(part_type))))
InstAnnihil(part_type, PartIndex) = InstAnnihil(part_type, PartIndex) + &
2 * (min(abs(Sign1(part_type)), abs(Sign2(part_type))))
else
call stop_all("HistAnnihilEvent", "Cannot find corresponding FCI determinant when histogramming")
end if
end subroutine HistAnnihilEvent