Commit 3530ee76 authored by Christoph Groth's avatar Christoph Groth

clarify whatsnew code snippet

parent 02edf61d
Pipeline #16809 passed with stages
in 43 minutes and 57 seconds
......@@ -35,12 +35,12 @@ ensure that the chosen gauge is consistent across the whole system
directions). This release introduces `kwant.physics.magnetic_gauge`,
which calculates the Peierls phases for you::
import numpy as np
import kwant
def hopping(a, b, t, peierls):
return -t * peierls(a, b)
def B_syst(pos):
return np.exp(-np.sum(pos * pos))
syst = make_system(hopping)
lead = make_lead(hopping).substituted(peierls='peierls_lead')
syst.attach_lead(lead)
......@@ -48,11 +48,7 @@ which calculates the Peierls phases for you::
gauge = kwant.physics.magnetic_gauge(syst)
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)
params = dict(t=1, peierls=peierls_syst, peierls_lead=peierls_lead)
......
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