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
a5cb1ac1
Commit
a5cb1ac1
authored
5 years ago
by
Joseph Weston
Browse files
Options
Downloads
Patches
Plain Diff
use BlochModels wherever possible
parent
e5daf0b3
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/tests/test_qsymm.py
+7
-8
7 additions, 8 deletions
kwant/tests/test_qsymm.py
with
7 additions
and
8 deletions
kwant/tests/test_qsymm.py
+
7
−
8
View file @
a5cb1ac1
...
...
@@ -19,7 +19,7 @@ from qsymm.symmetry_finder import symmetries
from
qsymm.hamiltonian_generator
import
bloch_family
,
hamiltonian_from_family
from
qsymm.groups
import
(
hexagonal
,
PointGroupElement
,
spin_matrices
,
spin_rotation
,
ContinuousGroupGenerator
)
from
qsymm.model
import
Model
,
e
,
I
,
_commutative_momenta
from
qsymm.model
import
Model
,
BlochModel
,
BlochCoeff
from
qsymm.linalg
import
allclose
import
kwant
...
...
@@ -277,14 +277,14 @@ def test_inverse_transform():
# Hopping to a neighbouring atom one primitive lattice vector away
hopping_vectors
=
[(
'
A
'
,
'
A
'
,
[
1
,
0
])]
# Make family
family
=
bloch_family
(
hopping_vectors
,
symmetries
,
norbs
)
family
=
bloch_family
(
hopping_vectors
,
symmetries
,
norbs
,
bloch_model
=
True
)
fam
=
hamiltonian_from_family
(
family
,
tosympy
=
False
)
# Atomic coordinates within the unit cell
atom_coords
=
[(
0
,
0
)]
lat_vecs
=
[(
1
,
0
),
(
0
,
1
)]
syst
=
model_to_builder
(
fam
,
norbs
,
lat_vecs
,
atom_coords
)
# Convert it back
ham2
=
builder_to_model
(
syst
)
.
tomodel
(
nsimplify
=
True
)
ham2
=
builder_to_model
(
syst
)
# Check that it's the same as the original
assert
fam
==
ham2
...
...
@@ -315,11 +315,10 @@ def test_consistency_kwant():
# Make the 1D Model manually using only qsymm features.
c0
,
c1
=
sympy
.
symbols
(
'
c0 c1
'
,
real
=
True
)
kx
=
_commutative_momenta
[
0
]
Ham
=
Model
({
c0
*
e
**
(
-
I
*
kx
):
T
},
momenta
=
[
'
k_x
'
])
Ham
=
Bloch
Model
({
BlochCoeff
(
np
.
array
([
-
1
]),
c0
):
T
},
momenta
=
[
'
k_x
'
])
Ham
+=
Ham
.
T
().
conj
()
Ham
+=
Model
({
c1
:
H
},
momenta
=
[
'
k_x
'
])
Ham
+=
Bloch
Model
({
BlochCoeff
(
np
.
array
([
0
]),
c1
)
:
H
},
momenta
=
[
'
k_x
'
])
# Two superimposed atoms, same number of orbitals on each
norbs
=
OrderedDict
([(
'
A
'
,
orbs
),
(
'
B
'
,
orbs
)])
...
...
@@ -376,9 +375,9 @@ def test_consistency_kwant():
# Get the model back from the builder
# From the Kwant builder based on original Model
Ham1
=
builder_to_model
(
model_syst
,
momenta
=
Ham
.
momenta
)
.
tomodel
(
nsimplify
=
True
)
Ham1
=
builder_to_model
(
model_syst
,
momenta
=
Ham
.
momenta
)
# From the pure Kwant builder
Ham2
=
builder_to_model
(
kwant_syst
,
momenta
=
Ham
.
momenta
)
.
tomodel
(
nsimplify
=
True
)
Ham2
=
builder_to_model
(
kwant_syst
,
momenta
=
Ham
.
momenta
)
assert
Ham
==
Ham1
assert
Ham
==
Ham2
...
...
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