function count_beta_orbs_ij(csf_i, i, j) result(nOpen)
! function to count the number of 1s 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_beta_orbs_ij"
integer :: k
ASSERT(i > 0 .and. i <= nSpatOrbs)
ASSERT(j > 0 .and. j <= nSpatOrbs)
nOpen = 0
! quick and dirty fix to deal with the excitation range mask probs:
! do i always call that for the current det the excitation is
! calculated for? i think so..
do k = i, j
if (csf_i%stepvector(k) == 1) then
nOpen = nOpen + 1
end if
end do
end function count_beta_orbs_ij