Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael Wimmer
kwant
Commits
37b60f1e
Commit
37b60f1e
authored
11 years ago
by
Christoph Groth
Browse files
Options
Downloads
Patches
Plain Diff
add a single comprehensive test of most of kwant (QHE plateaus)
parent
e0a28ab8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kwant/tests/test_comprehensive.py
+55
-0
55 additions, 0 deletions
kwant/tests/test_comprehensive.py
with
55 additions
and
0 deletions
kwant/tests/test_comprehensive.py
0 → 100644
+
55
−
0
View file @
37b60f1e
import
math
from
cmath
import
exp
import
kwant
from
kwant.contrib.digest
import
gauss
def
hopping
(
sitei
,
sitej
,
phi
,
salt
):
xi
,
yi
=
sitei
.
pos
xj
,
yj
=
sitej
.
pos
return
-
exp
(
-
0.5j
*
phi
*
(
xi
-
xj
)
*
(
yi
+
yj
))
def
onsite
(
site
,
phi
,
salt
):
return
0.3
*
gauss
(
repr
(
site
),
salt
)
+
4
def
test_qhe
(
W
=
16
,
L
=
8
):
def
central_region
(
pos
):
x
,
y
=
pos
return
-
L
<
x
<
L
and
\
abs
(
y
)
<
W
-
5.5
*
math
.
exp
(
-
x
**
2
/
5
**
2
)
lat
=
kwant
.
lattice
.
square
()
sys
=
kwant
.
Builder
()
sys
[
lat
.
shape
(
central_region
,
(
0
,
0
))]
=
onsite
sys
[
lat
.
neighbors
()]
=
hopping
lead
=
kwant
.
Builder
(
kwant
.
TranslationalSymmetry
((
-
1
,
0
)))
lead
[(
lat
(
0
,
y
)
for
y
in
range
(
-
W
+
1
,
W
))]
=
4
lead
[
lat
.
neighbors
()]
=
hopping
sys
.
attach_lead
(
lead
)
sys
.
attach_lead
(
lead
.
reversed
())
sys
=
sys
.
finalized
()
#### The following chunk of code can be uncommented to visualize the
#### conductance plateaus.
# from matplotlib import pyplot
# import numpy
# reciprocal_phis = numpy.linspace(0.1, 7, 200)
# conductances = []
# for phi in 1 / reciprocal_phis:
# smatrix = kwant.solve(sys, 1.0, args=[phi, ""])
# conductances.append(smatrix.transmission(1, 0))
# pyplot.plot(reciprocal_phis, conductances)
# pyplot.show()
for
r_phis
,
T_nominal
,
max_err
in
[((
1.3
,
2.1
),
1
,
1e-7
),
((
3.2
,
3.7
),
2
,
1e-3
),
((
5.2
,
5.5
),
3
,
1e-1
)]:
for
r_phi
in
r_phis
:
args
=
(
1.0
/
r_phi
,
""
)
T_actual
=
kwant
.
solve
(
sys
,
1.0
,
args
=
args
).
transmission
(
1
,
0
)
assert
abs
(
T_nominal
-
T_actual
)
<
max_err
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment