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
3ce6f1d5
Commit
3ce6f1d5
authored
11 years ago
by
Christoph Groth
Browse files
Options
Downloads
Patches
Plain Diff
add test for ModesLead and SelfEnergyLead
parent
85d0f098
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
kwant/tests/test_builder.py
+50
-1
50 additions, 1 deletion
kwant/tests/test_builder.py
with
50 additions
and
1 deletion
kwant/tests/test_builder.py
+
50
−
1
View file @
3ce6f1d5
...
...
@@ -10,7 +10,7 @@ from __future__ import division
import
warnings
from
random
import
Random
from
nose.tools
import
assert_raises
from
numpy.testing
import
assert_equal
from
numpy.testing
import
assert_equal
,
assert_almost_equal
import
tinyarray
as
ta
import
kwant
from
kwant
import
builder
...
...
@@ -558,3 +558,52 @@ def test_HoppingKind():
assert
b
.
family
==
gb
assert
sym
.
to_fd
(
a
)
==
a
assert_equal
(
a
.
tag
-
b
.
tag
,
delta
)
def
test_ModesLead_and_SelfEnergyLead
():
lat
=
builder
.
SimpleSiteFamily
()
hoppings
=
[
builder
.
HoppingKind
((
1
,
0
),
lat
),
builder
.
HoppingKind
((
0
,
1
),
lat
)]
rng
=
Random
(
123
)
L
=
5
t
=
1
energies
=
[
0.9
,
1.7
]
sys
=
builder
.
Builder
()
for
x
in
xrange
(
L
):
for
y
in
xrange
(
L
):
sys
[
lat
(
x
,
y
)]
=
4
*
t
+
rng
.
random
()
-
0.5
sys
[
hoppings
]
=
-
t
# Attach a lead from the left.
lead
=
builder
.
Builder
(
VerySimpleSymmetry
(
-
1
))
for
y
in
xrange
(
L
):
lead
[
lat
(
0
,
y
)]
=
4
*
t
lead
[
hoppings
]
=
-
t
sys
.
attach_lead
(
lead
)
# Make the right lead and attach it.
lead
=
builder
.
Builder
(
VerySimpleSymmetry
(
1
))
for
y
in
xrange
(
L
):
lead
[
lat
(
0
,
y
)]
=
4
*
t
lead
[
hoppings
]
=
-
t
sys
.
attach_lead
(
lead
)
fsys
=
sys
.
finalized
()
ts
=
[
kwant
.
smatrix
(
fsys
,
e
).
transmission
(
1
,
0
)
for
e
in
energies
]
# Replace lead with it's finalized copy.
lead
=
fsys
.
leads
[
1
]
interface
=
[
lat
(
L
-
1
,
lead
.
site
(
i
).
tag
[
1
])
for
i
in
xrange
(
L
)]
# Re-attach right lead as ModesLead.
sys
.
leads
[
1
]
=
builder
.
ModesLead
(
lead
.
modes
,
interface
)
fsys
=
sys
.
finalized
()
ts2
=
[
kwant
.
smatrix
(
fsys
,
e
).
transmission
(
1
,
0
)
for
e
in
energies
]
assert_almost_equal
(
ts2
,
ts
)
# Re-attach right lead as SelfEnergyLead.
sys
.
leads
[
1
]
=
builder
.
SelfEnergyLead
(
lead
.
selfenergy
,
interface
)
fsys
=
sys
.
finalized
()
ts2
=
[
kwant
.
greens_function
(
fsys
,
e
).
transmission
(
1
,
0
)
for
e
in
energies
]
assert_almost_equal
(
ts2
,
ts
)
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