Beispiel #1
0
def readdOffdiagConstants(g, offdiags):
    ginv = g.copy()
    ginv << inverse(g)
    for s, b in ginv:
        orbs = range(len(b.data[0,:,:]))
        for i,j in product(*[orbs]*2):
            b[i, j] += offdiags[s][i,j]
    g << inverse(ginv)
    return g
def _g_lat(m, eps, bz_grid, spins):
    n_k = len(bz_grid)
    n_bands = len(eps[0, :, :])
    g = [BlockGf(name_block_generator = [(s, m[0][s]) for s in spins], name = '$G_{lat}$', make_copies = True) for i in range(n_k)]
    g_p = scatter_list(g)
    for g_k, m_k, eps_k in izip(g_p, scatter_list(m), scatter_list(eps)):
        for s in spins:
            g_k[s] << inverse(inverse(m_k[s]) - eps_k)
    g = allgather_list(g_p)
    return g
Beispiel #3
0
def addExtField(g, field):
    if field:
        indices = [i for i in g.indices]
        g = g.copy()
        ginv = g.copy()
        ginv << inverse(g)
        for s, b in ginv:
            for i in range(len(b.data[0,:,:])):
                b[i,i] += field[s][i]
        g << inverse(ginv)
    return g
Beispiel #4
0
def setOffdiagsZero(g):
    ginv = g.copy()
    ginv << inverse(g)
    offdiags = ginv.copy()
    for s, b in ginv:
        orbs = range(len(b.data[0,:,:]))
        for i,j in product(*[orbs]*2):
            if i != j:
                b[i, j] << 0
            else:
                offdiags[s][i,j] << 0
    g << inverse(ginv)
    return g, offdiags
def _sigma_lat(m, bz_grid, mu, spins):
    n_k = len(bz_grid)
    sig = [BlockGf(name_block_generator = [(s, m[0][s]) for s in spins], name = '$\Sigma_{lat}$', make_copies = True) for i in range(n_k)]
    sig_p = scatter_list(sig)
    for m_k, sig_k in izip(scatter_list(m), sig_p):
        for s in spins:
            sig_k[s] << iOmega_n + mu - inverse(m_k[s])
    sig = allgather_list(sig_p)
    return sig
Beispiel #6
0
 def make_g_0_iw_with_delta_tau_real(self, n_tau = 10000):
     delta_iw = delta(self.g_0_iw)
     delta_tau = self.get_delta_tau()
     for s, b in delta_tau:
         for n, tau in enumerate(b.mesh):
             b.data[n,:,:] = b.data[n,:,:].real
             # Tail consistency is maintained anyways
             #for i in range(len(b.tail.data)):
             #    orbs = range(len(b.tail.data[i,:,:]))
             #    for j, k in product(orbs, orbs):
             #        b.tail.data[i,j,k] = b.tail.data[i,j,k].real
     delta_iw_new = self.g_0_iw.copy()
     for s, b in delta_iw_new:
         b.set_from_fourier(delta_tau[s])
     g_0_inv = self.g_0_iw.copy()
     g_0_inv << inverse(self.g_0_iw)
     g_0_inv << g_0_inv + delta_iw - delta_iw_new
     self.g_0_iw << inverse(g_0_inv)
def _g_lat(sigma_lat, mu, eps, bz_grid, spins):
    n_k = len(bz_grid)
    n_bands = len(eps[0, :, :])
    g = [BlockGf(name_block_generator = [(s, sigma_lat[i][s]) for s in spins], name = '$G_{lat}$', make_copies = True) for i in range(n_k)]
    g_p = scatter_list(g)
    for g_k, sig_k, eps_k in izip(g_p, scatter_list(sigma_lat), scatter_list(eps)):
        for s, b in g_k:
            b << inverse((iOmega_n + mu) * identity(n_bands) - eps_k - sig_k[s])
    g = allgather_list(g_p)
    return g
