Example #1
0
def load_parms_from_file(filename):
    parms = readParameters(filename)
    for s in ('NSPINS', 'NFLAVORS', 'N_CUTOFF', 'N_MAX_FREQ', 'N_TAU',
              'MEASURE',
              'n_cycles', 'length_cycle', 'n_warmup_cycles', 'max_time'):
        if s in parms: parms[s] = int(parms[s])
    for s in ('BETA', 'U', 'J'):
        if s in parms: parms[s] = float(parms[s])
    return parms
Example #2
0
    return out

def get_density_matrix(beta, g):
    nspins = size(g, 0)
    nfreq = size(g, 1)
    nflavors = size(g, 2)

    density = zeros((nspins, nflavors, nflavors))
    for s in range(nspins):
        density[s] = 2./beta*real(sum(g[s], 0)) + 0.5*eye(nflavors)
    return density


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='DMFT process.');
    parser.add_argument('-p', dest='parmsfile', type = str, required = True, help='Parameter file');
    parser.add_argument('-se', dest='sefilename', type = str, default = None, help='Matsubara frequency self energy');
    args = parser.parse_args(sys.argv[1:]);

    set_printoptions(linewidth=150, suppress=True, precision=4);
    parms = readParameters(args.parmsfile);

    beta = float(parms['BETA'])
    iwn, g = getGavgFromSelfEnergy(parms, args.sefilename);
    density = []
    for ll in range(len(g)):
        density.append(get_density_matrix(beta, g[ll]).flatten())
    savetxt('density.dat', density)


Example #3
0
from pytriqs.applications.impurity_solvers.cthyb_matrix import Solver
import pytriqs.utility.mpi as mpi

import sys, os, time
from share_fun import val_def, readParameters;
from numpy import *;


#
# Interface for TRIQS solver
# Caution: works for diagonal Weiss field only
#


# input data
parms = readParameters(sys.argv[1]);
NCOR = int(parms['NCOR']); 
SPINS = 2; spins = ('up', 'dn');
BETA = float(parms['BETA']);
hyb_mat = genfromtxt(parms['HYB_MAT']+'.real')[:,1:] + 1j*genfromtxt(parms['HYB_MAT']+'.imag')[:,1:];
hyb_coefs = genfromtxt(parms['HYB_MAT']+'.tail');
MUvector = genfromtxt(parms['MU_VECTOR']); 

solver_parms = {
        'n_cycles'        : int(parms['SWEEPS_EACH_NODE']),
        'length_cycle'    : int(parms['N_MEAS']),
        'n_warmup_cycles' : int(parms['THERMALIZATION']),
        'random_seed'     : int(1e6*time.time()*(mpi.rank+1) % 1e6)
        };