pure function contract_1_rdm_ind(i, a, excit_lvl, excit_typ) result(rdm_ind)
! the inverse function of the routine above, to give the combined
! rdm index of two explicit ones
integer, intent(in) :: i, a
integer, intent(in), optional :: excit_lvl, excit_typ
integer(int_rdm) :: rdm_ind
rdm_ind = nSpatOrbs * (i - 1) + a
if (present(excit_lvl)) then
call encode_excit_lvl_rdm(rdm_ind, excit_lvl)
end if
if (present(excit_typ)) then
call encode_excit_typ_rdm(rdm_ind, excit_typ)
end if
end function contract_1_rdm_ind