예제 #1
0
파일: qhall.py 프로젝트: GiggleLiu/bes
    def __init__(self,t,lamb,mu,N=(100,100)):
        self.t=t
        self.lamb=lamb
        self.mu=mu
        spaceconfig=SpaceConfig([1,2,1,1],kspace=True)
        hgen=KHGenerator(spaceconfig,propergauge=False)

        #define the operator of the system
        hgen.register_params({
            't1':self.t,
            '-mu':-self.mu,
            '-ilamb':-1j*self.lamb,
            })

        #define a structure and initialize bonds.
        rlattice=Square_Lattice(N=N,catoms=[zeros(2)])
        hgen.uselattice(rlattice)

        b1s=rlattice.cbonds[1]  #the nearest neighbor
        b0s=rlattice.cbonds[0]  #the onsite term.

        #add the hopping term.
        op_t1=op_from_mats(label='hop1',spaceconfig=spaceconfig,mats=[sz]*len(b1s),bonds=b1s)
        hgen.register_operator(op_t1,param='t1')
        op_mu=op_from_mats(label='n',spaceconfig=spaceconfig,mats=[sz])
        hgen.register_operator(op_mu,param='-mu')
        bondx=b1s.query(bondv=array([1,0]))
        _bondx=b1s.query(bondv=-array([1,0]))
        bondy=b1s.query(bondv=array([0,1]))
        _bondy=b1s.query(bondv=-array([0,1]))
        op_l=op_from_mats(label='lamb',spaceconfig=spaceconfig,mats=[sx,-sx,sy,-sy],bonds=[bondx[0],_bondx[0],bondy[0],_bondy[0]])
        hgen.register_operator(op_l,param='-ilamb')

        self.hgen=hgen
예제 #2
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