Hello !
  I am trying to plot the surface LDOS of a 3d cubic lattice .But I am
having an error .Please have a look at the code this code is for topological
insulator on a cubic lattice.It generates the correct band structure but 
not LDOS and conductance:I am not mentioning the libraries to keep it
small.I have tried using the 3rd dimension zero it still not working

lat = kwant.lattice.general([(1,0,0),(0,1,0),(0,0,1)])
# All pauli matrices to define pseuospin and spin  degree of freedom.
s_0=np.identity(2)
s_z =np.array([[1, 0], [0, -1]])
s_x = np.array([[0, 1], [1, 0]])
s_y = np.array([[0, -1j], [1j, 0]])
# 4x4 matrices
g1= tinyarray.array(np.kron(s_x,s_x))
g2= tinyarray.array(np.kron(s_y,s_x))
g3 = tinyarray.array(np.kron(s_z,s_x))
g4= tinyarray.array(np.kron(s_0,s_y))
g5 = tinyarray.array(np.kron(s_0,s_z))

def make(a = 14 ,b = 5, c= 0,t=1,delta =.4,m =2):
    sym = kwant.TranslationalSymmetry((1,0,0))
    sys = kwant.Builder()    
    def cube(pos):
        x,y,z = pos
        return 0<=x<=a and 0<=y<=b and 0<=z<=c
    #Onsite energy
    sys[lat.shape(cube,(0,0,0))] = m*tau_0z
    #hopping in x direction 
    sys[kwant.builder.HoppingKind((1, 0,0), lat,lat)] = -t*tau_0z -
1j*delta*tau_zx
    #hopping in y direction 
    sys[kwant.builder.HoppingKind((0,1,0), lat,lat)] = -t*tau_0z  +
1j*delta*tau_0y
#hopping in z direction 
    sys[kwant.builder.HoppingKind((0,0,1), lat,lat)] = -t*tau_0z  -
1j*delta*tau_xx
#leads
    lead = kwant.Builder(sym)    
    def cube1(pos):
        x,y,z = pos
        return  0<=y<=b and 0<=z<=c
    #Onsite energy
    lead[lat.shape(cube,(0,0,0))] = m*tau_0z
    #hopping in x direction 
    lead[kwant.builder.HoppingKind((1, 0,0), lat,lat)] = -t*tau_0z -
1j*delta*tau_zx
    #hopping in y direction 
    lead[kwant.builder.HoppingKind((0,1,0), lat,lat)] = -t*tau_0z  +
1j*delta*tau_0y
#hopping in z direction 
    sys[kwant.builder.HoppingKind((0,0,1), lat,lat)] = -t*tau_0z  -
1j*delta*tau_xx
    sys.attach_lead(lead)
    sys.attach_lead(lead.reversed())
    return sys.finalized()
    return sys
energy =.5
def density(sys, energy, args, lead_nr):
    wf = kwant.wave_function(sys, energy, args)
    return(abs(wf(lead_nr))**2).sum(axis=0)
def lds(sys, energy, args, lead_nr):
    dos = kwant.ldos(sys, energy, args)
    return dos
#main funcation call
def main():
    sys = make()
    kwant.plot(sys, site_size=0.19, site_lw=0.01, hop_lw=0.03,site_color = 'c')
    d = density(sys, energy, [.0, "" ], 0) 
    kwant.plotter.map(sys,d)
    s = lds(sys,energy,[.0, "" ], 0)
    kwant.plotter.map(sys,s)
if __name__ == '__main__':
    main()

the error is :
ValueError: Only 2D systems can be plotted this way.

Reply via email to