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
79d994be
Commit
79d994be
authored
11 years ago
by
Michael Wimmer
Committed by
Christoph Groth
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix ordering of modes and momenta
parent
d685dc0d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kwant/physics/leads.py
+4
-3
4 additions, 3 deletions
kwant/physics/leads.py
kwant/physics/tests/test_leads.py
+1
-1
1 addition, 1 deletion
kwant/physics/tests/test_leads.py
with
5 additions
and
4 deletions
kwant/physics/leads.py
+
4
−
3
View file @
79d994be
...
...
@@ -498,9 +498,10 @@ def make_proper_modes(lmbdainv, psi, extract, tol=1e6):
raise
RuntimeError
(
"
Numbers of left- and right-propagating
"
"
modes differ, possibly due to a numerical
"
"
instability.
"
)
momenta
=
np
.
angle
(
lmbdainv
)
order
=
np
.
lexsort
([
np
.
sign
(
velocities
),
-
np
.
sign
(
velocities
)
*
momenta
,
velocities
])
momenta
=
-
np
.
angle
(
lmbdainv
)
order
=
np
.
lexsort
([
velocities
,
-
np
.
sign
(
velocities
)
*
momenta
,
np
.
sign
(
velocities
)])
# The following is necessary due to wrong numpy handling of zero length
# arrays, which is going to be fixed in numpy 1.8.
if
not
len
(
order
):
...
...
This diff is collapsed.
Click to expand it.
kwant/physics/tests/test_leads.py
+
1
−
1
View file @
79d994be
...
...
@@ -226,7 +226,7 @@ def test_modes():
assert
stab
.
nmodes
==
1
assert
stab
.
sqrt_hop
is
None
np
.
testing
.
assert_almost_equal
(
prop
.
velocities
,
[
-
v
,
v
])
np
.
testing
.
assert_almost_equal
(
prop
.
momenta
,
[
-
k
,
k
])
np
.
testing
.
assert_almost_equal
(
prop
.
momenta
,
[
k
,
-
k
])
# Test for normalization by current.
np
.
testing
.
assert_almost_equal
(
2
*
(
stab
.
vecs
[
0
]
*
stab
.
vecslmbdainv
[
0
].
conj
()).
imag
,
[
1
,
-
1
])
...
...
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