function count_alpha_orbs_ij(csf_i, i, j) result(nOpen)
! function to count the number of 2s in a CSF det between spatial
! orbitals i and j
type(CSF_Info_t), intent(in) :: csf_i
integer, intent(in) :: i, j
integer :: nOpen
character(*), parameter :: this_routine = "count_alpha_orbs_ij"
integer :: k
ASSERT(i > 0 .and. i <= nSpatOrbs)
ASSERT(j > 0 .and. j <= nSpatOrbs)
nOpen = 0
! quick fix for now to see if thats the problem: loop and check!
do k = i, j
if (csf_i%stepvector(k) == 2) then
nOpen = nOpen + 1
end if
end do
end function count_alpha_orbs_ij