def __init__(self,Beta,Norb,U_interact,J_Hund) : # NB : the Hamiltonian should NOT contain the quadratic part which is in G0 Hamiltonian = U_interact * sum_list( [ N('up',i)*N('down',i) for i in range(Norb) ] ) for i in range(Norb-1): for j in range(i+1,Norb): Hamiltonian += (U_interact-2*J_Hund) * ( N('up',i) * N('down',j) + N('down',i) * N('up',j) ) + \ (U_interact-3*J_Hund) * ( N('up',i) * N('up',j) + N('down',i) * N('down',j) ) #Quantum_Numbers = {} #for i in range(Norb): # Quantum_Numbers['N%sup'%(i+1)] = N('up',i) # Quantum_Numbers['N%sdown'%(i+1)] = N('down',i) Ntot = sum_list( [ N(s,i) for s in ['up','down'] for i in range(Norb) ] ) Sz = sum_list( [ N('up',i)-N('down',i) for i in range(Norb) ] ) Quantum_Numbers = {'Ntot' : Ntot, 'Sz' : Sz} Solver.__init__(self, Beta = Beta, GFstruct = [ ('%s'%(ud),[n for n in range(Norb)]) for ud in ['up','down'] ], H_Local = Hamiltonian, Quantum_Numbers = Quantum_Numbers ) self.N_Cycles = 10000
def __init__(self,Beta,U_interact,J_Hund) : GFstruct = [ ('1up',[1]), ('1down',[1]), ('23up',[1,2]), ('23down',[1,2]) ] # NB : the Hamiltonian should NOT contain the quadratic part which is in G0 #Hamiltonian = U_interact * sum_list( [ N('%d-up'%(i+1),1)*N('%d-down'%(i+1),1) for i in range(3) ] ) Hamiltonian = U_interact * ( N('1up',1)*N('1down',1) + N('23up',1)*N('23down',1) + N('23up',2)*N('23down',2) ) Hamiltonian += (U_interact-2.0*J_Hund) * ( N('1up',1) * (N('23down',1)+N('23down',2)) + N('23up',1) * N('23down',2) ) Hamiltonian += (U_interact-2.0*J_Hund) * ( N('1down',1) * (N('23up',1)+N('23up',2)) + N('23up',2) * N('23down',1) ) for s in ['up','down']: Hamiltonian += (U_interact-3.0*J_Hund) * (N('1%s'%s,1) * (N('23%s'%s,1)+N('23%s'%s,2)) + N('23%s'%s,1)*N('23%s'%s,2) ) # for i in range(2): # for j in range(i+1,3): # Hamiltonian += (U_interact-2*J_Hund) * ( N('%d-up'%(i+1),1) * N('%d-down'%(j+1),1) + # N('%d-down'%(i+1),1) * N('%d-up'%(j+1),1) ) + \ # (U_interact-3*J_Hund) * ( N('%d-up'%(i+1),1) * N('%d-up'%(j+1),1) + # N('%d-down'%(i+1),1) * N('%d-down'%(j+1),1) ) # Quantum_Numbers = { 'N1up' : N('1-up',1), 'N1down' : N('1-down',1), # 'N2up' : N('2-up',1), 'N2down' : N('2-down',1), # 'N3up' : N('3-up',1), 'N3down' : N('3-down',1) } Quantum_Numbers = { 'N1up' : N('1up',1), 'N1down' : N('1down',1), 'N23up' : N('23up',1)+N('23up',2), 'N23down' : N('23down',1)+N('23down',2) } Solver.__init__(self, Beta = Beta, GFstruct = GFstruct, H_Local = Hamiltonian, Quantum_Numbers = Quantum_Numbers ) self.N_Cycles = 10000
def __init__(self, beta, n_orb, U_interact=None, J_hund=None, gf_struct=False, map=False, use_spinflip=False, use_matrix = True, l=2, T=None, dim_reps=None, irep=None, deg_orbs = [], sl_int = None): self.offset = 0 self.use_spinflip = use_spinflip self.n_orb = n_orb self.U, self.Up, self.U4ind, self.offset = set_U_matrix(U_interact,J_hund,n_orb,l,use_matrix,T,sl_int,use_spinflip,dim_reps,irep) 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(self.n_orb)], 'down' : ['down' for v in range(self.n_orb)]} #print gf_struct,self.map 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) Quantum_Numbers = self.__set_quantum_numbers(gf_struct) # Determine if there are only blocs of size 1: self.blocssizeone = True for ib in gf_struct: if (len(ib[1])>1): self.blocssizeone = False # now initialize the solver with the stuff given above: Solver.__init__(self, beta = beta, GFstruct = gf_struct, H_Local = Hamiltonian, Quantum_Numbers = Quantum_Numbers ) #self.set_global_moves(deg_orbs) self.N_Cycles = 10000 self.Nmax_Matrix = 100 self.N_Time_Slices_Delta= 10000 #if ((len(gf_struct)==2*n_orb) and (use_spinflip==False)): if ((self.blocssizeone) and (use_spinflip==False)): self.Use_Segment_Picture = True else: self.Use_Segment_Picture = False
def __init__(self,Beta,U_interact) : self.P = numpy.array([[1,1,1,1], [1,-1,1,-1],[1,1,-1,-1],[1,-1,-1,1]])/2. self.Pinv = numpy.linalg.inv(self.P) def Cdiag(s): s= '-%s'%s return [ C('00'+s,1), C('10'+s,1), C('01'+s,1),C('11'+s,1) ] Cnat,Nnat={},{} for i in range(4) : s= 'up-%d'%(i+1) Cnat[s] = sum_list( [ self.P[i,j]*c for j,c in enumerate(Cdiag('up'))] ) Nnat[s] = Cnat[s].dagger() * Cnat[s] s= 'down-%d'%(i+1) Cnat[s] = sum_list( [ self.P[i,j]*c for j,c in enumerate(Cdiag('down'))] ) Nnat[s] = Cnat[s].dagger() * Cnat[s] def symm(s): s= '-%s'%s Cdag('00'+s,1).symmetry()['kx'] = 1 Cdag('10'+s,1).symmetry()['kx'] = -1 Cdag('01'+s,1).symmetry()['kx'] = 1 Cdag('11'+s,1).symmetry()['kx'] = -1 Cdag('00'+s,1).symmetry()['ky'] = 1 Cdag('10'+s,1).symmetry()['ky'] = 1 Cdag('01'+s,1).symmetry()['ky'] = -1 Cdag('11'+s,1).symmetry()['ky'] = -1 symm('up'); symm('down') # NB : the Hamiltonian should NOT contain the quadratic part which is in G0 Hamiltonian = U_interact* sum_list( [ Nnat['up-%d'%(i+1)]* Nnat['down-%d'%(i+1)] for i in range (4)]) N_u = sum_list( [ Nnat['up-%d'%(i+1)] for i in range(4) ] ) N_d = sum_list( [ Nnat['down-%d'%(i+1)] for i in range(4) ] ) Quantum_Numbers = { 'kx' : 'kx', 'ky' : 'ky', 'N_u' : N_u, 'N_d' : N_d } Solver.__init__(self, Beta = Beta, GFstruct = [ ('00-up',[1]), ('10-up',[1]), ('01-up',[1]), ('11-up',[1]), ('00-down',[1]), ('10-down',[1]), ('01-down',[1]), ('11-down',[1]) ], H_Local = Hamiltonian, Quantum_Numbers = Quantum_Numbers, Nmax = 2000) self.N_Cycles = 100000 self.N_Frequencies_Accumulated = 4*int(0.075*Beta/(2*3.1415)) self.fitting_Frequency_Start = 3*int(0.075*Beta/(2*3.1415)) self.Length_Cycle = 100 self.Nmax_Matrix = 200 self.Use_Segment_Picture = False
def __init__(self,Beta,U_interact) : Hamiltonian = U_interact*( N('1-up',1)*N('1-down',1) + N('1-up',1)*N('2-up',1) + N('1-up',1)*N('2-down',1) + N('1-down',1)*N('2-up',1) + N('1-down',1)*N('2-down',1) + N('2-up',1)*N('2-down',1) ) Quantum_Numbers = { 'Nup' : N('1-up',1)+N('2-up',1), 'Ndown' : N('1-down',1)+N('2-down',1), 'Lz' : N('1-up',1)+N('1-down',1)-N('2-up',1)-N('2-down',1) } Solver.__init__(self, Beta = Beta, GFstruct = [ ('1-up',[1]), ('1-down',[1]), ('2-up',[1]), ('2-down',[1]) ], H_Local = Hamiltonian, Quantum_Numbers = Quantum_Numbers ) self.N_Cycles = 1000000 self.Nmax_Matrix = 300
def __init__(self,Beta,U_interact) : self.P = numpy.array([[1,1,1,1], [1,-1,1,-1],[1,1,-1,-1],[1,-1,-1,1]])/2. self.Pinv = numpy.linalg.inv(self.P) def Cdiag(s): s= '-%s'%s return [ C('00'+s,1), C('10'+s,1), C('01'+s,1),C('11'+s,1) ] Cnat,Nnat={},{} for i in range(4) : s= 'up-%d'%(i+1) Cnat[s] = sum_list( [ self.P[i,j]*c for j,c in enumerate(Cdiag('up'))] ) Nnat[s] = Cnat[s].dagger() * Cnat[s] s= 'down-%d'%(i+1) Cnat[s] = sum_list( [ self.P[i,j]*c for j,c in enumerate(Cdiag('down'))] ) Nnat[s] = Cnat[s].dagger() * Cnat[s] def symm(s): s= '-%s'%s Cdag('00'+s,1).symmetry()['kx'] = 1 Cdag('10'+s,1).symmetry()['kx'] = -1 Cdag('01'+s,1).symmetry()['kx'] = 1 Cdag('11'+s,1).symmetry()['kx'] = -1 Cdag('00'+s,1).symmetry()['ky'] = 1 Cdag('10'+s,1).symmetry()['ky'] = 1 Cdag('01'+s,1).symmetry()['ky'] = -1 Cdag('11'+s,1).symmetry()['ky'] = -1 symm('up'); symm('down') # NB : the Hamiltonian should NOT contain the quadratic part which is in G0 Hamiltonian = U_interact* sum_list( [ Nnat['up-%d'%(i+1)]* Nnat['down-%d'%(i+1)] for i in range (4)]) #!! N_u = sum_list( [ Nnat['up-%d'%(i+1)] for i in range(4) ] ) N_d = sum_list( [ Nnat['down-%d'%(i+1)] for i in range(4) ] ) Quantum_Numbers = { 'kx' : 'kx', 'ky' : 'ky', 'N_u' : N_u, 'N_d' : N_d } Solver.__init__(self,Beta=Beta,GFstruct=[ ('00-up',[1]), ('10-up',[1]), ('01-up',[1]), ('11-up',[1]), ('00-down',[1]), ('10-down',[1]), ('01-down',[1]), ('11-down',[1]) ], H_Local = Hamiltonian,Quantum_Numbers= Quantum_Numbers ) self.N_Cycles = 10
def __init__(self,Beta,U_interact) : C_up_1 = (C('Up+',1) + C('Up-',1))/sqrt(2) C_up_2 = (C('Up+',1) - C('Up-',1))/sqrt(2) C_do_1 = (C('Do+',1) + C('Do-',1))/sqrt(2) C_do_2 = (C('Do+',1) - C('Do-',1))/sqrt(2) Cdag('Up+',1).symmetry()['parity'] = 1 Cdag('Up-',1).symmetry()['parity'] = -1 Cdag('Do+',1).symmetry()['parity'] = 1 Cdag('Do-',1).symmetry()['parity'] = -1 N_up_1 = C_up_1.dagger()*C_up_1 N_up_2 = C_up_2.dagger()*C_up_2 N_do_1 = C_do_1.dagger()*C_do_1 N_do_2 = C_do_2.dagger()*C_do_2 # NB : the Hamiltonian should NOT contain the quadratic part which is in G0 Hamiltonian = U_interact * ( N_up_1*N_do_1 + N_up_2*N_do_2 ) N_u = N('Up-',1)+N('Up+',1) N_d = N('Do-',1)+N('Do+',1) Quantum_Numbers = { 'parity' : 'parity', 'N_u' : N_u, 'N_d' : N_d } Solver.__init__(self, Beta = Beta, GFstruct = [ ('Up+',[1]), ('Up-',[1]), ('Do+',[1]), ('Do-',[1]) ], H_Local = Hamiltonian, Quantum_Numbers = Quantum_Numbers, Nmax = 2000) self.N_Cycles = 100000 self.N_Frequencies_Accumulated = 4*int(0.075*Beta/(2*3.1415)) self.fitting_Frequency_Start = 3*int(0.075*Beta/(2*3.1415)) self.Length_Cycle = 100 self.Nmax_Matrix = 200 self.Use_Segment_Picture = False
from pytriqs.base.gf_local import * from pytriqs.solvers.operators import * from pytriqs.solvers.ctqmc_hyb import Solver D, V, U = 1.0, 0.2, 4.0 e_f, Beta = -U/2.0, 50 # The impurity solver S = Solver(Beta = Beta, # inverse temperature GFstruct = [ ('up',[1]), ('down',[1]) ], # Structure of the Green's function 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_Iteration = 10000, # Warmup cycles Use_Segment_Picture = True, # Use the segment picture Global_Moves = [ # Global move in the QMC (0.05, lambda (a,alpha,dag) : ( {'up':'down','down':'up'}[a],alpha,dag ) ) ], ) from pytriqs.base.archive import HDFArchive import pytriqs.base.utility.mpi as mpi for random_name in ['mt11213b','lagged_fibonacci607']: # Solve using random_name as a generator S.Random_Generator_Name = random_name for spin, g0 in S.G0 : g0 <<= inverse( iOmega_n - e_f - V**2 * Wilson(D) )