(self)
Returns the sorted string without normal order brackets.

        The returned string have the property that no nonzero
        contractions exist.
Returns the sorted string without normal order brackets.
Returns the sorted string without normal order brackets .
def _remove_brackets(self):
        """
        Returns the sorted string without normal order brackets.

        The returned string have the property that no nonzero
        contractions exist.
        """

        # check if any creator is also an annihilator
        subslist = []
        for i in self.iter_q_creators():
            if self[i].is_q_annihilator:
                assume = self[i].state.assumptions0

                # only operators with a dummy index can be split in two terms
                if isinstance(self[i].state, Dummy):

                    # create indices with fermi restriction
                    assume.pop("above_fermi", None)
                    assume["below_fermi"] = True
                    below = Dummy('i', **assume)
                    assume.pop("below_fermi", None)
                    assume["above_fermi"] = True
                    above = Dummy('a', **assume)

                    cls = type(self[i])
                    split = (
                        self[i].__new__(cls, below)
                        * KroneckerDelta(below, self[i].state)
                        + self[i].__new__(cls, above)
                        * KroneckerDelta(above, self[i].state)
                    )
                    subslist.append((self[i], split))
                else:
                    raise SubstitutionOfAmbigousOperatorFailed(self[i])
        if subslist:
            result = NO(self.subs(subslist))
            if isinstance(result, Add):
                return Add(*[term.doit() for term in result.args])
        else:
            return self.args[0]
def _remove_brackets ( self ) : # check if any creator is also an annihilator subslist = [ ] for i in self . iter_q_creators ( ) : if self [ i ] . is_q_annihilator : assume = self [ i ] . state . assumptions0 # only operators with a dummy index can be split in two terms if isinstance ( self [ i ] . state , Dummy ) : # create indices with fermi restriction assume . pop ( "above_fermi" , None ) assume [ "below_fermi" ] = True below = Dummy ( 'i' , * * assume ) assume . pop ( "below_fermi" , None ) assume [ "above_fermi" ] = True above = Dummy ( 'a' , * * assume ) cls = type ( self [ i ] ) split = ( self [ i ] . __new__ ( cls , below ) * KroneckerDelta ( below , self [ i ] . state ) + self [ i ] . __new__ ( cls , above ) * KroneckerDelta ( above , self [ i ] . state ) ) subslist . append ( ( self [ i ] , split ) ) else : raise SubstitutionOfAmbigousOperatorFailed ( self [ i ] ) if subslist : result = NO ( self . subs ( subslist ) ) if isinstance ( result , Add ) : return Add ( * [ term . doit ( ) for term in result . args ] ) else : return self . args [ 0 ]