pure subroutine encode_sign_rdm(rdm_entry, real_sign)
! Take the real RDM elements stored in real_sign, and encode them
! as integers with kind int_rdm, and then place these encoded signs in
! the positive elements of the rdm_entry array (the 0'th element
! contains the encoded spin orbital labels).
integer(int_rdm), intent(inout) :: rdm_entry(0:)
real(dp), intent(in) :: real_sign(1:size(rdm_entry) - 1)
integer(int_rdm) :: int_sign(1:size(rdm_entry) - 1)
int_sign = transfer(real_sign, int_sign)
rdm_entry(1:size(int_sign)) = int_sign
end subroutine encode_sign_rdm