def get_opc(self): ''' Construct <OpCollection> for a chain. Return: <OpCollection>, the operator collection. ''' impurity=self.impurity bath=self.bath nsite=bath.nsite+1 spaceconfig1=impurity.spaceconfig config=list(spaceconfig1.config) config[-2]=nsite spaceconfig=SuperSpaceConfig(config) elist,tlist=self.elist_rescaled,self.tlist_rescaled tlist2=swapaxes(tlist.conj(),-1,-2) ebonds=[Bond(zeros(2),i,i) for i in xrange(len(elist))] tbonds=[Bond([1.,0],i,i+1) for i in xrange(len(tlist))] tbonds2=[Bond([-1.,0],i+1,i) for i in xrange(len(tlist))] opc=op_on_bond('E',spaceconfig=spaceconfig,mats=elist,bonds=ebonds) opc=opc+op_on_bond('T',spaceconfig=spaceconfig,mats=concatenate([tlist2,tlist],axis=0),bonds=tbonds2+tbonds) opc.label='H' opc+=impurity.get_interaction() return op2collection(opc).compactify()
def __init__(self,t,mu,M,N,periodic=False,usekspace=False): if usekspace and not periodic: raise ValueError('Don\'t be silly, how can you use kspace with non-periodic system!') self.t,self.mu,self.M=t,mu,M self.N=N self.periodic=periodic if usekspace: spaceconfig=SpaceConfig([1,2,2,1],kspace=True) hgen=KHGenerator(spaceconfig=spaceconfig,propergauge=False) else: spaceconfig=SpaceConfig(chorder([1,2,2*self.N,1]),kspace=False) hgen=RHGenerator(spaceconfig=spaceconfig) #define the operator of the system hgen.register_params({ '-t':-self.t, 'M':self.M, '-mu':-self.mu, }) #define a structure and initialize bonds. rlattice=Chain(N=N,catoms=[array([0.]),array([0.8])],a=array([2.])) if periodic: rlattice.usegroup(TranslationGroup(rlattice.N[:,newaxis]*rlattice.a,per=ones(1,dtype='bool'))) hgen.uselattice(rlattice) b1s=rlattice.cbonds[1] if usekspace else rlattice.getbonds(1) #the nearest neighbor b2s=rlattice.cbonds[2] if usekspace else rlattice.getbonds(2) #the nearest neighbor #add the hopping term. op_t1=op_simple_hopping(label='hop1',spaceconfig=spaceconfig,bonds=b1s+b2s) hgen.register_operator(op_t1,param='-t') op_n=op_simple_onsite(label='n',spaceconfig=spaceconfig) hgen.register_operator(op_n,param='-mu') #add the interaction term I2=identity(2) op_M_even=op_on_bond(label='Sx',spaceconfig=spaceconfig,mats=[sx]*len(b1s),bonds=b1s) op_M_odd=op_on_bond(label='-Sx',spaceconfig=spaceconfig,mats=[-sx]*len(b2s),bonds=b2s) hgen.register_operator(op_M_even,param='M') hgen.register_operator(op_M_odd,param='M') self.hgen=hgen
def get_opc(self): ''' Construct <OpCollection> for a chain. Return: <OpCollection>, the operator collection. ''' impurity = self.impurity bath = self.bath # the new space configuration. nsite = self.nsite spaceconfig1 = impurity.spaceconfig config = list(spaceconfig1.config) config[-2] = nsite spaceconfig = SuperSpaceConfig(config) elist, tlist = self.bath.elist, self.bath.tlist if impurity.H0 is not None: elist = concatenate([self.impurity.H0[newaxis, ...], elist], axis=0) tlist = concatenate([self.bath.t0[newaxis, ...], tlist], axis=0) tlist2 = swapaxes(tlist.conj(), -1, -2) ebonds = [Bond(i, i, zeros(2)) for i in range(len(elist))] tbonds = [Bond(i, i + 1, [1., 0]) for i in range(len(tlist))] tbonds2 = [-b for b in tbonds] opc = op_on_bond('E', spaceconfig=spaceconfig, mats=elist, bonds=ebonds) opc = opc + op_on_bond('T', spaceconfig=spaceconfig, mats=concatenate([tlist2, tlist], axis=0), bonds=tbonds2 + tbonds) opc.label = 'H' opc += impurity.get_interaction() opcl = op2collection(opc) insert_Zs(opcl, spaceconfig1) return opcl
def __init__(self,t,Delta,mu,nsite,periodic=False,manybody=True): self.t,self.mu,self.Delta=t,mu,Delta self.nsite=nsite self.periodic=periodic self.manybody=manybody if manybody: spaceconfig=SuperSpaceConfig(chorder([1,1,self.nsite,1])) else: spaceconfig=SpaceConfig(chorder([2,1,self.nsite,1])) hgen=RHGenerator(spaceconfig=spaceconfig) #define the operator of the system hgen.register_params({ '-t':-self.t if not self.manybody else 2*self.t, 'Delta':self.Delta, '-mu':-self.mu, }) #define a structure and initialize bonds. rlattice=Chain(N=nsite) if periodic: rlattice.usegroup(TranslationGroup(rlattice.N[:,newaxis]*rlattice.a,per=ones(1,dtype='bool'))) hgen.uselattice(rlattice) b1s=rlattice.getbonds(1) #the nearest neighbor #add the hopping term. op_t1=op_simple_hopping(label='hop1',spaceconfig=spaceconfig,bonds=b1s) hgen.register_operator(op_t1,param='-t') op_n=op_simple_onsite(label='n',spaceconfig=spaceconfig) hgen.register_operator(op_n,param='-mu') #add the p-wave term if not manybody: op_d=op_on_bond(label='pp',spaceconfig=spaceconfig,mats=[(1j if b.bondv[0]>0 else -1j)*sy for b in b1s],bonds=b1s) hgen.register_operator(op_d,param='Delta') else: op_d=sum([BBilinear( index1=spaceconfig.c2ind(chorder([0,b.atom1,0])), #spin, atom orbit index2=spaceconfig.c2ind(chorder([0,b.atom2,0])), spaceconfig=spaceconfig,bondv=b.bondv,factor=1 if b.bondv[0]>0 else -1,indices_ndag=2) #spin, atom orbit for b in b1s]) op_d=op_d+op_d.HC hgen.register_operator(op_d,param='Delta') self.hgen=hgen self.qnumber='PM'
def __init__(self,t,mu,alpha,U,Delta,Vz,nsite,periodic=False,occ=False,kspace=True,resonance=False): if kspace and not periodic: raise ValueError('Don\'t be silly, how can you use kspace with non-periodic system!') if kspace and occ: raise ValueError('Don\'t be silly, how can you use kspace with occupation representation!') if kspace and resonance: raise ValueError('Don\'t be silly, how can you use kspace to study resonance!') self.t,self.mu,self.alpha,self.U,self.Delta,self.Vz=t,mu,alpha,U,Delta,Vz self.nsite=nsite self.periodic=periodic self.resonance=resonance self.occ=occ nambu=abs(self.Delta)>0 and not occ #nambu=True nnambu=2 if nambu else 1 junction_site=nsite/2 if occ: spaceconfig=SuperSpaceConfig(chorder([1,2,self.nsite,1])) hgen=RHGenerator(spaceconfig=spaceconfig) elif kspace: spaceconfig=SpaceConfig(chorder([nnambu,2,1,1]),kspace=True) hgen=KHGenerator(spaceconfig=spaceconfig,propergauge=False) else: spaceconfig=SpaceConfig(chorder([nnambu,2,self.nsite,1])) hgen=RHGenerator(spaceconfig=spaceconfig) #define the operator of the system hgen.register_params({ '-t/2':-self.t/2., '-alpha/2':-self.alpha/2., 'U':self.U, 'Vz':self.Vz, '-mu+t':-self.mu+self.t, 'Delta':self.Delta, 't':self.t, }) #define a structure and initialize bonds. rlattice=Chain(N=nsite) if periodic: rlattice.usegroup(TranslationGroup(rlattice.N[:,newaxis]*rlattice.a,per=ones(1,dtype='bool'))) hgen.uselattice(rlattice) b1s=rlattice.cbonds[1] if kspace else rlattice.getbonds(1) #the nearest neighbor b0s=rlattice.cbonds[0] if kspace else rlattice.getbonds(0) #the onsite bonds. brs=[b for b in b0s if b.atom1>=junction_site] bls=[b for b in b0s if b.atom1<junction_site] #add the hopping term and chemical potential. t0=time.time() op_t1=op_simple_hopping(label='hop1',spaceconfig=spaceconfig,bonds=b1s) hgen.register_operator(op_t1,param='-t/2') t1=time.time() if resonance: op_n=op_on_bond(label='n',spaceconfig=spaceconfig,bonds=brs,mats=[kron(sz,identity(2))]*len(brs)) hgen.register_operator(op_n,param='t') op_nl=op_on_bond(label='nl',spaceconfig=spaceconfig,bonds=bls,mats=[kron(sz,identity(2))]*len(bls)) hgen.register_operator(op_nl,param='-mu+t') else: op_n=op_simple_onsite(label='n',spaceconfig=spaceconfig) hgen.register_operator(op_n,param='-mu+t') t2=time.time() #the rashba term rmats=[1j*(sy if not nambu else kron(sz,sy))*(1 if b.bondv[0]>0 else -1) for b in b1s] op_r=op_on_bond(label='rashba',spaceconfig=spaceconfig,bonds=b1s,mats=rmats) hgen.register_operator(op_r,param='-alpha/2') t3=time.time() #the magnetic field op_Vz=op_on_bond(label='Sz',spaceconfig=spaceconfig,bonds=b0s,mats=[sz if not nambu else kron(sz,sz)]*len(b0s)) hgen.register_operator(op_Vz,param='Vz') t4=time.time() if abs(Delta)>0: #the cooper pairing term, if the resonace mode, only the left side is added. if nambu: if resonance: op_D=op_on_bond(label='D',spaceconfig=spaceconfig,bonds=bls,mats=[-kron(sy,sy)]*len(bls)) else: op_D=op_on_bond(label='D',spaceconfig=spaceconfig,bonds=b0s,mats=[-kron(sy,sy)]*len(b0s)) else: op_D=op_supercooper(label='D',spaceconfig=spaceconfig,bonds=b0s,mats=[array([[0,1],[0,0]])]*len(b0s)) hgen.register_operator(op_D,param='Delta') if occ: #add the interaction term op_ninj=op_U(label='ninj',spaceconfig=spaceconfig) hgen.register_operator(op_ninj,param='U') t5=time.time() print 'Elapse -> t: %s, n: %s, r: %s, B: %s, D: %s'%(t1-t0,t2-t1,t3-t2,t4-t3,t5-t4) self.hgen=hgen