Beispiel #1
0
 def get_Ising(self, h, J=1.):
     '''Get the hamiltonian.'''
     #the hamiltonian for Ising model
     Sz = opunit_Sz(spaceconfig=SpinSpaceConfig([1, 2]))
     Sx = opunit_Sx(spaceconfig=SpinSpaceConfig([1, 2]))
     H = -J * Sz.as_site(0) * Sz.as_site(1) + h * Sx.as_site(0)
     return H
Beispiel #2
0
    def __init__(self,J,Jz,h,nsite,J2=0,J2z=None):
        self.spaceconfig=SpinSpaceConfig([2,1])
        I=OpUnitI(hndim=2)
        scfg=SpinSpaceConfig([2,1])
        Sx=opunit_Sx(spaceconfig=scfg)
        Sy=opunit_Sy(spaceconfig=scfg)
        Sz=opunit_Sz(spaceconfig=scfg)

        #with second nearest hopping terms.
        if J2==0:
            self.H_serial2=None
            return
        elif J2z==None:
            J2z=J2
        SL=[]
        for i in xrange(nsite):
            Sxi,Syi,Szi=copy.copy(Sx),copy.copy(Sy),copy.copy(Sz)
            Sxi.siteindex=i
            Syi.siteindex=i
            Szi.siteindex=i
            SL.append(array([Sxi,Syi,sqrt(J2z/J2)*Szi]))
        ops=[]
        for i in xrange(nsite-1):
            ops.append(J*SL[i].dot(SL[i+1]))
            if i<nsite-2 and J2z!=0:
                ops.append(J2*SL[i].dot(SL[i+2]))

        mpc=sum(ops)
        self.H_serial=mpc
Beispiel #3
0
    def __init__(self, J, Jz, h, nsite, J2=0, J2z=None):
        self.spaceconfig = SpinSpaceConfig([1, 2])
        I = OpUnitI(hndim=2)
        scfg = SpinSpaceConfig([1, 2])
        Sx = opunit_Sx(spaceconfig=scfg)
        Sy = opunit_Sy(spaceconfig=scfg)
        Sz = opunit_Sz(spaceconfig=scfg)

        #with second nearest hopping terms.
        if J2 == 0:
            self.H_serial2 = None
            return
        elif J2z == None:
            J2z = J2
        SL = []
        for i in xrange(nsite):
            Sxi, Syi, Szi = copy.copy(Sx), copy.copy(Sy), copy.copy(Sz)
            Sxi.siteindex = i
            Syi.siteindex = i
            Szi.siteindex = i
            SL.append(array([Sxi, Syi, sqrt(J2z / J2) * Szi]))
        ops = []
        for i in xrange(nsite - 1):
            ops.append(J * SL[i].dot(SL[i + 1]))
            if i < nsite - 2 and J2z != 0:
                ops.append(J2 * SL[i].dot(SL[i + 2]))

        mpc = sum(ops)
        self.H_serial = mpc
Beispiel #4
0
    def __init__(self,J1,J2,K,Jp,nsite,impurity_site=None):
        self.spaceconfig=SpinSpaceConfig([2,1])
        if impurity_site is None:
            impurity_site=nsite/2  #nsite/2 and nsite/2-1
        self.impurity_site=impurity_site
        self.J1,self.J2,self.K,self.Jp=J1,J2,K,Jp
        I=OpUnitI(hndim=self.spaceconfig.hndim)
        Sx=opunit_Sx(spaceconfig=self.spaceconfig)
        Sy=opunit_Sy(spaceconfig=self.spaceconfig)
        Sz=opunit_Sz(spaceconfig=self.spaceconfig)
        SL=[]
        for i in xrange(nsite):
            Sxi,Syi,Szi=copy.deepcopy(Sx),copy.deepcopy(Sy),copy.deepcopy(Sz)
            Sxi.siteindex=i
            Syi.siteindex=i
            Szi.siteindex=i
            SL.append(array([Sxi,Syi,Szi]))
        ops=[]
        for i in xrange(nsite-1):
            factor1=J1
            if i==impurity_site or i==impurity_site-2:
                factor1*=Jp
            elif i==impurity_site-1:
                factor1*=K
            ops.append(factor1*SL[i].dot(SL[i+1]))
            if i<nsite-2 and i!=impurity_site-1 and i!=impurity_site-2:
                factor2=J2
                if i==impurity_site-3 or i==impurity_site:
                    factor2*=Jp
                ops.append(factor2*SL[i].dot(SL[i+2]))

        mpc=sum(ops)
        self.H_serial=mpc
