Example #1
0
    N_Legendre_Coeffs=50,  # Number of Legendre coefficients
    Random_Generator_Name='mt19937',  # Name of the random number generator
    Use_Segment_Picture=True,  # Use the segment picture
    Measured_Operators={  # Operators to be averaged
        'Nimp': N('up', 1) + N('down', 1)
    },
    Global_Moves=[  # Global move in the QMC
        (0.05, lambda (a, alpha, dag): ({
            'up': 'down',
            'down': 'up'
        }[a], alpha, dag))
    ],
)

# Initialize the non-interacting Green's function S.G0
for spin, g0 in S.G0:
    g0 <<= inverse(iOmega_n - e_f - V**2 * Wilson(D))

# Run the solver. The result will be in S.G
S.Solve()

# Save the results in an hdf5 file (only on the master node)
from pytriqs.Base.Archive import HDF_Archive
import pytriqs.Base.Utility.MPI as MPI

if MPI.IS_MASTER_NODE():
    Results = HDF_Archive("solution.h5", 'w')
    Results["G"] = S.G
    Results["Gl"] = S.G_Legendre
    Results["Nimp"] = S.Measured_Operators_Results['Nimp']