function getExcitationRangeMask(i, j) result(mask)
! function to create an integer corresponding to a mask were every
! bits between the spin orbitals corresponding to spatial orbitals
! i and j are set to 1 and 0 else. used to access the excitation
! range for GUGA excitation calculations
integer, intent(in) :: i, j
integer(n_int) :: mask
character(*), parameter :: this_routine = "getExcitationRangeMask"
integer(n_int) :: k
integer(n_int) :: tmp_i, tmp_j
ASSERT(i > 0 .and. i <= nSpatOrbs)
ASSERT(j > 0 .and. j <= nSpatOrbs)
ASSERT(j > i)
tmp_i = int(i, n_int)
tmp_j = int(j, n_int)
! not quite sure about LMSB or RMSB... todo
mask = 0_n_int
do k = 2_n_int * tmp_i - 1_n_int, 2_n_int * tmp_j ! convert to spin orbitals
mask = mask + 2_n_int**(k - 1_n_int)
end do
end function getExcitationRangeMask