示例#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
文件: 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'