Dear Ronan,
from a private exchange you provided me with your code where this error happened.
I could confirm your findings of kwant duplicating the lead unitcell length. In fact, this is noticeable if you try:
``` syst_a, (lead0a, lead1a) = make_system(E=E, extra_hops=True) # those problematic hoppings syst_b, (lead0b, lead1b) = make_system(E=E, extra_hops=False)
syst_a.attach_lead(lead0a); syst_a.attach_lead(lead1a);
syst_b.attach_lead(lead0b); syst_b.attach_lead(lead1b);
print(syst_a.leads[0].finalized().symmetry.periods) print(syst_b.leads[0].finalized().symmetry.periods) ``` The result is ``` [[0.0 -6.624989490547891 0.0]] [[0.0 -3.3124947452739457 0.0]]
```
The duplication of the lead unitcell went unnoticed because of attaching the leads to a system, and finalizing the system.
However, if you try and finalize the leads on themselves, you get the error
``` lead0a.finalized()
ValueError: Further-than-nearest-neighbor cells are connected by hopping
```
This error does not show up in the second case (`extra_hops=False`) because only lead unitcells that are next to each other are connected.
I supose that the way the Bloch Hamiltonian is defined makes that it's only possible to have first unitcell neighbors connected, therefore, for further than nearest neighbors Kwant duplicates the unitcell, in order to fit the `H_0 + e^(i k a) V + c.c.` expression of Bloch Hamiltonians.
That said, I don't see that this behaviour is well documented. The lead `Builder` with longer than one unitcell hoppings cannot be finalized, but it can be attached to a `FiniteSystem`, transforming the lead into a `BuilderLead` that *can* be finalized, with twice the unitcell length.
This may make sense, since in the later case you are probably interested in transport measurements (scattering matrix) which should not change, but it is, at least, an inconsistent or not well documented behaviour.
I suggest that you make a minimal example (a linear chain, for example) and open an issue in the kwant gitlab.
Best regards, Pablo