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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Joseph Weston
kwant
Commits
30c3d08a
Commit
30c3d08a
authored
11 years ago
by
Christoph Groth
Browse files
Options
Downloads
Patches
Plain Diff
make examples/advanced_construction.py work again
parent
7e00a933
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/advanced_construction.py
+19
-18
19 additions, 18 deletions
examples/advanced_construction.py
with
19 additions
and
18 deletions
examples/advanced_construction.py
+
19
−
18
View file @
30c3d08a
"""
An example of advanced system creation.
"""
from
__future__
import
division
import
kwant
import
tinyarray
as
ta
from
math
import
tanh
import
tinyarray
as
ta
import
kwant
sigma_0
=
ta
.
identity
(
2
)
sigma_x
=
ta
.
array
([[
0
,
1
],
[
1
,
0
]])
sigma_y
=
ta
.
array
([[
0
,
-
1j
],
[
1j
,
0
]])
sigma_z
=
ta
.
array
([[
1
,
0
],
[
0
,
-
1
]])
def
make_system
(
R
=
50
):
sigma_0
=
ta
.
identity
(
2
)
sigma_x
=
ta
.
array
([[
0
,
1
],
[
1
,
0
]])
sigma_y
=
ta
.
array
([[
0
,
-
1j
],
[
1j
,
0
]])
sigma_z
=
ta
.
array
([[
1
,
0
],
[
0
,
-
1
]])
def
make_system
(
R
):
def
in_ring
(
pos
):
return
R
**
2
/
4
<
pos
[
0
]
**
2
+
pos
[
1
]
**
2
<
R
**
2
x
,
y
=
pos
return
R
**
2
/
4
<
x
**
2
+
y
**
2
<
R
**
2
def
in_lead
(
pos
):
x
,
y
=
pos
return
-
R
/
4
<
y
<
R
/
4
def
pot
(
site
):
x
,
y
=
site
.
pos
return
(
0.1
*
tanh
(
x
/
R
)
+
tanh
(
2
*
y
/
R
))
*
sigma_z
def
in_lead
(
pos
):
return
-
1
<
pos
[
0
]
<
1.3
and
-
R
/
4
<
pos
[
1
]
<
R
/
4
lat
=
kwant
.
lattice
.
Honeycomb
()
lat
=
kwant
.
lattice
.
honeycomb
()
sys
=
kwant
.
Builder
()
sys
[
lat
.
shape
(
in_ring
,
(
3
*
R
/
4
,
0
))]
=
pot
for
hopping
in
lat
.
nearest
:
sys
[
sys
.
possible_hoppings
(
*
hopping
)]
=
sigma_y
sys
[
lat
.
neighbors
()]
=
sigma_y
lead
=
kwant
.
Builder
(
kwant
.
TranslationalSymmetry
(
lat
.
vec
((
-
1
,
0
))))
lead
[
lat
.
shape
(
in_lead
,
(
0
,
0
))]
=
sigma_0
for
hopping
in
lat
.
nearest
:
lead
[
lead
.
possible_hoppings
(
*
hopping
)]
=
sigma_x
lead
[
lat
.
neighbors
()]
=
sigma_x
sys
.
attach_lead
(
lead
)
sys
.
attach_lead
(
lead
.
reversed
())
...
...
@@ -40,8 +41,8 @@ def make_system(R=50):
def
main
():
f
sys
=
make_system
(
100
)
print
kwant
.
solve
(
f
sys
,
0
.1
).
transmission
(
0
,
1
)
sys
=
make_system
(
100
)
print
kwant
.
solve
(
sys
,
1
.1
).
transmission
(
0
,
1
)
if
__name__
==
'
__main__
'
:
...
...
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