Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
Dennis Heffels
kwant
Commits
d1644397
Commit
d1644397
authored
5 years ago
by
Christoph Groth
Browse files
Options
Downloads
Patches
Plain Diff
make site arrays proper sequences
parent
5fd117c1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kwant/system.py
+9
-3
9 additions, 3 deletions
kwant/system.py
with
9 additions
and
3 deletions
kwant/system.py
+
9
−
3
View file @
d1644397
...
...
@@ -19,7 +19,7 @@ import abc
import
warnings
import
operator
from
copy
import
copy
from
collections
import
namedtuple
import
collections
from
functools
import
total_ordering
,
lru_cache
import
numpy
as
np
import
tinyarray
as
ta
...
...
@@ -96,7 +96,7 @@ class Site(tuple):
return
self
.
family
.
pos
(
self
.
tag
)
class
SiteArray
:
class
SiteArray
(
collections
.
abc
.
Sequence
)
:
"""
An array of sites, members of a `SiteFamily`.
Parameters
...
...
@@ -137,6 +137,12 @@ class SiteArray:
def
__len__
(
self
):
return
len
(
self
.
tags
)
def
__getitem__
(
self
,
key
):
if
isinstance
(
key
,
slice
):
return
SiteArray
(
self
.
family
,
self
.
tags
[
key
])
else
:
return
Site
(
self
.
family
,
self
.
tags
[
key
])
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
SiteArray
):
raise
NotImplementedError
()
...
...
@@ -527,7 +533,7 @@ class System(metaclass=abc.ABCMeta):
hamiltonian_submatrix
=
_system
.
hamiltonian_submatrix
Term
=
namedtuple
(
Term
=
collections
.
namedtuple
(
"
Term
"
,
[
"
subgraph
"
,
"
symmetry_element
"
,
"
hermitian
"
,
"
parameters
"
],
)
...
...
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