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
b0045a4a
Commit
b0045a4a
authored
11 years ago
by
Anton Akhmerov
Committed by
Christoph Groth
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
improve error message when leads are incompatible with the system
parent
fa012f86
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kwant/solvers/common.py
+18
-4
18 additions, 4 deletions
kwant/solvers/common.py
with
18 additions
and
4 deletions
kwant/solvers/common.py
+
18
−
4
View file @
b0045a4a
...
...
@@ -179,15 +179,23 @@ class SparseSolver(object):
indices
.
append
(
np
.
arange
(
lhs
.
shape
[
0
],
lhs
.
shape
[
0
]
+
nprop
))
u_out
,
ulinv_out
=
u
[:,
nprop
:],
ulinv
[:,
nprop
:]
u_in
,
ulinv_in
=
u
[:,
:
nprop
],
ulinv
[:,
:
nprop
]
u_in
,
ulinv_in
=
u
[:,
:
nprop
],
ulinv
[:,
:
nprop
]
# Construct a matrix of 1's that translates the
# inter-cell hopping to a proper hopping
# from the system to the lead.
iface_orbs
=
np
.
r_
[
tuple
(
slice
(
offsets
[
i
],
offsets
[
i
+
1
])
for
i
in
interface
)]
coords
=
np
.
r_
[[
np
.
arange
(
iface_orbs
.
size
)],
[
iface_orbs
]]
transf
=
sp
.
csc_matrix
((
np
.
ones
(
iface_orbs
.
size
),
coords
),
n_lead_orbs
=
svd_v
.
shape
[
0
]
if
svd_v
is
not
None
else
\
u_out
.
shape
[
0
]
if
n_lead_orbs
!=
len
(
iface_orbs
):
msg
=
'
Lead {0} has hopping with dimensions
'
+
\
'
incompatible with its interface dimension.
'
raise
ValueError
(
msg
.
format
(
leadnum
))
coords
=
np
.
r_
[[
np
.
arange
(
len
(
iface_orbs
))],
[
iface_orbs
]]
transf
=
sp
.
csc_matrix
((
np
.
ones
(
len
(
iface_orbs
)),
coords
),
shape
=
(
iface_orbs
.
size
,
lhs
.
shape
[
0
]))
if
svd_v
is
not
None
:
...
...
@@ -220,7 +228,13 @@ class SparseSolver(object):
lead_info
.
append
(
sigma
)
vars
=
np
.
r_
[
tuple
(
slice
(
offsets
[
i
],
offsets
[
i
+
1
])
for
i
in
interface
)]
assert
sigma
.
shape
==
2
*
vars
.
shape
if
sigma
.
shape
!=
2
*
vars
.
shape
:
msg
=
'
Self-energy dimension for lead {0} does not
'
+
\
'
match the total number of orbitals of the
'
+
\
'
sites for which it is defined.
'
raise
ValueError
(
msg
.
format
(
leadnum
))
y
,
x
=
np
.
meshgrid
(
vars
,
vars
)
sig_sparse
=
splhsmat
((
sigma
.
flat
,
[
x
.
flat
,
y
.
flat
]),
lhs
.
shape
)
...
...
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