kwant.builder.add_peierls_phase(syst, peierls_parameter='phi', fix_gauge=True)[source]#

Add a Peierls phase parameter to a Builder.

  • syst (kwant.Builder) – The system to which to add a Peierls phase.

  • peierls_parameter (str) – The name of the Peierls phase parameter to value functions.

  • fix_gauge (bool (default: True)) – If True, fix the gauge of the system and return it also


  • syst (kwant.builder.Finitesystem or kwant.builder.InfiniteSystem) – A system where all hoppings are given by value functions that have an additional parameter ‘phi’ that should be the Peierls phase returned by kwant.physics.magnetic_gauge. Any leads have similar parameters named ‘phi_lead0’, ‘phi_lead1’ etc.

  • gauge (callable) – Only returned if ‘fix_gauge’ is True. Called with magnetic field(s), and returns a parameter dictionary that can be passed to the system as ‘params’ (see the example below).


>>> import numpy as np
>>> import kwant
>>> syst = make_system()
>>> lead = make_lead()
>>> syst.attach_lead(lead)
>>> syst.attach_lead(lead.reversed())
>>> fsyst, phase = kwant.builder.add_peierls_phase(syst)
>>> def B_syst(pos):
>>>     return np.exp(-np.sum(pos * pos))
>>> kwant.smatrix(fsyst, parameters=dict(t=-1, **phase(B_syst, 0, 0)))