Beispiel #8
0
 def make_g_0_iw_with_delta_tau_real(self, n_tau = 10000, verbosity = 0):
     delta_iw = delta(self.g_0_iw)
     delta_tau = self.get_delta_tau()
     for s, b in delta_tau:
         for n, tau in enumerate(b.mesh):
             if verbosity >= 2 and (b.data[:,:,:].imag > 10**-8).any():
                 print 'WARNING:'
                 print 'delta_tau.imag is of significant magnitude!'
             b.data[n,:,:] = b.data[n,:,:].real
             # Tail consistency is maintained anyways
             #for i in range(len(b.tail.data)):
             #    orbs = range(len(b.tail.data[i,:,:]))
             #    for j, k in product(orbs, orbs):
             #        b.tail.data[i,j,k] = b.tail.data[i,j,k].real
     delta_iw_new = self.g_0_iw.copy()
     for s, b in delta_iw_new:
         b.set_from_fourier(delta_tau[s])
     g_0_inv = self.g_0_iw.copy()
     g_0_inv << inverse(self.g_0_iw)
     g_0_inv << g_0_inv + delta_iw - delta_iw_new
     self.g_0_iw << inverse(g_0_inv)
Beispiel #9
0
def assign_weiss_field(G0, parms, nspins, spin_names, nflavors, flavor_names):
    hyb_mat_prefix = parms.get('HYB_MAT', '%s.hybmat'%parms['PREFIX'])
    hyb_mat = genfromtxt('%s.real'%hyb_mat_prefix)[:,1:]\
              + 1j*genfromtxt('%s.imag'%hyb_mat_prefix)[:,1:]
    hyb_tail = genfromtxt('%s.tail'%hyb_mat_prefix)
    mu_vec = genfromtxt(parms.get('MU_VECTOR', '%s.mu_eff'%parms['PREFIX'])) 
    for s in range(nspins):
        for f in range(nflavors):
            hyb_w = triqs_gf.GfImFreq(indices=[0], beta=parms['BETA'], 
                                      n_points=parms['N_MAX_FREQ'])
            hyb_w.data[:, 0, 0] = hyb_mat[:, nspins*f+s] 
            for n in range(len(hyb_tail)):
                hyb_w.tail[n+1][0, 0] = hyb_tail[n, nspins*f+s]
            block, i = mkind(spin_names[s], flavor_names[f])
            G0[block][i, i] << triqs_gf.inverse(triqs_gf.iOmega_n\
                                                +mu_vec[nspins*f+s]-hyb_w)
def _cumulant_lat(sigma, mu, ssp, rbz_grid, spins):
    n_k = len(rbz_grid)
    n_sites = len(ssp.values()[0])
    m_sl = [BlockGf(name_block_generator = [(s, GfImFreq(indices = range(n_sites), mesh = sigma[spins[0]].mesh)) for s in spins], name = '$M_{lat}$') for i in range(n_k)]
    m_c = BlockGf(name_block_generator = [(s, GfImFreq(indices = range(len(sigma[spins[0]].data[0, :, :])), mesh = sigma[spins[0]].mesh)) for s in spins], name = '$M_C$')
    for s, b in m_c: b << inverse(iOmega_n + mu - sigma[s])
    mTrans = dict()
    for r in ssp.keys():
        mTrans[r] = empty([n_sites, n_sites], dtype = object)
        for a in range(n_sites):
            for b in range(n_sites):
                mTrans[r][a,b] = ssp[r][a][b]
    m_sl_p = scatter_list(m_sl)
    for m, k in izip(m_sl_p, scatter_list(rbz_grid)):
        for s, b in m:
            for r, mTrans_r in mTrans.items():
                for a in range(n_sites):
                    for b in range(n_sites):                  
                        if type(mTrans_r[a, b]) == tuple:
                            m[s][a, b] += mTrans_r[a, b][2] * exp(complex(0, 2 * pi * dot(k, array(r)))) * m_c[s][mTrans_r[a, b][0], mTrans_r[a, b][1]]
    m_sl = allgather_list(m_sl_p)
    return m_sl
