subroutine find_switches_ilut(ilut, ind, lower, upper)
! for single excitations this checks for available switches around an
! already chosen index
integer(n_int), intent(in) :: ilut(0:GugaBits%len_tot)
integer, intent(in) :: ind
integer, intent(out) :: lower, upper
integer :: i
! set defaults if no such switches are available
lower = 1
upper = nSpatOrbs
! i think i could improve that with the new trailz, leadz routines..
if (isOne(ilut, ind)) then
do i = ind - 1, 2, -1
if (isTwo(ilut, i)) then
lower = i
exit
end if
end do
do i = ind + 1, nSpatOrbs - 1
if (isTwo(ilut, i)) then
upper = i
exit
end if
end do
else if (isTwo(ilut, ind)) then
do i = ind - 1, 2, -1
if (isOne(ilut, i)) then
lower = i
exit
end if
end do
do i = ind + 1, nSpatOrbs - 1
if (isOne(ilut, i)) then
upper = i
exit
end if
end do
end if
end subroutine find_switches_ilut