Building a Hamiltonian matrix, second step

The second step will take the final Slater determinant from the first step (if not empty), and then order by pairwise permutations (i.e., if the Slater determinant is \( i_1, i_2, i_3, \ldots \), then if \( i_n > i_{n+1} \), interchange \( i_n \leftrightarrow i_{n+1} \).