Beispiel #11
0
L = TBLattice ( units = [(1, 0, 0) , (0, 1, 0) ], hopping = hop)
SL = TBSuperLattice(tb_lattice =L, super_lattice_units = [ (2, 0), (0, 2) ])

# SumK function that will perform the sum over the BZ
SK = SumkDiscreteFromLattice (lattice = SL, n_points = 8, method = "Riemann")

# Defines G and Sigma with a block structure compatible with the SumK function
G= BlockGf( name_block_generator = [ (s, GfImFreq(indices = SK.GFBlocIndices, mesh = S.G.mesh)) for s in ['up', 'down'] ], make_copies = False)
Sigma = G.copy()

# Init Sigma
for n, B in S.Sigma : B <<= 2.0

S.symm_to_real(gf_in = S.Sigma, gf_out = Sigma) # Embedding

# Computes sum over BZ and returns density
dens = (SK(mu = Chemical_potential, Sigma = Sigma, field = None , result = G).total_density()/4)
mpi.report("Total density  = %.3f"%dens)

S.real_to_symm(gf_in = G, gf_out = S.G)       # Extraction
S.G0 = inverse(S.Sigma + inverse(S.G))                           # Finally get S.G0

# Solve the impurity problem
S.solve(n_cycles = 3000, n_warmup_cycles = 0, length_cycle = 10, n_legendre = 30)

# Opens the results shelve
if mpi.is_master_node():
  Results = HDFArchive("cdmft_4_sites.output.h5", 'w')
  Results["G"] = S.G
  Results["Gl"] = S.G_legendre
Beispiel #12
0
from pytriqs.plot.mpl_interface import oplot
from pytriqs.gf.local import GfImFreq, Omega, inverse

g = GfImFreq(indices=[0], beta=300, n_points=1000, name="g")
g << inverse(Omega + 0.5)

# the data we want to fit...
# The green function for omega \in [0,0.2]
X, Y = g.x_data_view(x_window=(0, 0.2), flatten_y=True)

from pytriqs.fit import Fit, linear, quadratic

fitl = Fit(X, Y.imag, linear)
fitq = Fit(X, Y.imag, quadratic)

oplot(g, '-o', x_window=(0, 5))
oplot(fitl, '-x', x_window=(0, 0.5))
oplot(fitq, '-x', x_window=(0, 1))

# a bit more complex, we want to fit with a one fermion level ....
# Cf the definition of linear and quadratic in the lib
one_fermion_level = lambda X, a, b: 1 / (a * X * 1j + b
                                         ), r"${1}/(%f x + %f)$", (1, 1)

fit1 = Fit(X, Y, one_fermion_level)
oplot(fit1, '-x', x_window=(0, 3))
Beispiel #13
0
from pytriqs.plot.mpl_interface import oplot
from pytriqs.gf.local import GfImFreq, Omega, inverse

g = GfImFreq(indices=[0], beta=300, n_points=1000, name="g")
g <<= inverse(Omega + 0.5)

# the data we want to fit...
# The green function for omega \in [0,0.2]
X, Y = g.x_data_view(x_window=(0, 0.2), flatten_y=True)

from pytriqs.fit import Fit, linear, quadratic

fitl = Fit(X, Y.imag, linear)
fitq = Fit(X, Y.imag, quadratic)

oplot(g, "-o", x_window=(0, 5))
oplot(fitl, "-x", x_window=(0, 0.5))
oplot(fitq, "-x", x_window=(0, 1))

# a bit more complex, we want to fit with a one fermion level ....
# Cf the definition of linear and quadratic in the lib
one_fermion_level = lambda X, a, b: 1 / (a * X * 1j + b), r"${1}/(%f x + %f)$", (1, 1)

fit1 = Fit(X, Y, one_fermion_level)
oplot(fit1, "-x", x_window=(0, 3))
Beispiel #14
0
# Import the Green's functions
from pytriqs.gf.local import GfImFreq, iOmega_n, inverse

# Create the Matsubara-frequency Green's function and initialize it
g = GfImFreq(indices=[1], beta=50, n_points=1000, name="imp")
g <<= inverse(iOmega_n + 0.5)

