Commit 355fb99b authored by Joseph Weston's avatar Joseph Weston

Merge branch 'feature/flux-with-leads' into 'master'

add magnetic gauge fixing for infinite systems and systems with leads

See merge request kwant/kwant!267
Closes #246.
parents 0ef812ea cc5b67a9
Pipeline #15045 failed with stages
in 43 minutes and 32 seconds
......@@ -18,16 +18,26 @@ which calculates the Peierls phases for you::
import numpy as np
import kwant
def hopping(a, b, t, phi):
return -t * np.exp(-1j * phi(a, b))
def hopping(a, b, t, peierls):
return -t * peierls(a, b)
syst = make_system(hopping)
lead = make_lead(hopping)
lead.substitute(peierls='peierls_lead')
syst.attach_lead(lead)
syst = syst.finalized()
syst = make_system(hopping).finalized()
gauge = kwant.physics.magnetic_gauge(syst)
def B(pos):
return np.exp(-np.sum(pos * pos))
def B_syst(pos):
return np.exp(-np.sum(pos * pos))
# B_syst in scattering region, 0 in lead.
# Ensure that the fields match at the system/lead interface!
peierls_syst, peierls_lead = gauge(B_syst, 0)
kwant.hamiltonian_submatrix(syst, params=dict(t=1, phi=gauge(B))
params = dict(t=1, peierls=peierls_syst, peierls_lead=peierls_lead)
kwant.hamiltonian_submatrix(syst, params=params)
Note that the API for this functionality is provisional, and may be
revised in a future version of Kwant.
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment