Beispiel #1
0
    def solve(self, U_interact=None, J_hund=None, use_spinflip=False,
                 use_matrix = True, l=2, T=None, dim_reps=None, irep=None, deg_orbs = [], sl_int = None, **params):

        self.use_spinflip = use_spinflip
        self.U, self.Up, self.U4ind, self.offset = set_U_matrix(U_interact,J_hund,self.n_orb,l,use_matrix,T,sl_int,use_spinflip,dim_reps,irep) 

        # define mapping of indices:
        self.map_ind={}
        for nm in self.map:
            bl_names = self.map[nm]
            block = []
            for a,al in self.gf_struct:
                if a in bl_names: block.append(al)
                        
            self.map_ind[nm] = range(self.n_orb)
            i = 0
            for al in block:
                cnt = 0
                for a in range(len(al)):
                    self.map_ind[nm][i] = cnt
                    i = i+1
                    cnt = cnt+1
        
        # set the Hamiltonian
        if (use_spinflip==False):
            Hamiltonian = self.__set_hamiltonian_density()
        else:
            if (use_matrix):
                #Hamiltonian = self.__set_full_hamiltonian_slater()
                Hamiltonian = self.__set_spinflip_hamiltonian_slater()
            else:
                Hamiltonian = self.__set_full_hamiltonian_kanamori(J_hund = J_hund)

        # set the Quantum numbers
        Quantum_Numbers = self.__set_quantum_numbers(self.gf_struct)
    
        # Determine if there are only blocs of size 1:
        self.blocssizeone = True
        for ib in self.gf_struct:
            if (len(ib[1])>1): self.blocssizeone = False

        nc = params.pop("n_cycles",10000)
        if ((self.blocssizeone) and (self.use_spinflip==False)):
            use_seg = True
        else:
            use_seg = False
        #gm = self.set_global_moves(deg_orbs)

        Solver.solve(self,H_local = Hamiltonian, quantum_numbers = Quantum_Numbers, n_cycles = nc, use_segment_picture = use_seg, **params)
Beispiel #2
0
    def __init__(self, beta, n_orb, gf_struct = False, map = False):

        self.n_orb = n_orb

        # either get or construct gf_struct
        if (gf_struct):
            assert map, "give also the mapping!"
            self.map = map
        else:
            # standard gf_struct and map
            gf_struct = [ ('%s'%(ud),[n for n in range(n_orb)]) for ud in ['up','down'] ]
            self.map = {'up' : ['up' for v in range(n_orb)], 'down' : ['down' for v in range(n_orb)]}

        # now initialize the solver with the stuff given above:
        Solver.__init__(self, beta = beta, gf_struct = gf_struct)
from pytriqs.archive import HDFArchive
from pytriqs.gf.local import *

#
#  Example of DMFT single site solution with CTQMC
#

# set up a few parameters
Half_Bandwidth= 1.0
U = 2.5
Chemical_Potential = U/2.0
beta = 100

# Construct a CTQMC solver
from pytriqs.applications.impurity_solvers.cthyb_matrix import Solver
S = Solver(beta = beta, gf_struct = [ ('up',[1]), ('down',[1]) ])

# init the Green function
S.G <<= SemiCircular(Half_Bandwidth)

# Impose Paramagnetism
g = 0.5*(S.G['up']+S.G['down'])
for name, bloc in S.G : bloc <<= g

# Compute G0
for sig,g0 in S.G0 :
  g0 <<= inverse( iOmega_n + Chemical_Potential - (Half_Bandwidth/2.0)**2  * S.G[sig] )

# Solve
#from pytriqs.applications.impurity_solvers.operators import *
from pytriqs.operators import *
Beispiel #4
0
from pytriqs.gf.local import *
from pytriqs.operators import *
from pytriqs.applications.impurity_solvers.cthyb_matrix import Solver

# Parameters
D, V, U = 1.0, 0.2, 4.0
e_f, beta = -U/2.0, 50

# Construct the impurity solver with the inverse temperature
# and the structure of the Green's functions
S = Solver(beta = beta, gf_struct = [ ('up',[1]), ('down',[1]) ])

# 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(H_local = U * N('up',1) * N('down',1),   # Local Hamiltonian 
        quantum_numbers = {                      # Quantum Numbers 
          'Nup' : N('up',1),                     # Operators commuting with H_Local
          'Ndown' : N('down',1) },          
        n_cycles  = 500000,                      # Number of QMC cycles
        length_cycle = 200,                      # Length of one cycle 
        n_warmup_cycles = 10000,                 # Warmup cycles
        n_legendre = 50,                         # Number of Legendre coefficients
        random_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) }
        )