import pytriqs.utility.mpi as mpi

mpi.bcast(g)

#Block

from pytriqs.gf.local import *
g1 = GfImFreq(indices=['eg1', 'eg2'], beta=50, n_points=1000, name="egBlock")
g2 = GfImFreq(indices=['t2g1', 't2g2', 't2g3'],
              beta=50,
              n_points=1000,
              name="t2gBlock")
G = BlockGf(name_list=('eg', 't2g'), block_list=(g1, g2), make_copies=False)

mpi.bcast(G)

#imtime
from pytriqs.gf.local import *

# A Green's function on the Matsubara axis set to a semicircular
gw = GfImFreq(indices=[1], beta=50)
gw <<= SemiCircular(half_bandwidth=1)

# Create an imaginary-time Green's function and plot it
Beispiel #15
0
from pytriqs.gf.local import GfReFreq, Omega, Wilson, inverse
import numpy

eps_d,t  = 0.3, 0.2

# Create the real-frequency Green's function and initialize it
g = GfReFreq(indices = ['s','d'], window = (-2, 2), n_points = 1000, name = "$G_\mathrm{s+d}$")
g['d','d'] = Omega - eps_d
g['d','s'] = t
g['s','d'] = t
g['s','s'] = inverse( Wilson(1.0) )
g.invert()

# Plot it with matplotlib. 'S' means: spectral function ( -1/pi Imag (g) )
from pytriqs.plot.mpl_interface import *
oplot( g['d','d'], '-o', RI = 'S', x_window  = (-1.8,1.8), name = "Impurity" )
oplot( g['s','s'], '-x', RI = 'S', x_window  = (-1.8,1.8), name = "Bath" )
plt.show()
Beispiel #16
0
from pytriqs.gf.local import GfReFreq, Omega, Wilson, inverse
import numpy

eps_d, t = 0.3, 0.2

# Create the real-frequency Green's function and initialize it
g = GfReFreq(indices=["s", "d"], window=(-2, 2), n_points=1000, name="$G_\mathrm{s+d}$")
g["d", "d"] = Omega - eps_d
g["d", "s"] = t
g["s", "d"] = t
g["s", "s"] = inverse(Wilson(1.0))
g.invert()

# Plot it with matplotlib. 'S' means: spectral function ( -1/pi Imag (g) )
from pytriqs.plot.mpl_interface import oplot

oplot(g["d", "d"], "-o", RI="S", x_window=(-1.8, 1.8), name="Impurity")
oplot(g["s", "s"], "-x", RI="S", x_window=(-1.8, 1.8), name="Bath")
Beispiel #17
0
from pytriqs.plot.mpl_interface import oplot
from pytriqs.gf.local import GfImFreq, Omega, inverse

g = GfImFreq(indices = [0], beta = 300, n_points = 1000, name = "g")
g << inverse( Omega + 0.5 )

# the data we want to fit...
# The green function for omega \in [0,0.2]
X,Y = g.x_data_view (x_window = (0,0.2), flatten_y = True )

from pytriqs.fit import Fit, linear, quadratic

fitl = Fit ( X,Y.imag, linear )
fitq = Fit ( X,Y.imag, quadratic )

oplot (g,     '-o', x_window = (0,5) )     
oplot (fitl , '-x', x_window = (0,0.5) )
oplot (fitq , '-x', x_window = (0,1) )

# a bit more complex, we want to fit with a one fermion level ....
# Cf the definition of linear and quadratic in the lib
one_fermion_level  =  lambda X, a,b   : 1/(a * X *1j  + b),    r"${1}/(%f x + %f)$"    , (1,1)

fit1 = Fit ( X,Y, one_fermion_level )
oplot (fit1 , '-x', x_window = (0,3) )
    
Beispiel #18
0
# Defines G and Sigma with a block structure compatible with the SumK function
G = BlockGf(name_block_generator=[(s,
                                   GfImFreq(indices=SK.GFBlocIndices,
                                            mesh=S.G.mesh))
                                  for s in ['up', 'down']],
            make_copies=False)
