# kwant.physics.magnetic_gauge¶

class kwant.physics.magnetic_gauge(syst)[source]

Bases: object

Fix the magnetic gauge for a finalized system.

This can be used to later calculate the Peierls phases that should be applied to each hopping, given a magnetic field.

This API is currently provisional. Refer to the documentation for details.

Parameters: syst : kwant.builder.FiniteSystem or kwant.builder.InfiniteSystem

Examples

The following illustrates basic usage for a scattering region with a single lead attached:

>>> import numpy as np
>>> import kwant
>>>
>>> def hopping(a, b, t, peierls):
>>>     return -t * peierls(a, b)
>>>
>>> syst = make_system(hopping)
>>> syst = syst.finalized()
>>>
>>> gauge = kwant.physics.magnetic_gauge(syst)
>>>
>>> def B_syst(pos):
>>>    return np.exp(-np.sum(pos * pos))
>>>
>>> peierls_syst, peierls_lead = gauge(B_syst, 0)
>>>
>>> kwant.hamiltonian_submatrix(syst, params=params)


Methods

__call__(syst_field, *lead_fields, tol=1e-08, average=False)[source]

Return the Peierls phase for a magnetic field configuration.

Parameters: syst_field : scalar, vector or callable The magnetic field to apply to the scattering region. If callable, takes a position and returns the magnetic field at that position. Can be a scalar if the system is 1D or 2D, otherwise must be a vector. Magnetic field is expressed in units $$φ₀ / l²$$, where $$φ₀$$ is the magnetic flux quantum and $$l$$ is the unit of length. *lead_fields : scalar, vector or callable The magnetic fields to apply to each of the leads, in the same format as ‘syst_field’. In addition, if a callable is provided, then the magnetic field must have the symmetry of the associated lead. tol : float, default: 1E-8 The tolerance to which to calculate the flux through each hopping loop in the system. average : bool, default: False If True, estimate the magnetic flux through each hopping loop in the system by evaluating the magnetic field at a single position inside the loop and multiplying it by the area of the loop. If False, then scipy.integrate.quad is used to integrate the magnetic field. This parameter is only used when ‘syst_field’ or ‘lead_fields’ are callable. phases : callable, or sequence of callables The first callable computes the Peierls phase in the scattering region and the remaining callables compute the Peierls phases in each of the leads. Each callable takes a pair of Site (a hopping) and returns a unit complex number (Peierls phase) that multiplies that hopping.

#### Previous topic

kwant.physics.DiscreteSymmetry

#### Next topic

4.1. kwant.digest – Random-access random numbers