Beispiel #5
0
from pytriqs.gf.local import *
from pytriqs.operators import *
from pytriqs.archive import HDFArchive
from pytriqs.applications.impurity_solvers.cthyb_matrix import Solver
import pytriqs.utility.mpi as mpi

D, V, U = 1.0, 0.2, 4.0
e_f, beta = -U / 2.0, 50

# Construct the impurity solver
S = Solver(beta=beta, gf_struct=[('up', [1]), ('down', [1])])

# Loop for two random generators
for random_name in ['mt11213b', 'lagged_fibonacci607']:

    for spin, g0 in S.G0:
        g0 <<= inverse(iOmega_n - e_f - V**2 * Wilson(D))

    # Solve using random_name as a generator
    S.solve(
        H_local=U * N('up', 1) * N('down', 1),  # Local Hamiltonian
        quantum_numbers={  # Quantum Numbers
            'Nup': N('up', 1),  # (operators commuting with H_Local)
            'Ndown': N('down', 1)
        },
        n_cycles=100000,  # Number of QMC cycles
        length_cycle=200,  # Length of one cycle
        n_warmup_cycles=10000,  # Warmup cycles
        random_name=random_name,  # Name of the random generator
        use_segment_picture=True)  # Use the segment picture
Beispiel #6
0
from pytriqs.gf.local import *
from pytriqs.operators import *
from pytriqs.archive import *
import pytriqs.utility.mpi as mpi

# Set up a few parameters
U = 2.5
half_bandwidth = 1.0
chemical_potential = U / 2.0
beta = 100
n_loops = 5

# Construct the CTQMC solver
from pytriqs.applications.impurity_solvers.cthyb_matrix import Solver
S = Solver(beta=beta, gf_struct=[('up', [1]), ('down', [1])])

# Initalize the Green's function to a semi circular
S.G <<= SemiCircular(half_bandwidth)

