builder.add_peierls_phase has a problem if the system has no leads
Hi, add_peierls_phase seems to have a problem if the system has no leads:
import kwant
from kwant import builder
lat = kwant.lattice.square()
syst = kwant.Builder()
syst[(lat(i, j) for i in range(5) for j in range(5))] = 4
syst[lat.neighbors()] = lambda a, b, t: -t
syst, phase = builder.add_peierls_phase(syst)
assert isinstance(syst, builder.FiniteSystem)
params = phase(1)
assert all(p in params for p in ('phi'))
results in:
/usr/lib/python3.7/site-packages/kwant/lattice.py:746: KwantDeprecationWarning: Not specfying norbs is deprecated. Always specify norbs when creating site families.
return Monatomic(((a, 0), (0, a)), name=name, norbs=norbs)
Traceback (most recent call last):
File "test_without_lead.py", line 13, in <module>
params = phase(1)
File "/usr/lib/python3.7/site-packages/kwant/builder.py", line 1962, in f
return dict(zip(phase_names, phases))
TypeError: zip argument #2 must support iteration
Best, quaeritis