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
2530d3ad
Commit
2530d3ad
authored
11 years ago
by
Christoph Groth
Browse files
Options
Downloads
Patches
Plain Diff
optimze lattice.Shape
parent
59b0c3e8
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/lattice.py
+17
-11
17 additions, 11 deletions
kwant/lattice.py
with
17 additions
and
11 deletions
kwant/lattice.py
+
17
−
11
View file @
2530d3ad
...
...
@@ -518,7 +518,7 @@ class Shape(object):
elif
not
isinstance
(
symmetry
,
builder
.
Symmetry
):
symmetry
=
symmetry
.
symmetry
def
sym
_site
(
lat
,
tag
):
def
fd
_site
(
lat
,
tag
):
return
symmetry
.
to_fd
(
Site
(
lat
,
tag
,
True
))
dim
=
len
(
start
)
...
...
@@ -532,29 +532,35 @@ class Shape(object):
sites
=
[]
for
tag
in
set
(
sl
.
closest
(
start
)
for
sl
in
sls
):
for
sl
in
sls
:
site
=
sym
_site
(
sl
,
tag
)
site
=
fd
_site
(
sl
,
tag
)
if
func
(
site
.
pos
):
sites
.
append
(
site
)
if
not
sites
:
msg
=
'
No sites close to {0} are inside the desired shape.
'
raise
ValueError
(
msg
.
format
(
start
))
tags
=
set
(
s
.
tag
for
s
in
sites
)
old_sites
=
set
()
while
sites
:
old_tags
=
tags
tags
=
set
()
for
site
in
sites
:
yield
site
tags
.
add
(
site
.
tag
)
tags
=
set
(
tag
+
delta
for
tag
in
tags
for
delta
in
deltas
)
new_sites
=
set
()
old_tags
|=
tags
new_tags
=
set
()
for
tag
in
tags
:
for
delta
in
deltas
:
new_tag
=
tag
+
delta
if
new_tag
not
in
old_tags
:
new_tags
.
add
(
new_tag
)
sites
=
set
()
for
tag
in
new_tags
:
for
sl
in
sls
:
site
=
sym_site
(
sl
,
tag
)
if
site
not
in
old_sites
and
site
not
in
sites
\
and
func
(
site
.
pos
):
new_sites
.
add
(
site
)
old_sites
=
sites
sites
=
new_sites
site
=
fd_site
(
sl
,
tag
)
if
site
.
tag
not
in
old_tags
and
func
(
site
.
pos
):
sites
.
add
(
site
)
################ Library of lattices (to be extended)
...
...
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