Hi Alejandro,

Please see the full traceback message, it describes that the problem
is in the shape function. The documentation of Builder.fill states
that the shape function has to accept sites are arguments, and you
instead assume that the function takes a real space position instead.

Hope that this helps,
Anton

On Thu, 27 Apr 2023 at 16:26, Alejandro Alvarez Chico <aleal...@ucm.es> wrote:
>
> Hello:
>
> Im simulating a nanotube with this hamiltonian:
> ns = {'hdiag':[[1,0,0,0],[0,-1,0,0],[0,0,1,0],[0,0,0,-1]], 
> 'hA1':[[0,1,0,0],[1,0,0,0],[0,0,0,-1],[0,0,-1,0]],
>      'hA2r':[[0,0,0,1],[0,0,1,0],[0,0,0,0],[0,0,0,0]], 
> 'hA2s':[[0,0,0,0],[0,0,0,0],[0,1,0,0],[1,0,0,0]] }
>
> ham="""
>
> (C_0+C_1*k_z**2+C_2*(k_x**2+k_y**2))*identity(4)+(M_0+M_1*k_z**2+M_2*(k_x**2+k_y**2))*hdiag
>  +
> (B_0*k_z)*hA1 + (1/sqrt(2)*(1+1j)*A_0*(k_x-1j*k_y))*hA2r + 
> (1/sqrt(2)*(1-1j)*A_0*(k_x+1j*k_y))*hA2s
>
> """
> ham= kwant.continuum.sympify(ham,ns)
> and this shape:
>
>     def cuboid_shape(pos):
>         x, y, z = pos
>         return 0 <= x < Lx/2 and  abs(y) <= R and  abs(z) <= 
> np.sqrt(R**2-y**2)
>
> When using :
>
>     lat = kwant.lattice.general([(1, 0, 0),(0, 1, 0),(0, 0, 1)], norbs=4)
>     syst = kwant.Builder()
>     template = kwant.continuum.discretize(ham, coords =['x','y','z'], grid=a)
>     syst.fill(template, cuboid_shape,(0,0,0))
>
> I get this weird error that all the sites have been deleted because an 
> exception with fill(); and i can't seem to find a similar error anywhere on 
> the internet. Any ideas?
>
> Kind Regards
>
> Alejandro Álvarez Chico
>

Reply via email to