Hello everyone , I am trying to build Hexagonal lattice using general 3-D lattice.I am using the code below:
def shape(pos): x, y, z = pos return 0 <= x < a and 0 <= y < b and 0 <= z < c sys = kwant.Builder() sys[lat.shape(shape, (1, 0, 0))] =0 sys[kwant.builder.HoppingKind((0,0,0),a,b)] = t sys[kwant.builder.HoppingKind((-1,1,0),a,b)] = t sys[kwant.builder.HoppingKind((0,1,0),a,b)] = t
But it's not working.When I am using neighbors() function instead, its working, but I don't want to use the neighbors() function.
But this code is not showing the hoppings but when I use 2-D general lattice with hoppings (0,0),(-1,1),(0,1) it works.Also,it is not showing any error.The lattice I am using is:
lat = kwant.lattice.general([(1,0,0),(.5,.5*math.sqrt(3),0),(0,0,3)],[(0,0,0), (0,1 / math.sqrt(3),0)]) a, b = lat.sublattices
please tell me how can I use general 3-D lattice, to make graphene, as I want more than one layers,with hoppings not by neighbors() function.Also, I what should I write in Translational geometry.or 2-D general lattice I am using lat.vec((-1,0)).Please clear this a bit Thanks.
lat.neighbors() returns nothing else than a list of HoppingKind instances. You can simply print it and have a look. In your case, the three HoppingKind objects that you create manually are identical to the ones returned by lat.neighbors(). Check it!
The problem with your script is a different one, I believe: you are using the names “a” and “b” both for lattices and as numerical constants for your shape function. Unfortunately, in Python 2 it is possible to compare numbers and objects, even if this doesn’t make any sense.
For sure you could have found this bug yourself?