# Now do the DMFT loop
for IterationNumber in range(n_loops):

    # Compute S.G0 with the self-consistency condition while imposing paramagnetism
    g = 0.5 * (S.G['up'] + S.G['down'])
    for name, g0block in S.G0:
        g0block <<= inverse(iOmega_n + chemical_potential -
                            (half_bandwidth / 2.0)**2 * g)

    # Run the solver
    S.solve(
        H_local=U * N('up', 1) * N('down', 1),  # Local Hamiltonian
Beispiel #7
0
    Ntot = sum( [ N('%s%d'%(s,f),0) for s in spins for f in range(NCOR) ]);
    Sz   = sum( [ N('%s%d'%(spins[0],f),0) - N('%s%d'%(spins[1],f),0) for f in range(NCOR) ]);
    Quantum_Numbers = { 'Ntot' : Ntot, 'Sztot' : Sz };
    for f in range(NCOR):
        Quantum_Numbers['Sz2_%d'%f] = N('%s%d'%(spins[0],f),0) + N('%s%d'%(spins[1],f),0) - 2*N('%s%d'%(spins[0],f),0)*N('%s%d'%(spins[1],f),0)
else:
    Quantum_Numbers = {};
    for sp in spins:
        for f in range(NCOR): Quantum_Numbers['N%s%d'%(sp,f)] = N('%s%d'%(sp,f),0);
solver_parms['quantum_numbers'] = Quantum_Numbers;
solver_parms['use_segment_picture'] = int(parms['SPINFLIP']) == 0;
solver_parms['H_local'] = H_Local;


# create a solver object
solver = Solver(beta = BETA, gf_struct = GFstruct, n_w = int(val_def(parms, 'N_MATSUBARA', len(hyb_mat))));


# Legendre or Time accumulation
accumulation = val_def(parms, 'ACCUMULATION', 'time');
if accumulation not in ['time', 'legendre']: exit('ACCUMULATION should be either "time" or "legendre"');
if accumulation == 'time': 
    solver_parms['time_accumulation'] = True;
    solver_parms['legendre_accumulation'] = False;
    solver_parms['fit_start'] = len(hyb_mat)-10;
    solver_parms['fit_stop']  = len(hyb_mat)-1;  # I don't want to use the fitTails()
elif accumulation == 'legendre':
    solver_parms['legendre_accumulation'] = True;
    solver_parms['n_legendre'] = int(val_def(parms, 'N_LEGENDRE', 50));

Beispiel #8
0
from pytriqs.gf.local import *
from pytriqs.operators import *
from pytriqs.archive import *
import pytriqs.utility.mpi as mpi

# Set up a few parameters
U = 2.5
half_bandwidth = 1.0
chemical_potential = U / 2.0
beta = 100
n_loops = 5

# Construct the CTQMC solver
from pytriqs.applications.impurity_solvers.cthyb_matrix import Solver

S = Solver(beta=beta, gf_struct=[("up", [1]), ("down", [1])])

# Initalize the Green's function to a semi circular
S.G <<= SemiCircular(half_bandwidth)

# Now do the DMFT loop
for IterationNumber in range(n_loops):

    # Compute S.G0 with the self-consistency condition while imposing paramagnetism
    g = 0.5 * (S.G["up"] + S.G["down"])
    for name, g0block in S.G0:
        g0block <<= inverse(iOmega_n + chemical_potential - (half_bandwidth / 2.0) ** 2 * g)

    # Run the solver
    S.solve(
        H_local=U * N("up", 1) * N("down", 1),  # Local Hamiltonian
Beispiel #9
0
from pytriqs.gf.local import *
from pytriqs.operators import *
from pytriqs.archive import HDFArchive
from pytriqs.applications.impurity_solvers.cthyb_matrix import Solver
import pytriqs.utility.mpi as mpi

D, V, U = 1.0, 0.2, 4.0
e_f, beta = -U/2.0, 50

# Construct the impurity solver
S = Solver(beta = beta, gf_struct = [ ('up',[1]), ('down',[1]) ])

# Loop for two random generators
for random_name in ['mt11213b','lagged_fibonacci607']:

  for spin, g0 in S.G0 :
    g0 <<= inverse( iOmega_n - e_f - V**2 * Wilson(D) )

  # Solve using random_name as a generator
  S.solve(H_local = U * N('up',1) * N('down',1), # Local Hamiltonian
          quantum_numbers = {                    # Quantum Numbers
               'Nup' : N('up',1),                # (operators commuting with H_Local)
               'Ndown' : N('down',1) },
          n_cycles = 100000,                     # Number of QMC cycles
          length_cycle = 200,                    # Length of one cycle
          n_warmup_cycles = 10000,               # Warmup cycles
          random_name = random_name,             # Name of the random generator
          use_segment_picture = True)            # Use the segment picture

  # Save the results in an hdf5 file (only on the master node)
  if mpi.is_master_node():
Beispiel #10
0
from pytriqs.archive import HDFArchive
from pytriqs.gf.local import *

#
#  Example of DMFT single site solution with CTQMC
#

# set up a few parameters
Half_Bandwidth = 1.0
U = 2.5
Chemical_Potential = U / 2.0
beta = 100

# Construct a CTQMC solver
from pytriqs.applications.impurity_solvers.cthyb_matrix import Solver
S = Solver(beta=beta, gf_struct=[('up', [1]), ('down', [1])])

# init the Green function
S.G <<= SemiCircular(Half_Bandwidth)

# Impose Paramagnetism
g = 0.5 * (S.G['up'] + S.G['down'])
for name, bloc in S.G:
    bloc <<= g

# Compute G0
for sig, g0 in S.G0:
    g0 <<= inverse(iOmega_n + Chemical_Potential -
                   (Half_Bandwidth / 2.0)**2 * S.G[sig])

# Solve
Beispiel #11
0
from pytriqs.gf.local import *
from pytriqs.operators import *
from pytriqs.applications.impurity_solvers.cthyb_matrix import Solver

# parameters
D, V, U = 1.0, 0.2, 4.0
e_f, beta = -U / 2.0, 50

# construct the impurity solver with the inverse temperature
# and the structure of the Green's functions
S = Solver(beta=beta, gf_struct=[('up', [1]), ('down', [1])])

# 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(
    H_local=U * N('up', 1) * N('down', 1),  # Local Hamiltonian 
    quantum_numbers={  # Quantum Numbers 
        'Nup': N('up', 1),  # Operators commuting with H_Local
        'Ndown': N('down', 1)
    },
    n_cycles=20000,  # Number of QMC cycles
    length_cycle=20,  # Length of one cycle 
    n_warmup_cycles=1000,  # Warmup cycles
    n_legendre=50,  # Number of Legendre coefficients
    random_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)