Hello everyone, i would appreciate any suggestion you could give me to solve this

Im trying to plot the conductance for a two dimensional array of 3 basis atoms, i have defined the atoms positions, the onsite energies and hoppings matrices and the leads but it is showing me this error:
(i search in the mailing list but theres no info about it)


ValueError                                Traceback (most recent call last)
<ipython-input-1-ee484ce5ea50> in <module>()
    111 
    112 if __name__ == '__main__':
--> 113     main()

<ipython-input-1-ee484ce5ea50> in main()
    107                site_color=family_colors)
    108     syst = syst.finalized()
--> 109     plot_conductance(syst, energies=[0.01 * i - 0.3 for i in range(100)])
    110 
    111 

<ipython-input-1-ee484ce5ea50> in plot_conductance(syst, energies)
     85     data = []
     86     for energy in energies:
---> 87         smatrix = kwant.smatrix(syst, energy)
     88         data.append(smatrix.transmission(1, 0))
     89     pyplot.figure()

~/anaconda3/lib/python3.6/site-packages/kwant/solvers/common.py in smatrix(self, sys, energy, args, out_leads, in_leads, check_hermiticity, params)
    370         linsys, lead_info = self._make_linear_sys(syst, in_leads, energy, args,
    371                                                   check_hermiticity, False,
--> 372                                                   params=params)
    373 
    374         kept_vars = np.concatenate([coords for i, coords in

~/anaconda3/lib/python3.6/site-packages/kwant/solvers/common.py in _make_linear_sys(self, sys, in_leads, energy, args, check_hermiticity, realspace, params)
    162         lhs, norb = syst.hamiltonian_submatrix(args, sparse=True,
    163                                                return_norb=True,
--> 164                                                params=params)[:2]
    165         lhs = getattr(lhs, 'to' + self.lhsformat)()
    166         lhs = lhs - energy * sp.identity(lhs.shape[0], format=self.lhsformat)

kwant/_system.pyx in kwant._system.hamiltonian_submatrix()

kwant/_system.pyx in kwant._system.make_sparse_full()

ValueError: Hopping from site 407 to site 814 does not match the dimensions of onsite Hamiltonians of these sites.

Here is the code so far:

import kwant
import tinyarray
import numpy
from matplotlib import pyplot
%matplotlib notebook

VecPrim = [(3.176, 0, 0), (1.588, 2.7504, 0), (0, 0, 17.49)]
base =  [(0, 0, 0), (1.588, 0.9168, 0.8745), (0, 0, 1.749)]

lat = kwant.lattice.general(prim_vecs=VecPrim, basis=base)
c1, c2, c3 = lat.sublattices

c1_ons = numpy.array([[-1.888842, -0.014064-0.000409j, 0.026908+0.003422j],
                    [-0.014064+0.000409j, -1.784936, -0.031384+0.021565j],
                    [0.026908-0.003422j, -0.031384-0.021565j, 0.710443]])

c2_ons = numpy.array([[7.168134, -0.005189-0.047376j, 0.001352+0.000103j, -0.001189-0.00095j, -0.048166-0.007663j, 0.429882+0.00052j],
                     [-0.005189+0.047376j, 0.245358, 0.113162-0.072937j, 0.660849-0.06348j, -0.017571+0.035587j, 0.020961-0.017679j],
                     [0.001352-0.000103j, 0.113162+0.072937j, 1.338059, -0.003126-0.016285j, -0.624702-0.065652j, 0.002353+0.001639j],
                     [-0.001189+0.00095j, 0.660849+0.06348j, -0.003126+0.016285j, 1.325337, 0.110694+0.01548j, 0.009041+0.004483j],
                     [-0.048166+0.007663j, -0.017571-0.035587j, -0.624702+0.065652j, 0.110694-0.01548j, 0.362102, -0.030934+0.002401j],
                     [0.429882-0.00052j, 0.020961+0.017679j, 0.002353-0.001639j, 0.009041-0.004483j, -0.030934-0.002401j, -0.650839]])
          
c3_ons = numpy.array([[-3.398186, 0.001839+0.001631j, -0.117366+0.00498j],
                    [0.001839-0.001631j, -3.401815, 0.023339+0.009067j],
                    [-0.117366-0.00498j, 0.023339-0.009067j, -0.637207]])


c1_c3_hop = numpy.array([[-1.852931-0.147524j, -0.274338+0.015064j, -0.103127-0.001438j],
                      [0.274586+0.034451j, -1.796449+0.055331j, 0.004816+0.00237j],
                      [-0.015051+0.001677j, -0.034396-0.019407j, 3.410475-0.001248j]])

c1_c2_hop = numpy.array([[0.003644-0.00088j, -0.046131-0.04229j, 0.23188-0.001924j],
                       [-0.305706+0.050514j, -1.963829+0.280977j, -0.597505+0.078772j],
                       [0.638425+0.083597j, -1.171301+0.088146j, -0.146976+0.012943j],
                       [-1.105645-0.086829j, -1.112788+0.056971j, -0.210584-0.002248j],
                       [1.463462+0.012994j, 0.174769-0.106872j, 0.177022-0.031485j],
                       [-0.01338+0.00264j, -0.058159+0.007987j, 0.953363+0.001855j]])

c2_c3_hop = numpy.array([[0.184152+0.002778j, 0.321743-0.010571j, 0.183538-0.00067j],
                       [0.275145+0.007691j, -0.54144+0.012815j, 0.045847+0.015379j],
                       [0.47922+0.015775j, 1.256012+0.007326j, -0.523174+0.00585j],
                       [1.255561-0.002255j, 1.903063+0.010647j, -0.876392+0.010246j],
                       [1.282837-0.091022j, -0.54898+0.001161j, 0.057341-0.004095j],
                       [0.02765-0.001793j, -0.002902-0.001866j, -0.746426-0.000748j]])

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[c1.shape(cuboid_shape, (0, 0, 0))] = c1_ons
    syst[c2.shape(cuboid_shape, (0, 1, 0))] = c2_ons
    syst[c3.shape(cuboid_shape, (0, 0, 1))] = c3_ons                      
   
    syst[kwant.builder.HoppingKind((0, 0, 0), c2, c1)] = c1_c2_hop
    syst[kwant.builder.HoppingKind((-1, 0, 0), c2, c1)] = c1_c2_hop
    syst[kwant.builder.HoppingKind((0, -1, 0), c2, c1)] = c1_c2_hop
    syst[kwant.builder.HoppingKind((0, 0, 0), c3, c2)] = c2_c3_hop
    syst[kwant.builder.HoppingKind((1, 0, 0), c3, c2)] = c2_c3_hop
    syst[kwant.builder.HoppingKind((0, 1, 0), c3, c2)] = c2_c3_hop
   
    lead = kwant.Builder(kwant.TranslationalSymmetry((-3.176, 0, 0)))
   
    lead[c1.shape(cuboid_shape, (0, 0, 0))] = c1_ons
    lead[c2.shape(cuboid_shape, (0, 1, 0))] = c2_ons
    lead[c3.shape(cuboid_shape, (0, 0, 1))] = c3_ons
   
    lead[kwant.builder.HoppingKind((0, 0, 0), c2, c1)] = c1_c2_hop
    lead[kwant.builder.HoppingKind((-1, 0, 0), c2, c1)] = c1_c2_hop
    lead[kwant.builder.HoppingKind((0, -1, 0), c2, c1)] = c1_c2_hop
    lead[kwant.builder.HoppingKind((0, 0, 0), c3, c2)] = c2_c3_hop
    lead[kwant.builder.HoppingKind((1, 0, 0), c3, c2)] = c2_c3_hop
    lead[kwant.builder.HoppingKind((0, 1, 0), c3, c2)] = c2_c3_hop
   
    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=28, c=4)   
    def family_colors(site): 
        if site.family == c1:
            return 'yellow'
        elif site.family == c2:
            return 'gray'
        else:
            return 'blue'
    kwant.plot(syst, site_size=0.05, site_lw=0.01, hop_lw=0.01,
               site_color=family_colors)
    syst = syst.finalized()
    plot_conductance(syst, energies=[0.01 * i - 0.3 for i in range(100)])


if __name__ == '__main__':
    main()