Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Q
qsymm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
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
Quantum Tinkerer
qsymm
Commits
281711dc
Commit
281711dc
authored
5 years ago
by
Dániel Varjas
Browse files
Options
Downloads
Patches
Plain Diff
aviod conversion between Model and BlochModel in bloch_hamiltonian
parent
8889d5ac
Branches
Branches containing commit
Tags
v1.2.2
Tags containing commit
1 merge request
!11
Fix inconsistency in sympy symbols in Models
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
qsymm/hamiltonian_generator.py
+18
-12
18 additions, 12 deletions
qsymm/hamiltonian_generator.py
with
18 additions
and
12 deletions
qsymm/hamiltonian_generator.py
+
18
−
12
View file @
281711dc
...
...
@@ -7,7 +7,7 @@ from copy import deepcopy
import
tinyarray
as
ta
from
.linalg
import
matrix_basis
,
nullspace
,
sparse_basis
,
family_to_vectors
,
rref
,
allclose
from
.model
import
Model
,
BlochModel
,
_commutative_momenta
,
e
,
I
from
.model
import
Model
,
BlochModel
,
BlochCoeff
,
_commutative_momenta
,
e
,
I
from
.groups
import
PointGroupElement
,
ContinuousGroupGenerator
,
generate_group
from
.
import
kwant_continuum
...
...
@@ -571,6 +571,7 @@ def symmetrize_monomial(monomial, symmetries):
def
bloch_family
(
hopping_vectors
,
symmetries
,
norbs
,
onsites
=
True
,
momenta
=
_commutative_momenta
,
symmetrize
=
True
,
prettify
=
True
,
num_digits
=
10
,
bloch_model
=
False
):
"""
Generate a family of symmetric Bloch-Hamiltonians.
...
...
@@ -591,7 +592,10 @@ def bloch_family(hopping_vectors, symmetries, norbs, onsites=True,
corresponding to each site.
onsites : bool, default True
Whether to include on-site terms consistent with the symmetry.
symmetrize : bool
momenta : iterable of strings or Sympy symbols
Names of momentum variables, default ``[
'
k_x
'
,
'
k_y
'
,
'
k_z
'
]`` or
corresponding sympy symbols.
symmetrize : bool, default True
Whether to use the symmetrization strategy. This does not require
a full set of hoppings to start, all symmetry related hoppings
are generated. Otherwise the constraining strategy is used, this does
...
...
@@ -670,16 +674,22 @@ def bloch_family(hopping_vectors, symmetries, norbs, onsites=True,
n
,
m
=
norbs
[
a
],
norbs
[
b
]
block_basis
=
np
.
eye
(
n
*
m
,
n
*
m
).
reshape
((
n
*
m
,
n
,
m
))
block_basis
=
np
.
concatenate
((
block_basis
,
1j
*
block_basis
))
# Hopping direction in real space
# Dot product with momentum vector
phase
=
sum
([
coordinate
*
momentum
for
coordinate
,
momentum
in
zip
(
vec
,
_commutative_momenta
[:
dim
])])
factor
=
e
**
(
I
*
phase
)
if
bloch_model
:
bloch_coeff
=
BlochCoeff
(
np
.
array
(
vec
),
sympy
.
sympify
(
1
))
else
:
# Hopping direction in real space
# Dot product with momentum vector
phase
=
sum
([
coordinate
*
momentum
for
coordinate
,
momentum
in
zip
(
vec
,
momenta
[:
dim
])])
factor
=
e
**
(
I
*
phase
)
hopfamily
=
[]
for
mat
in
block_basis
:
matrix
=
np
.
zeros
((
N
,
N
),
dtype
=
complex
)
matrix
[
ranges
[
a
],
ranges
[
b
]]
=
mat
term
=
Model
({
factor
:
matrix
},
momenta
=
(
'
k_x
'
,
'
k_y
'
,
'
k_z
'
)[:
dim
])
if
bloch_model
:
term
=
BlochModel
({
bloch_coeff
:
matrix
},
momenta
=
momenta
[:
dim
])
else
:
term
=
Model
({
factor
:
matrix
},
momenta
=
momenta
[:
dim
])
term
=
term
+
term
.
T
().
conj
()
hopfamily
.
append
(
term
)
# If there are conserved quantities, constrain the hopping, it is assumed that
...
...
@@ -687,10 +697,6 @@ def bloch_family(hopping_vectors, symmetries, norbs, onsites=True,
if
conserved
:
hopfamily
=
constrain_family
(
conserved
,
hopfamily
)
family
.
extend
(
hopfamily
)
# Use BlochModel objects instead of Model.
if
bloch_model
:
family
=
[
BlochModel
(
member
,
momenta
=
member
.
momenta
)
for
member
in
family
]
if
symmetrize
:
# Make sure that group is generated while keeping track of unitary part.
for
g
in
pg
:
...
...
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