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
242df6b3
There was a problem fetching the pipeline summary.
Commit
242df6b3
authored
8 years ago
by
Christoph Groth
Browse files
Options
Downloads
Plain Diff
Merge branch 'stable_py2' into stable
parents
a0b17027
109e145a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
kwant/builder.py
+3
-0
3 additions, 0 deletions
kwant/builder.py
kwant/physics/leads.py
+2
-2
2 additions, 2 deletions
kwant/physics/leads.py
kwant/physics/tests/test_leads.py
+16
-0
16 additions, 0 deletions
kwant/physics/tests/test_leads.py
with
21 additions
and
2 deletions
kwant/builder.py
+
3
−
0
View file @
242df6b3
...
...
@@ -1059,6 +1059,9 @@ class Builder:
The lead numbering starts from zero and increments from there, i.e.
the leads are numbered in the order in which they are attached.
"""
if
self
.
symmetry
.
num_directions
:
raise
ValueError
(
"
Leads can only be attached to finite systems.
"
)
if
add_cells
<
0
or
int
(
add_cells
)
!=
add_cells
:
raise
ValueError
(
'
add_cells must be an integer >= 0.
'
)
...
...
This diff is collapsed.
Click to expand it.
kwant/physics/leads.py
+
2
−
2
View file @
242df6b3
...
...
@@ -578,8 +578,8 @@ def modes(h_cell, h_hop, tol=1e6, stabilization=None):
raise
ValueError
(
"
Incompatible matrix sizes for h_cell and h_hop.
"
)
if
not
complex_any
(
h_hop
):
v
=
np
.
zeros
((
0
,
m
))
return
(
PropagatingModes
(
np
.
zeros
((
0
,
n
)),
np
.
zeros
((
0
,)),
v
=
np
.
zeros
((
m
,
0
))
return
(
PropagatingModes
(
np
.
zeros
((
n
,
0
)),
np
.
zeros
((
0
,)),
np
.
zeros
((
0
,))),
StabilizedModes
(
np
.
zeros
((
0
,
0
)),
np
.
zeros
((
0
,
0
)),
0
,
v
))
...
...
This diff is collapsed.
Click to expand it.
kwant/physics/tests/test_leads.py
+
16
−
0
View file @
242df6b3
...
...
@@ -324,3 +324,19 @@ def test_dtype_linsys():
lsys
=
kwant
.
physics
.
leads
.
setup_linsys
(
h_cell
-
0.3
*
np
.
eye
(
2
),
h_hop
)
assert
lsys
.
eigenproblem
[
0
].
dtype
==
np
.
complex128
def
test_zero_hopping
():
h_cell
=
np
.
identity
(
2
)
h_hop
=
np
.
zeros
((
2
,
1
))
expected
=
(
leads
.
PropagatingModes
(
np
.
zeros
((
2
,
0
)),
np
.
zeros
((
0
,)),
np
.
zeros
((
0
,))),
leads
.
StabilizedModes
(
np
.
zeros
((
0
,
0
)),
np
.
zeros
((
0
,
0
)),
0
,
np
.
zeros
((
1
,
0
))))
actual
=
leads
.
modes
(
h_cell
,
h_hop
)
assert
all
(
np
.
alltrue
(
getattr
(
actual
[
1
],
attr
)
==
getattr
(
expected
[
1
],
attr
))
for
attr
in
(
'
vecs
'
,
'
vecslmbdainv
'
,
'
nmodes
'
,
'
sqrt_hop
'
))
assert
all
(
np
.
alltrue
(
getattr
(
actual
[
0
],
attr
)
==
getattr
(
expected
[
0
],
attr
))
for
attr
in
(
'
wave_functions
'
,
'
velocities
'
,
'
momenta
'
))
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