Sigma = G.copy()

# Init Sigma
for n, B in S.Sigma:
    B <<= 2.0

S.symm_to_real(gf_in=S.Sigma, gf_out=Sigma)  # Embedding

# Computes sum over BZ and returns density
dens = (SK(mu=Chemical_potential, Sigma=Sigma, field=None,
           result=G).total_density() / 4)
mpi.report("Total density  = %.3f" % dens)

S.real_to_symm(gf_in=G, gf_out=S.G)  # Extraction
S.G0 = inverse(S.Sigma + inverse(S.G))  # Finally get S.G0

# Solve the impurity problem
S.solve(n_cycles=3000, n_warmup_cycles=0, length_cycle=10, n_legendre=30)

# Opens the results shelve
if mpi.is_master_node():
    Results = HDFArchive("cdmft_4_sites.output.h5", 'w')
    Results["G"] = S.G
    Results["Gl"] = S.G_legendre
Beispiel #19
0
# Import the Green's functions 
from pytriqs.gf.local import GfImFreq, iOmega_n, inverse

# Create the Matsubara-frequency Green's function and initialize it
g = GfImFreq(indices = [1], beta = 50, n_points = 1000, name = "$G_\mathrm{imp}$")
g << inverse( iOmega_n + 0.5 )

from pytriqs.plot.mpl_interface import oplot
oplot(g, '-o',  x_window  = (0,10))

Beispiel #20
0
from pytriqs.plot.mpl_interface import oplot
from pytriqs.gf.local import GfImFreq, Omega, inverse

g = GfImFreq(indices=[0], beta=300, n_points=1000, name="g")
g <<= inverse(Omega + 0.5)

# the data we want to fit...
# The green function for omega \in [0,0.2]
X, Y = g.x_data_view(x_window=(0, 0.2), flatten_y=True)

from pytriqs.fit import Fit, linear, quadratic

fitl = Fit(X, Y.imag, linear)
fitq = Fit(X, Y.imag, quadratic)

oplot(g, '-o', x_window=(0, 5))
oplot(fitl, '-x', x_window=(0, 0.5))
oplot(fitq, '-x', x_window=(0, 1))

# a bit more complex, we want to fit with a one fermion level ....
# Cf the definition of linear and quadratic in the lib
one_fermion_level = lambda X, a, b: 1 / (a * X * 1j + b
                                         ), r"${1}/(%f x + %f)$", (1, 1)

fit1 = Fit(X, Y, one_fermion_level)
oplot(fit1, '-x', x_window=(0, 3))
Beispiel #21
0
from pytriqs.gf.local import GfReFreq, Omega, Wilson, inverse
import numpy

eps_d,t  = 0.3, 0.2

# Create the real-frequency Green's function and initialize it
g = GfReFreq(indices = ['s','d'], window = (-2, 2), n_points = 1000, name = "$G_\mathrm{s+d}$")
g['d','d'] = Omega - eps_d
g['d','s'] = t
g['s','d'] = t
g['s','s'] = inverse( Wilson(1.0) )
g.invert()

# Plot it with matplotlib. 'S' means: spectral function ( -1/pi Imag (g) )
from pytriqs.plot.mpl_interface import oplot
oplot( g['d','d'], '-o', RI = 'S', x_window  = (-1.8,1.8), name = "Impurity" )
oplot( g['s','s'], '-x', RI = 'S', x_window  = (-1.8,1.8), name = "Bath" )
Beispiel #22
0
    def run_dmft_loops(self, n_dmft_loops = 1):
        """runs the DMFT calculation"""
        clp = p = CleanLoopParameters(self.get_parameters())
        report = Reporter(**clp)
        report('Parameters:', clp)
        scheme = Scheme(**clp)
        dmft = DMFTObjects(**clp)
        raw_dmft = DMFTObjects(**clp)
        g_0_c_iw, g_c_iw, sigma_c_iw, dmu = dmft.get_dmft_objs() # ref, ref, ref, value

        report('Initializing...')
        if clp['nambu']:
            transf = NambuTransformation(**clp)
            scheme.set_pretransf(transf.pretransformation(), transf.pretransformation_inverse())
            raw_transf = NambuTransformation(**clp)
        else:
            transf = ClustersiteTransformation(g_loc = scheme.g_local(sigma_c_iw, dmu), **clp)
            clp.update({'g_transf_struct': transf.get_g_struct()})
            raw_transf = ClustersiteTransformation(**clp)
        
        transf.set_hamiltonian(**clp)
        report('Transformation ready')
        report('New basis:', transf.get_g_struct())
        impurity = Solver(beta = clp['beta'], gf_struct = dict(transf.get_g_struct()), 
                          n_tau = clp['n_tau'], n_iw = clp['n_iw'], n_l = clp['n_legendre'])
        impurity.Delta_tau.name = '$\\tilde{\\Delta}_c$'
        rnames = random_generator_names_list()
        report('H = ', transf.hamiltonian)
        report('Impurity solver ready')
        report('')

        for loop_nr in range(self.next_loop(), self.next_loop() + n_dmft_loops):
            report('DMFT-loop nr. %s'%loop_nr)
            if mpi.is_master_node(): duration = time()

            report('Calculating dmu...')
            dmft.find_dmu(scheme, **clp)
            g_0_c_iw, g_c_iw, sigma_c_iw, dmu = dmft.get_dmft_objs()
            report('dmu = %s'%dmu)

            report('Calculating local Greenfunction...')
            g_c_iw << scheme.g_local(sigma_c_iw, dmu)
            g_c_iw << addExtField(g_c_iw, p['ext_field'])
            if mpi.is_master_node() and p['verbosity'] > 1: checksym_plot(g_c_iw, p['archive'][0:-3] + 'Gchecksym' + str(loop_nr) + '.pdf')
            report('Calculating Weiss-field...')
            g_0_c_iw << inverse(inverse(g_c_iw) + sigma_c_iw)

            dmft.make_g_0_iw_with_delta_tau_real()

            report('Changing basis...')
            transf.set_dmft_objs(*dmft.get_dmft_objs())
            if mpi.is_master_node() and p['verbosity'] > 1: 
                checktransf_plot(transf.get_g_iw(), p['archive'][0:-3] + 'Gchecktransf' + str(loop_nr) + '.pdf')
                checktransf_plot(g_0_c_iw, p['archive'][0:-3] + 'Gweisscheck' + str(loop_nr) + '.pdf')
                checksym_plot(inverse(transf.g_0_iw), p['archive'][0:-3] + 'invGweisscheckconst' + str(loop_nr) + '.pdf')
                #checksym_plot(inverse(transf.get_g_iw()), p['archive'][0:-3] + 'invGsymcheckconst' + str(loop_nr) + '.pdf')

            if not clp['random_name']: clp.update({'random_name': rnames[int((loop_nr + mpi.rank) % len(rnames))]}) # TODO move
            if not clp['random_seed']: clp.update({'random_seed': 862379 * mpi.rank + 12563 * self.next_loop()})
            impurity.G0_iw << transf.get_g_0_iw()
            report('Solving impurity problem...')
            mpi.barrier()
            impurity.solve(h_int = transf.get_hamiltonian(), **clp.get_cthyb_parameters())

            if mpi.is_master_node() and p['verbosity'] > 1:
                checksym_plot(inverse(impurity.G0_iw), p['archive'][0:-3] + 'invGweisscheckconstsolver' + str(loop_nr) + '.pdf')
            report('Postprocessing measurements...')
            if clp['measure_g_l']:
                for ind, g in transf.get_g_iw(): g  << LegendreToMatsubara(impurity.G_l[ind])
            else:
                for ind, g in transf.get_g_iw(): g.set_from_fourier(impurity.G_tau[ind])
            raw_transf.set_dmft_objs(transf.get_g_0_iw(),
                                     transf.get_g_iw(),
                                     inverse(transf.get_g_0_iw()) - inverse(transf.get_g_iw()))
            if clp['measure_g_tau'] and clp['fit_tail']:
                for ind, g in transf.get_g_iw():
                    for tind in transf.get_g_struct():
                        if tind[0] == ind: block_inds = tind[1]
                    fixed_moments = TailGf(len(block_inds), len(block_inds), 1, 1)
                    fixed_moments[1] = identity(len(block_inds))
                    g.fit_tail(fixed_moments, 3, clp['tail_start'], clp['n_iw'] - 1)
            if mpi.is_master_node() and p['verbosity'] > 1: checksym_plot(inverse(transf.get_g_iw()), p['archive'][0:-3] + 'invGsymcheckconstsolver' + str(loop_nr) + '.pdf')
            report('Backtransforming...')
            transf.set_sigma_iw(inverse(transf.get_g_0_iw()) - inverse(transf.get_g_iw()))
            dmft.set_dmft_objs(*transf.get_backtransformed_dmft_objs())
            dmft.set_dmu(dmu)
            raw_dmft.set_dmft_objs(*raw_transf.get_backtransformed_dmft_objs())
            raw_dmft.set_dmu(dmu)

            if clp['mix']: dmft.mix()
            if clp['impose_paramagnetism']: dmft.paramagnetic()
            if clp['impose_afm']: dmft.afm()
            if clp['site_symmetries']: dmft.site_symmetric(clp['site_symmetries'])
            density = scheme.apply_pretransf_inv(dmft.get_g_iw(), True).total_density()

            report('Saving results...')
            if mpi.is_master_node():
                a = HDFArchive(p['archive'], 'a')
                if not a.is_group('results'):
                    a.create_group('results')
                a_r = a['results']
                a_r.create_group(str(loop_nr))
                a_l = a_r[str(loop_nr)]
                a_l['g_c_iw'] = dmft.get_g_iw()
                a_l['g_c_iw_raw'] = raw_dmft.get_g_iw()
                a_l['g_transf_iw'] = transf.get_g_iw()
                a_l['g_transf_iw_raw'] = raw_transf.get_g_iw()
                a_l['sigma_c_iw'] = dmft.get_sigma_iw()
                a_l['sigma_c_iw_raw'] = raw_dmft.get_sigma_iw()
                a_l['sigma_transf_iw'] = transf.get_sigma_iw()
                a_l['sigma_transf_iw_raw'] = raw_transf.get_sigma_iw()
                a_l['g_0_c_iw'] = dmft.get_g_0_iw()
                a_l['g_0_c_iw_raw'] = raw_dmft.get_g_0_iw()
                a_l['g_0_transf_iw'] = transf.get_g_0_iw()
                a_l['g_0_transf_iw_raw'] = raw_transf.get_g_0_iw()
                a_l['dmu'] = dmft.get_dmu()
                a_l['density'] = density
                a_l['loop_time'] = {'seconds': time() - duration,
                                    'hours': (time() - duration)/3600., 
                                    'days': (time() - duration)/3600./24.}
                a_l['n_cpu'] = mpi.size
                a_l['cdmft_code_version'] = CDmft._version
                clp_dict = dict()
                clp_dict.update(clp)
                a_l['parameters'] = clp_dict
                a_l['triqs_code_version'] = version

                a_l['delta_transf_tau'] = impurity.Delta_tau
                if clp['measure_g_l']: a_l['g_transf_l'] = impurity.G_l
                if clp['measure_g_tau']: a_l['g_transf_tau'] = impurity.G_tau
                a_l['sign'] = impurity.average_sign
                if clp['measure_density_matrix']: a_l['density_matrix'] = impurity.density_matrix
                a_l['g_atomic_tau'] = impurity.atomic_gf
                a_l['h_loc_diagonalization'] = impurity.h_loc_diagonalization
                if a_r.is_data('n_dmft_loops'):
                    a_r['n_dmft_loops'] += 1
                else:
                    a_r['n_dmft_loops'] = 1
                del a_l, a_r, a
            report('Loop done')
            report('')
            mpi.barrier()