subroutine CountExcitations4(nI, minRank, maxRank, minSpinDiff, maxSpinDiff, tot)
implicit none
integer, intent(in) :: nI(nEl), minRank, maxRank, minSpinDiff, maxSpinDiff
integer, intent(out) :: tot
logical :: tAllExcitFound, tParity
integer :: nJ(nEl)
type(excitGenSessionType) :: session
session = InitExcitGenSession(nI, minRank, maxRank, minSpinDiff, maxSpinDiff)
tot = 0
tAllExcitFound = .false.
do while (.true.)
call GenExcitations4(session, nJ, tParity, tAllExcitFound, .false.)
if (tAllExcitFound) then
exit
end if
tot = tot + 1
end do
end subroutine CountExcitations4