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
9245b5b9
Commit
9245b5b9
authored
12 years ago
by
Anton Akhmerov
Committed by
Christoph Groth
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
detect a faulty TranslationalSymmetry when it is created
parent
004ee1fc
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kwant/lattice.py
+3
-0
3 additions, 0 deletions
kwant/lattice.py
kwant/tests/test_lattice.py
+1
-2
1 addition, 2 deletions
kwant/tests/test_lattice.py
with
4 additions
and
2 deletions
kwant/lattice.py
+
3
−
0
View file @
9245b5b9
...
...
@@ -239,6 +239,9 @@ class TranslationalSymmetry(builder.Symmetry):
msg
=
"
TranslationalSymmetry takes 1d sequences as parameters.
\n
"
\
"
See What
'
s new in kwant 0.2 in the documentation.
"
raise
ValueError
(
msg
)
if
np
.
linalg
.
matrix_rank
(
periods
)
<
len
(
periods
):
raise
ValueError
(
"
Translational symmetry periods must be
"
"
linearly independent
"
)
# A dictionary containing cached data required for applying the
# symmetry to different site groups.
self
.
site_group_data
=
{}
...
...
This diff is collapsed.
Click to expand it.
kwant/tests/test_lattice.py
+
1
−
2
View file @
9245b5b9
...
...
@@ -46,8 +46,7 @@ def test_translational_symmetry():
g2
=
lattice
.
make_lattice
(
np
.
identity
(
2
))
g3
=
lattice
.
make_lattice
(
np
.
identity
(
3
))
sym
=
ts
((
0
,
0
,
4
),
(
0
,
5
,
0
),
(
0
,
0
,
2
))
assert_raises
(
ValueError
,
sym
.
add_site_group
,
g3
)
assert_raises
(
ValueError
,
ts
,
(
0
,
0
,
4
),
(
0
,
5
,
0
),
(
0
,
0
,
2
))
sym
=
ts
((
3.3
,
0
))
assert_raises
(
ValueError
,
sym
.
add_site_group
,
g2
)
...
...
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