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
d1adb928
Verified
Commit
d1adb928
authored
5 years ago
by
Anton Akhmerov
Browse files
Options
Downloads
Patches
Plain Diff
use that sqrt_hop is never None
parent
6d067c16
No related branches found
No related tags found
No related merge requests found
Pipeline
#18181
passed with warnings
5 years ago
Stage: build-env
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kwant/physics/leads.py
+3
-3
3 additions, 3 deletions
kwant/physics/leads.py
kwant/solvers/common.py
+7
-16
7 additions, 16 deletions
kwant/solvers/common.py
with
10 additions
and
19 deletions
kwant/physics/leads.py
+
3
−
3
View file @
d1adb928
...
@@ -174,11 +174,11 @@ class StabilizedModes:
...
@@ -174,11 +174,11 @@ class StabilizedModes:
Translation eigenvectors divided by the corresponding eigenvalues.
Translation eigenvectors divided by the corresponding eigenvalues.
nmodes : int
nmodes : int
Number of left-moving (or right-moving) modes.
Number of left-moving (or right-moving) modes.
sqrt_hop : numpy array
or None
sqrt_hop : numpy array
Part of the SVD of `h_hop`
, or None if the latter is invertible
.
Part of the SVD of `h_hop`.
"""
"""
def
__init__
(
self
,
vecs
,
vecslmbdainv
,
nmodes
,
sqrt_hop
=
None
):
def
__init__
(
self
,
vecs
,
vecslmbdainv
,
nmodes
,
sqrt_hop
):
kwargs
=
locals
()
kwargs
=
locals
()
kwargs
.
pop
(
'
self
'
)
kwargs
.
pop
(
'
self
'
)
self
.
__dict__
.
update
(
kwargs
)
self
.
__dict__
.
update
(
kwargs
)
...
...
This diff is collapsed.
Click to expand it.
kwant/solvers/common.py
+
7
−
16
View file @
d1adb928
...
@@ -210,8 +210,7 @@ class SparseSolver(metaclass=abc.ABCMeta):
...
@@ -210,8 +210,7 @@ class SparseSolver(metaclass=abc.ABCMeta):
iface_orbs
=
np
.
r_
[
tuple
(
slice
(
offsets
[
i
],
offsets
[
i
+
1
])
iface_orbs
=
np
.
r_
[
tuple
(
slice
(
offsets
[
i
],
offsets
[
i
+
1
])
for
i
in
interface
)]
for
i
in
interface
)]
n_lead_orbs
=
(
svd_v
.
shape
[
0
]
if
svd_v
is
not
None
n_lead_orbs
=
svd_v
.
shape
[
0
]
else
u_out
.
shape
[
0
])
if
n_lead_orbs
!=
len
(
iface_orbs
):
if
n_lead_orbs
!=
len
(
iface_orbs
):
msg
=
(
'
Lead {0} has hopping with dimensions
'
msg
=
(
'
Lead {0} has hopping with dimensions
'
'
incompatible with its interface dimension.
'
)
'
incompatible with its interface dimension.
'
)
...
@@ -221,25 +220,17 @@ class SparseSolver(metaclass=abc.ABCMeta):
...
@@ -221,25 +220,17 @@ class SparseSolver(metaclass=abc.ABCMeta):
transf
=
sp
.
csc_matrix
((
np
.
ones
(
len
(
iface_orbs
)),
coords
),
transf
=
sp
.
csc_matrix
((
np
.
ones
(
len
(
iface_orbs
)),
coords
),
shape
=
(
iface_orbs
.
size
,
lhs
.
shape
[
0
]))
shape
=
(
iface_orbs
.
size
,
lhs
.
shape
[
0
]))
if
svd_v
is
not
None
:
v_sp
=
sp
.
csc_matrix
(
svd_v
.
T
.
conj
())
*
transf
v_sp
=
sp
.
csc_matrix
(
svd_v
.
T
.
conj
())
*
transf
vdaguout_sp
=
(
transf
.
T
*
vdaguout_sp
=
(
transf
.
T
*
sp
.
csc_matrix
(
np
.
dot
(
svd_v
,
u_out
)))
sp
.
csc_matrix
(
np
.
dot
(
svd_v
,
u_out
)))
lead_mat
=
-
ulinv_out
lead_mat
=
-
ulinv_out
else
:
v_sp
=
transf
vdaguout_sp
=
transf
.
T
*
sp
.
csc_matrix
(
u_out
)
lead_mat
=
-
ulinv_out
lhs
=
sp
.
bmat
([[
lhs
,
vdaguout_sp
],
[
v_sp
,
lead_mat
]],
lhs
=
sp
.
bmat
([[
lhs
,
vdaguout_sp
],
[
v_sp
,
lead_mat
]],
format
=
self
.
lhsformat
)
format
=
self
.
lhsformat
)
if
leadnum
in
in_leads
and
nprop
>
0
:
if
leadnum
in
in_leads
and
nprop
>
0
:
if
svd_v
is
not
None
:
vdaguin_sp
=
transf
.
T
*
sp
.
csc_matrix
(
vdaguin_sp
=
transf
.
T
*
sp
.
csc_matrix
(
-
np
.
dot
(
svd_v
,
u_in
))
-
np
.
dot
(
svd_v
,
u_in
))
else
:
vdaguin_sp
=
transf
.
T
*
sp
.
csc_matrix
(
-
u_in
)
# defer formation of the real matrix until the proper
# defer formation of the real matrix until the proper
# system size is known
# system size is known
...
...
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