Beispiel #5
0
 def get_Haldane(self, D, J=1.):
     '''Get the hamiltonian.'''
     #the hamiltonian for Ising model
     Sx = opunit_Sx(spaceconfig=SpinSpaceConfig([1, 3]))
     Sy = opunit_Sy(spaceconfig=SpinSpaceConfig([1, 3]))
     Sz = opunit_Sz(spaceconfig=SpinSpaceConfig([1, 3]))
     H = J * (
         Sz.as_site(0) * Sz.as_site(1) + Sx.as_site(0) * Sx.as_site(1) +
         Sy.as_site(0) * Sy.as_site(1)) + D * Sz.as_site(0) * Sz.as_site(0)
     return H
Beispiel #6
0
def test_loc_observe():
    nsite = 10
    (E, mps), info = get_spec(nsite, trunc_steps=[], return_vecs=True)
    model = info['model']
    sx = opunit_Sx(spaceconfig=model.spaceconfig)
    sz = opunit_Sz(spaceconfig=model.spaceconfig)
    sy = opunit_Sy(spaceconfig=model.spaceconfig)
    # measure Sx(i)
    ion()
    for isite in range(nsite):
        res = get_expect(sz.as_site(isite), mps)[0, 0].diagonal()
        # res=fft.fft(res)
        plot(res)
        pdb.set_trace()
Beispiel #7
0
 def __init__(self, g, h, nsite, J=1):
     self.spaceconfig = SpinSpaceConfig([2, 1])
     self.J, self.g, self.h, self.nsite = J, g, h, nsite
     scfg = self.spaceconfig
     I = OpUnitI(hndim=scfg.hndim)
     Sx = opunit_Sx(spaceconfig=scfg) * 2
     Sz = opunit_Sz(spaceconfig=scfg) * 2
     opc = 0
     for i in range(nsite):
         hi = h - J if i == 0 or i == nsite - 1 else h
         opc = opc + (hi * Sz.as_site(i) + g * Sx.as_site(i))
         if i != nsite - 1:
             opc = opc + J * Sz.as_site(i) * Sz.as_site(i + 1)
     self.opc = opc
Beispiel #8
0
 def __init__(self,J,h,nsite):
     self.spaceconfig=SpinSpaceConfig([2,1])
     self.J,self.h,self.nsite=J,h,nsite
     I=OpUnitI(hndim=2)
     Sz=opunit_Sz(spaceconfig=self.spaceconfig)
     Sx=opunit_Sx(spaceconfig=self.spaceconfig)
     wi=zeros((3,3),dtype='O')
     wi[:,0],wi[2,1:]=(I,Sx,-h*Sz),(Sx,I)
     WL=[copy.deepcopy(wi) for i in xrange(nsite)]
     WL[0]=WL[0][2:]
     WL[-1]=WL[-1][:,:1]
     self.H=MPO(WL)
     mpc=self.H.serialize()
     mpc.compactify()
     if isinstance(mpc,(OpString,OpUnit)):
         mpc=OpCollection([mpc])
     self.H_serial=mpc
     self.qnumber='R'
Beispiel #9
0
    def __init__(self,J,Jz,D,nsite,periodic=False):
        self.spaceconfig=SpinSpaceConfig([3,1])
        I=OpUnitI(hndim=self.spaceconfig.hndim)
        Sx=opunit_Sx(spaceconfig=self.spaceconfig)
        Sy=opunit_Sy(spaceconfig=self.spaceconfig)
        Sz=opunit_Sz(spaceconfig=self.spaceconfig)

        SL=[]
        for i in xrange(nsite):
            Sxi,Syi,Szi=copy.copy(Sx),copy.copy(Sy),copy.copy(Sz)
            Sxi.siteindex=i
            Syi.siteindex=i
            Szi.siteindex=i
            SL.append(array([Sxi,Syi,sqrt(Jz/J)*Szi]))
        ops=[]
        for i in xrange(nsite):
            if periodic or i!=nsite-1:
                ops.append(J*SL[i%nsite].dot(SL[(i+1)%nsite]))
            ops.append(D*SL[i][2]*SL[i][2])

        mpc=sum(ops)
        mpc.compactify()
        self.H_serial=mpc