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
b9f43ec4
Commit
b9f43ec4
authored
12 years ago
by
Anton Akhmerov
Committed by
Christoph Groth
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix bug in TranslationalSymmetry.reversed
parent
964e9b51
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/lattice.py
+12
-14
12 additions, 14 deletions
kwant/lattice.py
with
12 additions
and
14 deletions
kwant/lattice.py
+
12
−
14
View file @
b9f43ec4
...
...
@@ -245,6 +245,7 @@ class TranslationalSymmetry(builder.Symmetry):
# A dictionary containing cached data required for applying the
# symmetry to different site groups.
self
.
site_group_data
=
{}
self
.
is_reversed
=
False
def
add_site_group
(
self
,
gr
,
other_vectors
=
None
):
"""
...
...
@@ -326,7 +327,8 @@ class TranslationalSymmetry(builder.Symmetry):
def
which
(
self
,
site
):
det_x_inv_m_part
,
det_m
=
self
.
_get_site_group_data
(
site
.
group
)[
-
2
:]
return
ta
.
dot
(
det_x_inv_m_part
,
site
.
tag
)
//
det_m
result
=
ta
.
dot
(
det_x_inv_m_part
,
site
.
tag
)
//
det_m
return
-
result
if
self
.
is_reversed
else
result
def
act
(
self
,
element
,
a
,
b
=
None
):
m_part
=
self
.
_get_site_group_data
(
a
.
group
)[
0
]
...
...
@@ -335,6 +337,8 @@ class TranslationalSymmetry(builder.Symmetry):
except
ValueError
:
msg
=
'
Expecting a {0}-tuple group element, but got `{1}` instead.
'
raise
ValueError
(
msg
.
format
(
self
.
num_directions
,
element
))
if
self
.
is_reversed
:
delta
*=
-
1
if
b
is
None
:
return
builder
.
Site
(
a
.
group
,
a
.
tag
+
delta
,
True
)
elif
b
.
group
is
a
.
group
:
...
...
@@ -348,6 +352,8 @@ class TranslationalSymmetry(builder.Symmetry):
msg
=
'
Expecting a {0}-tuple group element,
'
+
\
'
but got `{1}` instead.
'
raise
ValueError
(
msg
.
format
(
self
.
num_directions
,
element
))
if
self
.
is_reversed
:
delta2
*=
-
1
return
builder
.
Site
(
a
.
group
,
a
.
tag
+
delta
,
True
),
\
builder
.
Site
(
b
.
group
,
b
.
tag
+
delta2
,
True
)
...
...
@@ -357,20 +363,12 @@ class TranslationalSymmetry(builder.Symmetry):
def
reversed
(
self
):
"""
Return a reversed copy of the symmetry.
The result is identical to creating a new symmetry with all the
period vectors opposite to the original but with the same fundamental
domain.
The resulting symmetry has all the period vectors opposite to the
original and an identical fundamental domain.
"""
periods
=
[[
-
i
for
i
in
j
]
for
j
in
self
.
periods
]
result
=
TranslationalSymmetry
(
*
periods
)
for
gr
in
self
.
site_group_data
:
m_part
,
det_x_inv_m_part
,
det_m
=
self
.
site_group_data
[
gr
]
if
self
.
num_directions
%
2
:
det_m
=
-
det_m
else
:
det_x_inv_m_part
=
-
det_x_inv_m_part
m_part
=
-
m_part
result
.
site_group_data
[
gr
]
=
(
m_part
,
det_x_inv_m_part
,
det_m
)
result
=
TranslationalSymmetry
(
*
self
.
periods
)
result
.
site_group_data
=
self
.
site_group_data
result
.
is_reversed
=
not
self
.
is_reversed
return
result
...
...
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