pure subroutine extract_1_rdm_ind(rdm_ind, i, a, excit_lvl, excit_typ)
! the converstion routine between the combined and explicit rdm
! indices for the 1-RDM
integer(int_rdm), intent(in) :: rdm_ind
integer, intent(out) :: i, a
integer, intent(out), optional :: excit_lvl, excit_typ
integer(int_rdm) :: rdm_ind_
! if we also want to use the top 7 bits of rdm_ind for information
! of the excit-lvl and type we have to 0 them out before
! extracting the indices
rdm_ind_ = iand(rdm_ind, rdm_ind_bitmask)
a = int(mod(rdm_ind_ - 1, nSpatOrbs) + 1)
i = int((rdm_ind_ - 1) / nSpatOrbs + 1)
if (present(excit_lvl)) then
excit_lvl = extract_excit_lvl_rdm(rdm_ind)
end if
if (present(excit_typ)) then
excit_typ = extract_excit_type_rdm(rdm_ind)
end if
end subroutine extract_1_rdm_ind