def _assemble_rdm2_spinful(evals) -> numpy.ndarray:
    ' Returns spin-ful two-particle RDM built by symmetry conditions '
    ctr: int = 0
    rdm2 = numpy.zeros([n_SOs, n_SOs, n_SOs, n_SOs])
    for p in range(n_SOs):
        for q in range(p):
            for r in range(n_SOs):
                for s in range(r):
                    if (((p * n_SOs) + q) >= ((r * n_SOs) + s)):
                        rdm2[(p, q, r, s)] = evals[ctr]
                        rdm2[(r, s, p, q)] = rdm2[(p, q, r, s)]
                        ctr += 1
    for p in range(n_SOs):
        for q in range(p):
            for r in range(n_SOs):
                for s in range(r):
                    rdm2[(p, q, s, r)] = ((- 1) * rdm2[(p, q, r, s)])
                    rdm2[(q, p, r, s)] = ((- 1) * rdm2[(p, q, r, s)])
                    rdm2[(q, p, s, r)] = rdm2[(p, q, r, s)]
    return rdm2
Returns spin-ful two-particle RDM built by symmetry conditions
def _assemble_rdm2_spinful(evals) -> numpy.ndarray:
    '  '
    ctr: int = 0
    rdm2 = numpy.zeros([n_SOs, n_SOs, n_SOs, n_SOs])
    for p in range(n_SOs):
        for q in range(p):
            for r in range(n_SOs):
                for s in range(r):
                    if (((p * n_SOs) + q) >= ((r * n_SOs) + s)):
                        rdm2[(p, q, r, s)] = evals[ctr]
                        rdm2[(r, s, p, q)] = rdm2[(p, q, r, s)]
                        ctr += 1
    for p in range(n_SOs):
        for q in range(p):
            for r in range(n_SOs):
                for s in range(r):
                    rdm2[(p, q, s, r)] = ((- 1) * rdm2[(p, q, r, s)])
                    rdm2[(q, p, r, s)] = ((- 1) * rdm2[(p, q, r, s)])
                    rdm2[(q, p, s, r)] = rdm2[(p, q, r, s)]
    return rdm2