Commit cc5b67a9 authored by Joseph Weston's avatar Joseph Weston

update whatsnew entry to include example with attached lead

parent 0ec1ee3d
......@@ -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)
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.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment