Commit 37a11a52 authored by Pablo Piskunow's avatar Pablo Piskunow
Browse files

fix eradicate dangling accross translational symmetry

parent e2a4343e
Pipeline #38201 passed with stages
in 15 minutes and 1 second
......@@ -886,8 +886,10 @@ class Builder:
Sites are considered as dangling when less than two hoppings
lead to them.
"""
tfd = self.symmetry.to_fd
sites = list(site for site in self.H
if self._out_degree(site) < 2)
for site in sites:
if site not in self.H:
continue
......@@ -896,9 +898,15 @@ class Builder:
if neighbors:
assert len(neighbors) == 1
neighbor = neighbors[0]
self._del_edge(neighbor, site)
if self._out_degree(neighbor) > 1:
neighbor = False
if neighbor in self.H:
self._del_edge(neighbor, site)
if self._out_degree(neighbor) > 1:
neighbor = False
else:
assert not self.symmetry.in_fd(neighbor)
self._del_edge(*tfd(neighbor, site))
if self._out_degree(tfd(neighbor)) > 1:
neighbor = False
else:
neighbor = False
del self.H[site]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment