Hello everyone, i would appreciate any help you could give me to solve this issue.
Well, the problem is that i cant find a way to properly show the desired hopppings in this structure, as you could see i've tried usign the lat.neighbors() function showing me wrong hoppings and the HoppingKind function sending a error msg listed below. The hoppings im trying to define are the ones joining the central atom with the 3 nearest neighbors in the top layer and the 3 nearest neighbors in the bottom layer. Im pretty new using kwant so any advice is appreciated. P.D. Sorry for my bad english import kwant from matplotlib import pyplot VectoresPrimitivos = [(3.176, 0, 0), (1.588, 2.7504, 0), (0, 0, 10)] base = [(0, 0, 0), (1.588, 0.9168, 0.8745), (0, 0, 1.749)] lat = kwant.lattice.general(prim_vecs = VectoresPrimitivos, basis = base) a, b, c= lat.sublattices def make_cuboid(t=1.0, a=15, b=10, c=5): def cuboid_shape(pos): x, y, z = pos return 0 <= x < a and 0 <= y < b and 0 <= z < c syst = kwant.Builder() syst[lat.shape(cuboid_shape, (0, 0, 0))] = 4 * t #syst[lat.neighbors(3, 1e-07)] = 3 lead = kwant.Builder(kwant.TranslationalSymmetry((-3.176, 0, 0))) #hoppings = (((1, 0, 0), a, b), ((0, 0, 0), a, b), ((0, 0, 0), c, b), ((-1, 0, 0), c, b)) #syst[[kwant.builder.HoppingKind(*hopping) for hopping in hoppings]] = -1 def lead_shape(pos): return 0 <= pos[1] < b and 0 <= pos[2] < c lead[lat.shape(lead_shape, (0, 0, 0))] = 4 * t #lead[lat.neighbors(3, 1e-07)] = 3 syst.attach_lead(lead) syst.attach_lead(lead.reversed()) return syst def plot_conductance(syst, energies): data = [] for energy in energies: smatrix = kwant.smatrix(syst, energy) data.append(smatrix.transmission(1, 0)) pyplot.figure() pyplot.plot(energies, data) pyplot.xlabel("energy [t]") pyplot.ylabel("conductance [e^2/h]") pyplot.show() def main(): syst = make_cuboid() kwant.plot(syst) syst = make_cuboid(a=100, b=19, c=4) def family_colors(site): if site.family == a: return 'yellow' elif site.family == b: return 'gray' else: return 'black' kwant.plot(syst, site_size=0.25, site_lw=0.025, hop_lw=0.05, site_color=family_colors) syst = syst.finalized() plot_conductance(syst, energies=[0.01 * i - 0.3 for i in range(100)]) def print_hop_kind(hop_kind): print ('HoppingKind' + hop_kind.delta.__str__() + ', ' + hop_kind.family_a.name + ', ' + hop_kind.family_b.name ) print ('Nearest neighbors:') for i in lat.neighbors(3): print_hop_kind(i) if __name__ == '__main__': main() ERROR MESSAGE TypeError Traceback (most recent call last)<ipython-input-54-7d65fe171f23> in <module>() 79 80 if __name__ == '__main__':---> 81 main() <ipython-input-54-7d65fe171f23> in main() 48 def main(): 49 ---> 50 syst = make_cuboid() 51 kwant.plot(syst) 52 <ipython-input-54-7d65fe171f23> in make_cuboid(t, a, b, c) 21 22 hoppings = (((1, 0, 0), a, b), ((0, 0, 0), a, b), ((0, 0, 0), c, b), ((-1, 0, 0), c, b))---> 23 syst[[kwant.builder.HoppingKind(*hopping) for hopping in hoppings]] = -1 24 25 def lead_shape(pos): <ipython-input-54-7d65fe171f23> in <listcomp>(.0) 21 22 hoppings = (((1, 0, 0), a, b), ((0, 0, 0), a, b), ((0, 0, 0), c, b), ((-1, 0, 0), c, b))---> 23 syst[[kwant.builder.HoppingKind(*hopping) for hopping in hoppings]] = -1 24 25 def lead_shape(pos): /usr/lib/python3/dist-packages/kwant/builder.py in __init__(self, delta, family_a, family_b) 361 def __init__(self, delta, family_a, family_b=None): 362 self.delta = ta.array(delta, int)--> 363 ensure_isinstance(family_a, SiteFamily) 364 self.family_a = family_a 365 if family_b is None: /usr/lib/python3/dist-packages/kwant/_common.py in ensure_isinstance(obj, typ, msg) 97 if msg is None: 98 msg = "Expecting an instance of {}.".format(typ.__name__)---> 99 raise TypeError(msg) TypeError: Expecting an instance of SiteFamily.