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
cdce47f9
Commit
cdce47f9
authored
10 years ago
by
Anton Akhmerov
Committed by
Christoph Groth
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
builder cleanup: error handling, unused imports
Conflicts: kwant/builder.py
parent
00b0536c
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/builder.py
+7
-10
7 additions, 10 deletions
kwant/builder.py
with
7 additions
and
10 deletions
kwant/builder.py
+
7
−
10
View file @
cdce47f9
...
...
@@ -13,13 +13,12 @@ __all__ = ['Builder', 'Site', 'SiteFamily', 'SimpleSiteFamily', 'Symmetry',
'
BuilderKeyError
'
,
'
format_hopping
'
]
import
abc
import
sys
import
warnings
import
operator
from
itertools
import
izip
,
islice
,
chain
import
tinyarray
as
ta
import
numpy
as
np
from
.
import
system
,
graph
,
physics
from
.
import
system
,
graph
class
BuilderKeyError
(
KeyError
):
...
...
@@ -95,10 +94,9 @@ class Site(tuple):
return
tuple
.
__new__
(
cls
,
(
family
,
tag
))
try
:
tag
=
family
.
normalize_tag
(
tag
)
except
(
TypeError
,
ValueError
):
t
,
v
,
tb
=
sys
.
exc_info
()
except
(
TypeError
,
ValueError
)
as
e
:
msg
=
'
Tag {0} is not allowed for site family {1}: {2}
'
raise
t
(
msg
.
format
(
repr
(
tag
),
repr
(
family
),
v
))
raise
t
ype
(
e
)
(
msg
.
format
(
repr
(
tag
),
repr
(
family
),
e
.
args
[
0
]
))
return
tuple
.
__new__
(
cls
,
(
family
,
tag
))
def
__repr__
(
self
):
...
...
@@ -432,7 +430,7 @@ class Lead(object):
__metaclass__
=
abc
.
ABCMeta
@abc.abstractmethod
def
finalized
():
def
finalized
(
self
):
"""
Return a finalized version of the lead.
Returns
...
...
@@ -537,7 +535,7 @@ class ModesLead(Lead):
return
self
.
modes_func
(
energy
,
args
)
def
selfenergy
(
self
,
energy
,
args
=
()):
propagating
,
stabilized
=
self
.
modes
(
energy
,
args
)
stabilized
=
self
.
modes
(
energy
,
args
)
[
1
]
return
stabilized
.
selfenergy
()
...
...
@@ -1214,11 +1212,10 @@ class Builder(object):
raise
try
:
interface
=
[
id_by_site
[
isite
]
for
isite
in
lead
.
interface
]
except
KeyError
,
e
:
t
,
v
,
tb
=
sys
.
exc_info
()
except
KeyError
as
e
:
msg
=
(
"
Lead {0} is attached to a site that does not
"
"
belong to the scattering region:
\n
{1}
"
)
raise
ValueError
(
msg
.
format
(
lead_nr
,
v
))
raise
ValueError
(
msg
.
format
(
lead_nr
,
e
.
args
[
0
]
))
lead_interfaces
.
append
(
np
.
array
(
interface
))
...
...
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