def run():
    '''
    run this sample, visual check is quite slow!
    '''
    #generate the hybridization function.
    nband=2
    Gamma=0.5/pi
    Lambda=1.6
    D0=2.
    Gap=0.3
    D=sqrt(D0**2+Gap**2)
    wlist=get_wlist(w0=1e-12,Nw=10000,mesh_type='sclog',Gap=Gap,D=D)
    rhofunc=get_hybri_skew(Gap,Gamma,D=D,eta=1e-12,skew=0.3)
    rholist=array([rhofunc(w) for w in wlist])

    #create the discretized model
    N=33      #the chain length
    nz=50      #the number of twisting parameter z
    z=linspace(0.5/nz,1-0.5/nz,nz)
    tick_type='adaptive'

    print '''Start mapping the hybridization function into a discrete set of baths.
%s sites for each(pos/neg) branch
%s z numbers
tick type -> %s
Lambda    -> %s
'''%(N,nz,tick_type,Lambda)
    discmodel=quick_map(rhofunc=rhofunc,wlist=wlist,N=N,z=z,Nx=200000,tick_params={'tick_type':tick_type,'Lambda':Lambda},autofix=1e-5)[1]

    #map to a chain
    print 'Start mapping the discrete model to a chain, using precision %s-bit.'%PRECISION
    chains=map2chain(discmodel,prec=PRECISION)
    print 'Done'

    plot_wlist=wlist[::30]
    docheck=raw_input('Check whether this star model recover the hybridization function?(y/n):')=='y'
    if docheck:
        ion()
        check_disc(rhofunc=rhofunc,wlist=plot_wlist,discmodel=discmodel,smearing=1.,mode='pauli')
        print '***The superconducting model needs some special gradients to cope the smearing factor here,\
                \nwhich is not included for general purpose,\
                \nso, don\'t be disappointed by the poor match here, they are artifacts.***'
        ylim(-0.1,0.2)
        print 'Press `c` to continue.'
        pdb.set_trace()

    docheck=raw_input('Check whether this chain recover the hybridization function?(y/n):')=='y'
    if docheck:
        ion();cla()
        check_spec(rhofunc=rhofunc,chains=chains,wlist=plot_wlist,smearing=1.,mode='pauli')
        ylim(-0.1,0.2)
        print 'Press `c` to continue.'
        pdb.set_trace()

    dosave=raw_input('Save the chain datas?(y/n):')=='y'
    if dosave:
        for iz,chain in zip(z,chains):
            chain.save('superconductor_%s'%iz)
Exemplo n.º 2
0
def run():
    '''
    run this sample, visual check is quite slow!
    '''
    #generate the hybridization function.
    nband=4
    Gamma=0.5/pi
    Lambda=1.8
    
    D=[-1.,0.5]             #the energy window.
    wlist=get_wlist(w0=1e-12,Nw=10000,mesh_type='log',Gap=0,D=D)
    #rhofunc=lambda w:identity(4)+0.3*w*Gmat[0]+0.3*w**2*Gmat[2] #the case with degeneracy
    rhofunc=lambda w:identity(4)+0.3*w*Gmat[0]+0.3*w**2*Gmat[2]+0.1*kron(sz,sz)     #the case without degeneracy.

    #create the discretized model
    N=33      #the chain length
    nz=50      #the number of twisting parameter z
    z=linspace(0.5/nz,1-0.5/nz,nz)
    tick_type='adaptive'

    print '''Start mapping the hybridization function into a discrete set of baths.
%s sites for each(pos/neg) branch
%s z numbers
tick type -> %s
Lambda    -> %s
'''%(N,nz,tick_type,Lambda)
    discmodel=quick_map(rhofunc=rhofunc,wlist=wlist,N=N,z=z,Nx=200000,tick_params={'tick_type':tick_type,'Lambda':Lambda},autofix=1e-5)[1]

    #map to a chain
    print 'Start mapping the discrete model to a chain, using precision %s-bit.'%PRECISION
    chains=map2chain(discmodel,prec=PRECISION)
    print 'Done'

    plot_wlist=wlist[::30]
    docheck=raw_input('Check whether this star model recover the hybridization function?(y/n):')=='y'
    if docheck:
        ion()
        check_disc(rhofunc=rhofunc,wlist=plot_wlist,discmodel=discmodel,smearing=0.7)
        print 'Press `c` to continue.'
        pdb.set_trace()

    docheck=raw_input('Check whether this chain recover the hybridization function?(y/n):')=='y'
    if docheck:
        ion();cla()
        check_spec(rhofunc=rhofunc,chains=chains,wlist=plot_wlist,smearing=0.7,mode='eval')
        print 'Press `c` to continue.'
        pdb.set_trace()

    dosave=raw_input('Save the chain datas?(y/n):')=='y'
    if dosave:
        for iz,chain in zip(z,chains):
            chain.save('4band_%s'%iz)
Exemplo n.º 3
0
from numpy import *
from discretization import quick_map,get_wlist,check_disc
from chainmapper import map2chain,check_spec
from matplotlib import pyplot as plt

sx=array([[0,1],[1,0]])
sy=array([[0,-1j],[1j,0]])
sz=array([[1,0],[0,-1]])

#defined the hybridization function
wlist=get_wlist(Nw=5000,mesh_type='log',w0=1e-12,D=1.)
rhofunc=lambda w:identity(2)+0.4*sx+0.5*(0.1+w**2)*sy

#map it to a sun model
discmodel=quick_map(wlist=wlist,rhofunc=rhofunc,N=35,z=linspace(0.05,0.95,10),\
        tick_params={'tick_type':'adaptive','Lambda':2.})[1]

#map it to a Wilson chain
chains=map2chain(discmodel,prec=3000)

#do some checking
#check the sun model
plt.subplot(211)
check_disc(rhofunc=rhofunc,wlist=wlist[20::40],discmodel=discmodel,\
        smearing=0.7,mode='pauli')
plt.ylim(-0.1,1.1)
#check the chain
plt.subplot(212)
check_spec(rhofunc=rhofunc,chains=chains,wlist=wlist[20::40],mode='pauli',smearing=0.7)
plt.ylim(-0.1,1.1)
plt.show()