subroutine send_fragment_payload(comm, tag, fragment_idx, polymers, dest_rank)
!! Send fragment payload over the specified communicator/tag.
!! Uses int64 for fragment_idx to handle large fragment indices.
type(comm_t), intent(in) :: comm
integer, intent(in) :: tag
integer(int64), intent(in) :: fragment_idx
integer, intent(in) :: dest_rank
integer, intent(in) :: polymers(:, :)
integer(int32) :: fragment_size, fragment_type
integer, allocatable :: fragment_indices(:)
type(request_t) :: req(4)
integer(int64) :: fragment_idx_int64
call build_fragment_payload(fragment_idx, polymers, fragment_type, fragment_size, fragment_indices)
fragment_idx_int64 = int(fragment_idx, kind=int64)
call isend(comm, fragment_idx_int64, dest_rank, tag, req(1))
call isend(comm, fragment_type, dest_rank, tag, req(2))
call isend(comm, fragment_size, dest_rank, tag, req(3))
call isend(comm, fragment_indices, dest_rank, tag, req(4))
call wait(req(1))
call wait(req(2))
call wait(req(3))
call wait(req(4))
deallocate (fragment_indices)
end subroutine send_fragment_payload