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
a954beab
Commit
a954beab
authored
12 years ago
by
Anton Akhmerov
Committed by
Christoph Groth
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
minor refactoring of TranslationalSymmetry
parent
e7077783
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kwant/builder.py
+0
-1
0 additions, 1 deletion
kwant/builder.py
kwant/lattice.py
+12
-14
12 additions, 14 deletions
kwant/lattice.py
with
12 additions
and
15 deletions
kwant/builder.py
+
0
−
1
View file @
a954beab
...
...
@@ -970,7 +970,6 @@ class Builder(object):
'
different site groups. See tutorial for more details.
'
raise
ValueError
(
msg
.
format
(
tuple
(
groups
)))
all_doms
=
list
(
sym
.
which
(
site
)[
0
]
for
site
in
self
.
H
if
sym
.
to_fd
(
site
)
in
H
)
if
origin
is
not
None
:
...
...
This diff is collapsed.
Click to expand it.
kwant/lattice.py
+
12
−
14
View file @
a954beab
...
...
@@ -307,28 +307,26 @@ class TranslationalSymmetry(builder.Symmetry):
det_x_inv_m_part
=
det_x_inv_m
[:
num_dir
,
:]
m_part
=
m
[:,
:
num_dir
]
self
.
site_group_data
[
gr
]
=
(
ta
.
array
(
det_x_inv_m_part
),
ta
.
array
(
m_part
),
det_m
)
self
.
site_group_data
[
gr
]
=
(
ta
.
array
(
m_part
),
ta
.
array
(
det_x_inv_m_part
),
det_m
)
@property
def
num_directions
(
self
):
return
len
(
self
.
periods
)
def
which
(
self
,
site
):
def
_get_site_group_data
(
self
,
group
):
try
:
det_x_inv_m_part
,
m_part
,
det_m
=
self
.
site_group_data
[
site
.
group
]
return
self
.
site_group_data
[
group
]
except
KeyError
:
self
.
add_site_group
(
site
.
group
)
return
self
.
which
(
site
)
self
.
add_site_group
(
group
)
return
self
.
site_group_data
[
group
]
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
def
act
(
self
,
element
,
a
,
b
=
None
):
try
:
det_x_inv_m_part
,
m_part
,
det_m
=
self
.
site_group_data
[
a
.
group
]
except
KeyError
:
self
.
add_site_group
(
a
.
group
)
return
self
.
act
(
element
,
a
,
b
)
m_part
=
self
.
_get_site_group_data
(
a
.
group
)[
0
]
try
:
delta
=
ta
.
dot
(
m_part
,
element
)
except
ValueError
:
...
...
@@ -353,13 +351,13 @@ class TranslationalSymmetry(builder.Symmetry):
periods
=
[[
-
i
for
i
in
j
]
for
j
in
self
.
periods
]
result
=
TranslationalSymmetry
(
*
periods
)
for
gr
in
self
.
site_group_data
:
det_x_inv_m_part
,
m_part
,
det_m
=
self
.
site_group_data
[
gr
]
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
]
=
(
det_x_inv_m_part
,
m_part
,
det_m
)
result
.
site_group_data
[
gr
]
=
(
m_part
,
det_x_inv_m_part
,
det_m
)
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