subroutine print_rdms_spin_sym_wrapper(rdm_defs, rdm, rdm_recv, rdm_recv_2, spawn, rdm_trace, open_shell)
! Compress the full spinned-RDMs by summing over spin-equivalent terms
! (i.e. aaaa and bbbb rdms), and also applying symmetry of (*real*)
! RDMs. The result will be stored in rdm_recv_2. Then, print it out to a
! file.
! IMPORTANT: Although the rdm object has inout status, it will *not*
! be modified. The inout status is to allow for the optional possibility
! of updating the first argument of make_hermitian_rdm, which is not
! used here.
use hash, only: clear_hash_table
use rdm_Data, only: rdm_definitions_t
use LoggingData, only: t_calc_double_occ
use double_occ_mod, only: calc_double_occ_from_rdm
type(rdm_definitions_t), intent(in) :: rdm_defs
type(rdm_list_t), intent(in) :: rdm
type(rdm_list_t), intent(inout) :: rdm_recv, rdm_recv_2
type(rdm_spawn_t), intent(inout) :: spawn
real(dp), intent(in) :: rdm_trace(rdm%sign_length)
logical, intent(in) :: open_shell
integer :: nrdms_to_print
spawn%free_slots = spawn%init_free_slots(0:nProcessors - 1)
call clear_hash_table(spawn%rdm_send%hash_table)
call make_hermitian_rdm(rdm, rdm_defs%nrdms_standard, spawn, rdm_recv)
call apply_symmetries_for_output(rdm_recv, rdm_recv_2, spawn, open_shell)
! Only print non-transition RDMs, for now.
nrdms_to_print = rdm_defs%nrdms_standard
call print_rdms_with_spin(rdm_defs, nrdms_to_print, rdm_recv_2, rdm_trace, open_shell)
! intermediate hack:
if (t_calc_double_occ) then
call calc_double_occ_from_rdm(rdm_recv_2, rdm_trace)
end if
end subroutine print_rdms_spin_sym_wrapper