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
47d7302e
Verified
Commit
47d7302e
authored
4 years ago
by
Anton Akhmerov
Browse files
Options
Downloads
Patches
Plain Diff
clarify and streamline the logic of eradicate dangling
parent
0526bda4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kwant/builder.py
+17
-17
17 additions, 17 deletions
kwant/builder.py
with
17 additions
and
17 deletions
kwant/builder.py
+
17
−
17
View file @
47d7302e
...
...
@@ -886,32 +886,32 @@ class Builder:
Sites are considered as dangling when less than two hoppings
lead to them.
"""
to_fd
=
self
.
symmetry
.
to_fd
sites
=
list
(
site
for
site
in
self
.
H
if
self
.
_out_degree
(
site
)
<
2
)
for
site
in
sites
:
# We could have deleted the site already if there was e.g. an
# isolated hopping.
if
site
not
in
self
.
H
:
continue
while
site
:
if
site
not
in
self
.
H
:
site
=
to_fd
(
site
)
while
self
.
_out_degree
(
site
)
<
2
:
neighbors
=
tuple
(
self
.
_out_neighbors
(
site
))
if
neighbors
:
assert
len
(
neighbors
)
==
1
neighbor
=
neighbors
[
0
]
# test if neighbor in fundamental domain
if
neighbor
in
self
.
H
:
self
.
_del_edge
(
neighbor
,
site
)
if
self
.
_out_degree
(
neighbor
)
>
1
:
neighbor
=
False
else
:
self
.
_del_edge
(
*
to_fd
(
neighbor
,
site
))
if
self
.
_out_degree
(
to_fd
(
neighbor
))
>
1
:
neighbor
=
False
if
not
neighbors
:
del
self
.
H
[
site
]
break
(
neighbor
,)
=
neighbors
if
neighbor
in
self
.
H
:
# neighbor is in the fundamental domain
edge
=
(
neighbor
,
site
)
else
:
neighbor
=
False
edge
=
self
.
symmetry
.
to_fd
(
neighbor
,
site
)
neighbor
=
self
.
symmetry
.
to_fd
(
neighbor
)
self
.
_del_edge
(
*
edge
)
del
self
.
H
[
site
]
# Neighbor could become dangling now.
site
=
neighbor
def
__iter__
(
self
):
...
...
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