Skip to content
Snippets Groups Projects
Commit 3530ee76 authored by Christoph Groth's avatar Christoph Groth
Browse files

clarify whatsnew code snippet

parent 02edf61d
No related branches found
No related tags found
No related merge requests found
...@@ -35,12 +35,12 @@ ensure that the chosen gauge is consistent across the whole system ...@@ -35,12 +35,12 @@ ensure that the chosen gauge is consistent across the whole system
directions). This release introduces `kwant.physics.magnetic_gauge`, directions). This release introduces `kwant.physics.magnetic_gauge`,
which calculates the Peierls phases for you:: which calculates the Peierls phases for you::
import numpy as np
import kwant
def hopping(a, b, t, peierls): def hopping(a, b, t, peierls):
return -t * peierls(a, b) return -t * peierls(a, b)
def B_syst(pos):
return np.exp(-np.sum(pos * pos))
syst = make_system(hopping) syst = make_system(hopping)
lead = make_lead(hopping).substituted(peierls='peierls_lead') lead = make_lead(hopping).substituted(peierls='peierls_lead')
syst.attach_lead(lead) syst.attach_lead(lead)
...@@ -48,11 +48,7 @@ which calculates the Peierls phases for you:: ...@@ -48,11 +48,7 @@ which calculates the Peierls phases for you::
gauge = kwant.physics.magnetic_gauge(syst) 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. # 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) peierls_syst, peierls_lead = gauge(B_syst, 0)
params = dict(t=1, peierls=peierls_syst, peierls_lead=peierls_lead) params = dict(t=1, peierls=peierls_syst, peierls_lead=peierls_lead)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment