def reorder(self, to: str='of'):
    "\n        Function to reorder tensors according to some convention.\n\n        Parameters\n        ----------\n        to :\n            Ordering scheme of choice.\n            'openfermion', 'of' (default) :\n                openfermion - ordering, corresponds to integrals of the type\n                h^pq_rs = int p(1)* q(2)* O(1,2) r(2) s(1) (O(1,2)\n                with operators a^pq_rs = a^p a^q a_r a_s (a^p == a^dagger_p)\n                currently needed for dependencies on openfermion-library\n            'chem', 'c' :\n                quantum chemistry ordering, collect particle terms,\n                more convenient for real-space methods\n                h^pq_rs = int p(1) q(1) O(1,2) r(2) s(2)\n                This is output by psi4\n            'phys', 'p' :\n                typical physics ordering, integrals of type\n                h^pq_rs = int p(1)* q(2)* O(1,2) r(1) s(2)\n                with operators a^pq_rs = a^p a^q a_s a_r\n\n            Returns\n            -------\n        "
    if (self.order != 4):
        raise Exception('Reordering currently only implemented for two-body tensors.')
    to = self.Ordering(to)
    if (self.ordering == to):
        return self
    elif self.ordering.is_chem():
        if to.is_of():
            self.elems = numpy.einsum('psqr -> pqrs', self.elems, optimize='greedy')
        elif to.is_phys():
            self.elems = numpy.einsum('prqs -> pqrs', self.elems, optimize='greedy')
    elif self.ordering.is_of():
        if to.is_chem():
            self.elems = numpy.einsum('pqrs -> psqr', self.elems, optimize='greedy')
        elif to.is_phys():
            self.elems = numpy.einsum('pqrs -> pqsr', self.elems, optimize='greedy')
    elif self.ordering.is_phys():
        if to.is_chem():
            self.elems = numpy.einsum('pqrs -> prqs', self.elems, optimize='greedy')
        elif to.is_of():
            self.elems = numpy.einsum('pqsr -> pqrs', self.elems, optimize='greedy')
    return self
Function to reorder tensors according to some convention.

Parameters
----------
to :
    Ordering scheme of choice.
    'openfermion', 'of' (default) :
        openfermion - ordering, corresponds to integrals of the type
        h^pq_rs = int p(1)* q(2)* O(1,2) r(2) s(1) (O(1,2)
        with operators a^pq_rs = a^p a^q a_r a_s (a^p == a^dagger_p)
        currently needed for dependencies on openfermion-library
    'chem', 'c' :
        quantum chemistry ordering, collect particle terms,
        more convenient for real-space methods
        h^pq_rs = int p(1) q(1) O(1,2) r(2) s(2)
        This is output by psi4
    'phys', 'p' :
        typical physics ordering, integrals of type
        h^pq_rs = int p(1)* q(2)* O(1,2) r(1) s(2)
        with operators a^pq_rs = a^p a^q a_s a_r

    Returns
    -------
def reorder(self, to: str='of'):
    "\n        Function to reorder tensors according to some convention.\n\n        Parameters\n        ----------\n        to :\n            Ordering scheme of choice.\n            'openfermion', 'of' (default) :\n                openfermion - ordering, corresponds to integrals of the type\n                h^pq_rs = int p(1)* q(2)* O(1,2) r(2) s(1) (O(1,2)\n                with operators a^pq_rs = a^p a^q a_r a_s (a^p == a^dagger_p)\n                currently needed for dependencies on openfermion-library\n            'chem', 'c' :\n                quantum chemistry ordering, collect particle terms,\n                more convenient for real-space methods\n                h^pq_rs = int p(1) q(1) O(1,2) r(2) s(2)\n                This is output by psi4\n            'phys', 'p' :\n                typical physics ordering, integrals of type\n                h^pq_rs = int p(1)* q(2)* O(1,2) r(1) s(2)\n                with operators a^pq_rs = a^p a^q a_s a_r\n\n            Returns\n            -------\n        "
    if (self.order != 4):
        raise Exception('Reordering currently only implemented for two-body tensors.')
    to = self.Ordering(to)
    if (self.ordering == to):
        return self
    elif self.ordering.is_chem():
        if to.is_of():
            self.elems = numpy.einsum('psqr -> pqrs', self.elems, optimize='greedy')
        elif to.is_phys():
            self.elems = numpy.einsum('prqs -> pqrs', self.elems, optimize='greedy')
    elif self.ordering.is_of():
        if to.is_chem():
            self.elems = numpy.einsum('pqrs -> psqr', self.elems, optimize='greedy')
        elif to.is_phys():
            self.elems = numpy.einsum('pqrs -> pqsr', self.elems, optimize='greedy')
    elif self.ordering.is_phys():
        if to.is_chem():
            self.elems = numpy.einsum('pqrs -> prqs', self.elems, optimize='greedy')
        elif to.is_of():
            self.elems = numpy.einsum('pqsr -> pqrs', self.elems, optimize='greedy')
    return self