Example #1
0
def bulk_edge_fidelity(h,J,nsite,target_blocks,parities,direction='->',maxN=55,append=False,usvmode=False,**kwargs):
    '''
    Measure the fidelity of states from bulk to edge.
    '''
    dr={'->':'r','<-':'l','<->':'m%s%s'%(maxN,'T' if usvmode else 'F')}[direction]
    pn1=parities[0] if isinstance(parities[0],str) else '%.2f%.2f'%parities[0]
    pn2=parities[1] if isinstance(parities[1],str) else '%.2f%.2f'%parities[1]
    suffix=get_name(h=h,J=J,Jz=J,nsite=nsite,nspin=3)+'_%s%s%s%s'%(target_blocks[0],pn1,target_blocks[1],pn2)
    ffile='data/fidelity_%s_%s.dat'%(suffix,dr)
    print 'Running %s Fidelity evolusion between target_blocks=%s'%(direction,target_blocks)

    if append:
        fs=loadtxt(ffile)
    else:
        kets=[load_mps(h=h,J=J,nsite=nsite,target_block=target_block,parity=parity,maxN=maxN)[1] for target_block,parity in zip(target_blocks,parities)]
        if direction=='<->':
            fs=sweep_fidelity2(kets=kets,maxN=maxN,usvmode=usvmode)
        else:
            fs=sweep_fidelity(kets=kets,direction=direction)
        savetxt(ffile,fs)
    print 'FIN'
    if not ONSV:
        ion()
        plot(fs)
        pdb.set_trace()
    return fs
Example #2
0
def bulk_edge_fidelity(dmus,target_blocks,direction='->',maxN=30,append=False,usvmode=False,**kwargs):
    '''
    Measure the fidelity of states from bulk to edge.
    '''
    model,expander=get_solving_system(evolutor_type='masked',periodic=False,**kwargs)
    nsite=model.nsite
    dr={'->':'r','<-':'l','<->':'m%s%s'%(maxN,'T' if usvmode else 'F')}[direction]
    K1,K2,U=kwargs.get('K1'),kwargs.get('K2'),kwargs.get('U')
    ffile='data/fidelity_W1%s_W2%s_U%s_%sN%s_dmu%s_%s.dat'%(K1,K2,U,dr,nsite,\
            ''.join(['%s'%dmu for dmu in dmus]),''.join(['%s'%(tb,) for tb in target_blocks]))
    print 'Running %s Fidelity evolusion between dmus=%s and target_blocks=%s'%(direction,dmus,target_blocks)

    if append:
        fs=loadtxt(ffile)
    else:
        kets=[load_mps(K1,K2,U,(dmu,target_block),nsite,maxN=maxN)[1] for dmu,target_block in zip(dmus,target_blocks)]
        if direction=='<->':
            fs=sweep_fidelity2(kets=kets,maxN=maxN,usvmode=usvmode)
        else:
            fs=sweep_fidelity(kets=kets,direction=direction)
        savetxt(ffile,fs)
    print 'FIN'
    if not ONSV:
        ion()
        plot(fs)
        pdb.set_trace()
Example #3
0
def bulk_edge_fidelity(t,mu,delta,nsite,polarities,direction='->',maxN=55,append=False,usvmode=False,**kwargs):
    '''
    Measure the fidelity of states from bulk to edge.
    '''
    dr={'->':'r','<-':'l','<->':'m%s%s'%(maxN,'T' if usvmode else 'F')}[direction]
    suffix=get_name(t=t,mu=mu,delta=delta,nsite=nsite)+'_%s%s'%(polarities[0],polarities[1])
    ffile='data/fidelity_%s_%s.dat'%(suffix,dr)
    print 'Running %s Fidelity evolusion between polarities=%s'%(direction,polarities)

    if append:
        fs=loadtxt(ffile)
    else:
        kets=[load_mps(t=t,mu=mu,delta=delta,nsite=nsite,polarity=polarity,maxN=maxN,fixtail=True)[1] for polarity in polarities]
        if direction=='<->':
            fs=sweep_fidelity2(kets=kets,maxN=maxN,usvmode=usvmode)
        else:
            fs=sweep_fidelity(kets=kets,direction=direction)
        savetxt(ffile,fs)
    print 'FIN'
    if not ONSV:
        ion()
        plot(fs)
        pdb.set_trace()
    return fs