コード例 #1
0
ファイル: models.py プロジェクト: GiggleLiu/apps
    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'
コード例 #2
0
    def __init__(self, t, t2=0, U=0, mu=0., occ=True, nsite=6):
        self.t, self.t2, self.U, self.mu = t, t2, U, mu
        self.occ = occ
        self.nsite = nsite

        #occupation representation will use <SuperSpaceConfig>, otherwise <SpaceConfig>.
        if self.occ:
            spaceconfig = SuperSpaceConfig(chorder([nsite, 2, 1]))
        else:
            spaceconfig = SpaceConfig(chorder([1, 2, nsite, 1]), kspace=False)
            if abs(U) > 0:
                warnings.warn('U is ignored in non-occupation representation.')
        hgen = RHGenerator(spaceconfig=spaceconfig)

        #define the operator of the system
        hgen.register_params({
            't1': self.t,
            't2': self.t2,
            'U': self.U,
            '-mu': -self.mu,
        })

        #define a structure and initialize bonds.
        rlattice = Chain(N=nsite)
        hgen.uselattice(rlattice)

        b1s = rlattice.getbonds(1)  #the nearest neighbor
        b2s = rlattice.getbonds(2)  #the nearest neighbor

        #add the hopping term.
        op_t1 = op_simple_hopping(label='hop1',
                                  spaceconfig=spaceconfig,
                                  bonds=b1s)
        hgen.register_operator(op_t1, param='t1')
        op_t2 = op_simple_hopping(label='hop2',
                                  spaceconfig=spaceconfig,
                                  bonds=b2s)
        hgen.register_operator(op_t2, param='t2')
        op_n = op_simple_onsite(label='n', spaceconfig=spaceconfig)
        hgen.register_operator(op_n, param='-mu')

        #add the hubbard interaction term if it is in the occupation number representation.
        if self.occ:
            op_ninj = op_U(label='ninj', spaceconfig=spaceconfig)
            hgen.register_operator(op_ninj, param='U')

        self.hgen = hgen
コード例 #3
0
ファイル: models.py プロジェクト: GiggleLiu/apps
    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
コード例 #4
0
ファイル: testfermi.py プロジェクト: amilacsw/dmrg
    def __init__(self,t,t2=0,U=0,mu=0.,occ=True,nsite=6):
        self.t,self.t2,self.U,self.mu=t,t2,U,mu
        self.occ=occ
        self.nsite=nsite

        #occupation representation will use <SuperSpaceConfig>, otherwise <SpaceConfig>.
        if self.occ:
            spaceconfig=SuperSpaceConfig([1,2,nsite,1])
        else:
            spaceconfig=SpaceConfig([1,2,nsite,1],kspace=False)
            if abs(U)>0: warnings.warn('U is ignored in non-occupation representation.')
        hgen=RHGenerator(spaceconfig=spaceconfig)

        #define the operator of the system
        hgen.register_params({
            't1':self.t,
            't2':self.t2,
            'U':self.U,
            '-mu':-self.mu,
            })

        #define a structure and initialize bonds.
        rlattice=Chain(N=nsite)
        hgen.uselattice(rlattice)

        b1s=rlattice.getbonds(1)  #the nearest neighbor
        b2s=rlattice.getbonds(2)  #the nearest neighbor

        #add the hopping term.
        op_t1=op_simple_hopping(label='hop1',spaceconfig=spaceconfig,bonds=b1s)
        hgen.register_operator(op_t1,param='t1')
        op_t2=op_simple_hopping(label='hop2',spaceconfig=spaceconfig,bonds=b2s)
        hgen.register_operator(op_t2,param='t2')
        op_n=op_simple_onsite(label='n',spaceconfig=spaceconfig)
        hgen.register_operator(op_n,param='-mu')

        #add the hubbard interaction term if it is in the occupation number representation.
        if self.occ:
            op_ninj=op_U(label='ninj',spaceconfig=spaceconfig)
            hgen.register_operator(op_ninj,param='U')

        self.hgen=hgen
コード例 #5
0
ファイル: models.py プロジェクト: GiggleLiu/apps
    def __init__(self,t,mu,K1,K2,nsite,U=0.,periodic=False,use_sx=True):
        self.t,self.mu,self.K1,self.K2,self.U=t,mu,K1,K2,U
        self.nsite=nsite
        self.periodic=periodic
        self.use_sx=use_sx

        spaceconfig=SuperSpaceConfig(chorder([1,2,self.nsite,1]))
        hgen=RHGenerator(spaceconfig=spaceconfig)

        #define the operator of the system
        hgen.register_params({
            '-t':-self.t,
            'K1':self.K1,
            'K2':self.K2,
            '-mu':-self.mu,
            'U':self.U
            })

        #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')
        op_nn=op_U(spaceconfig=spaceconfig)
        hgen.register_operator(op_nn,param='U')

        #add the interaction term
        ql1=[]
        op_K1=sum([Qlinear(indices=array([
            spaceconfig.c2ind(chorder([0,i%nsite,0])),  #spin, atom orbit
            spaceconfig.c2ind(chorder([1,i%nsite,0])),  #spin, atom orbit
            spaceconfig.c2ind(chorder([1,(i+1)%nsite,0])),  #spin, atom orbit
            spaceconfig.c2ind(chorder([0,(i+1)%nsite,0]))]),spaceconfig=spaceconfig)  #spin, atom orbit
            for i in xrange(nsite if periodic else nsite-1)])
        op_K1=op_K1+op_K1.HC
        op_K1.label='K1'
        hgen.register_operator(op_K1,param='K1')

        op_K2=sum([Qlinear(indices=array([
            spaceconfig.c2ind(chorder([0,i%nsite,0])),  #spin, atom orbit
            spaceconfig.c2ind(chorder([0,(i+1)%nsite,0])),  #spin, atom orbit
            spaceconfig.c2ind(chorder([1,(i+1)%nsite,0])),  #spin, atom orbit
            spaceconfig.c2ind(chorder([1,i%nsite,0]))]),spaceconfig=spaceconfig)  #spin, atom orbit
            for i in xrange(nsite if periodic else nsite-1)])
        op_K2=op_K2+op_K2.HC
        if self.use_sx:
            op_K2+=sum([Qlinear(indices=array([
                spaceconfig.c2ind(chorder([0,i%nsite,0])),  #spin, atom orbit
                spaceconfig.c2ind(chorder([1,(i+1)%nsite,0])),  #spin, atom orbit
                spaceconfig.c2ind(chorder([0,(i+1)%nsite,0])),  #spin, atom orbit
                spaceconfig.c2ind(chorder([1,i%nsite,0]))]),spaceconfig=spaceconfig)  #spin, atom orbit
                for i in xrange(nsite if periodic else nsite-1)])
            op_K2+=sum([Qlinear(indices=array([
                spaceconfig.c2ind(chorder([1,i%nsite,0])),  #spin, atom orbit
                spaceconfig.c2ind(chorder([0,(i+1)%nsite,0])),  #spin, atom orbit
                spaceconfig.c2ind(chorder([1,(i+1)%nsite,0])),  #spin, atom orbit
                spaceconfig.c2ind(chorder([0,i%nsite,0]))]),spaceconfig=spaceconfig)  #spin, atom orbit
                for i in xrange(nsite if periodic else nsite-1)])
        op_K2.label='K2'
        hgen.register_operator(op_K2,param='K2')

        self.hgen=hgen
        self.qnumber='QR' if K2!=0 else 'QM'
コード例 #6
0
ファイル: models.py プロジェクト: GiggleLiu/apps
    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