function check_electron_location_spatial(orbs, ic, part_type) result(loc)
! same function as above, just for spatial orbitals
integer, intent(in) :: orbs(2), ic, part_type
integer :: loc
character(*), parameter :: this_routine = "check_electron_location_spatial"
integer :: i
ASSERT(all(orbs >= [0, 0]))
ASSERT(all(orbs <= [nBasis / 2, nBasis / 2]))
if (ic == 1) then
if (is_in_ref_spatial(orbs(1), part_type)) then
! this means the electron is in the reference determinant
! which means we should pick a hole also in the
! reference determinant, or otherwise we definetly
! increase the excitation level
loc = 2
else
! only option 0 and 2 for single excitations!
loc = 0
end if
else if (ic == 2) then
! for double excitations we have to check both
loc = 0
do i = 1, 2
if (is_in_ref_spatial(orbs(i), part_type)) then
loc = loc + 1
end if
end do
end if
end function check_electron_location_spatial