def FmtCr(self):
    f = 1.0
    Lines = []

    def Emit(s):
        Lines.append(s)

    def EmitArray(Name, A):
        Emit((((('    ' + Name) + '<') + ' '.join((('%r' % o) for o in A))) + '>'))
    BasisFns = []
    BasisFnIds = {}
    for Shell in self.Shells:
        if (id(Shell.Fn) not in BasisFnIds):
            BasisFnIds[id(Shell.Fn)] = len(BasisFns)
            BasisFns.append(Shell.Fn)
        pass
    Emit(('Basis<Version<0.1> nFns<%i> nShells<%i>' % (len(BasisFns), len(self.Shells))))

    def EmitBasisFn(Fn):
        Emit(('  Fn<Id<%i> l<%i> nExp<%i> nCo<%i>' % (BasisFnIds[id(Fn)], Fn.l, Fn.nExp, Fn.nCo)))
        EmitArray('Exp', Fn.Exp)
        for Co in Fn.Co.T:
            EmitArray('Co', Co)
        Emit('  >')
        pass
    for Fn in BasisFns:
        EmitBasisFn(Fn)

    def EmitShell(Sh):
        Emit(('  Shell<iAt<%i> x<%r> y<%r> z<%r> FnId<%i>>' % (Sh.Atom.Index, (f * Sh.Atom.Pos[0]), (f * Sh.Atom.Pos[1]), (f * Sh.Atom.Pos[2]), BasisFnIds[id(Sh.Fn)])))
        pass
    for Shell in self.Shells:
        EmitShell(Shell)
    Emit('>')
    return '\n'.join(Lines)
def FmtCr(self):
    f = 1.0
    Lines = []

    def Emit(s):
        Lines.append(s)

    def EmitArray(Name, A):
        Emit((((('    ' + Name) + '<') + ' '.join((('%r' % o) for o in A))) + '>'))
    BasisFns = []
    BasisFnIds = {}
    for Shell in self.Shells:
        if (id(Shell.Fn) not in BasisFnIds):
            BasisFnIds[id(Shell.Fn)] = len(BasisFns)
            BasisFns.append(Shell.Fn)
        pass
    Emit(('Basis<Version<0.1> nFns<%i> nShells<%i>' % (len(BasisFns), len(self.Shells))))

    def EmitBasisFn(Fn):
        Emit(('  Fn<Id<%i> l<%i> nExp<%i> nCo<%i>' % (BasisFnIds[id(Fn)], Fn.l, Fn.nExp, Fn.nCo)))
        EmitArray('Exp', Fn.Exp)
        for Co in Fn.Co.T:
            EmitArray('Co', Co)
        Emit('  >')
        pass
    for Fn in BasisFns:
        EmitBasisFn(Fn)

    def EmitShell(Sh):
        Emit(('  Shell<iAt<%i> x<%r> y<%r> z<%r> FnId<%i>>' % (Sh.Atom.Index, (f * Sh.Atom.Pos[0]), (f * Sh.Atom.Pos[1]), (f * Sh.Atom.Pos[2]), BasisFnIds[id(Sh.Fn)])))
        pass
    for Shell in self.Shells:
        EmitShell(Shell)
    Emit('>')
    return '\n'.join(Lines)