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
Compare revisions
e83157b9490b0882cdb76b521556eb67cf2d34d6 to 82c780a29ec7b0dee1776944169a973151544781
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
qt/qsymm
Select target project
No results found
82c780a29ec7b0dee1776944169a973151544781
Select Git revision
Swap
Target
qt/qsymm
Select target project
qt/qsymm
1 result
e83157b9490b0882cdb76b521556eb67cf2d34d6
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
fix unused variable bug in a seldom-executed code branch
· ae1ed26b
Joseph Weston
authored
5 years ago
ae1ed26b
fix bug when multiplying BlochCoeff by sympy expression
· 82c780a2
Joseph Weston
authored
5 years ago
82c780a2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+5
-0
5 additions, 0 deletions
CHANGELOG.md
qsymm/hamiltonian_generator.py
+3
-1
3 additions, 1 deletion
qsymm/hamiltonian_generator.py
qsymm/model.py
+8
-3
8 additions, 3 deletions
qsymm/model.py
with
16 additions
and
4 deletions
CHANGELOG.md
View file @
82c780a2
...
...
@@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-
Added citation instructions in CITING.md
-
Added a tutorial with downloadable Python files and Jupyter notebooks
### Fixed
-
Bug when multiplying a model by a sympy expression (undefined variable)
-
Bug when multiplying BlochCoeff with sympy expression (sympy multiplication was
being used, when BlochCoeff multiplication should have been used)
### Removed
-
Removed the notebooks from the source repository
...
...
This diff is collapsed.
Click to expand it.
qsymm/hamiltonian_generator.py
View file @
82c780a2
...
...
@@ -288,7 +288,9 @@ def hamiltonian_from_family(family, coeffs=None, nsimplify=True, tosympy=True):
coeffs
=
list
(
sympy
.
symbols
(
'
c0:%d
'
%
len
(
family
),
real
=
True
))
else
:
assert
len
(
coeffs
)
==
len
(
family
),
'
Length of family and coeffs do not match.
'
ham
=
sum
(
c
*
term
for
c
,
term
in
zip
(
coeffs
,
family
))
# The order of multiplication is important here, so that __mul__ of 'term'
# gets used. 'c' is a sympy symbol, which multiplies 'term' incorrectly.
ham
=
sum
(
term
*
c
for
c
,
term
in
zip
(
coeffs
,
family
))
if
tosympy
:
return
ham
.
tosympy
(
nsimplify
=
nsimplify
)
else
:
...
...
This diff is collapsed.
Click to expand it.
qsymm/model.py
View file @
82c780a2
...
...
@@ -360,6 +360,7 @@ class Model(UserDict):
result
=
self
.
zeros_like
()
result
.
data
=
{
key
:
val
*
other
for
key
,
val
in
self
.
items
()}
elif
isinstance
(
other
,
Basic
):
keep
=
self
.
keep
result
=
sum
((
type
(
self
)({
key
*
other
:
copy
(
val
)},
keep
=
keep
,
momenta
=
self
.
momenta
)
...
...
@@ -396,11 +397,15 @@ class Model(UserDict):
if
isinstance
(
other
,
Number
):
result
=
self
.
__mul__
(
other
)
elif
isinstance
(
other
,
Basic
):
result
=
sum
((
type
(
self
)({
other
*
key
:
copy
(
val
)},
keep
=
self
.
keep
,
keep
=
self
.
keep
# The order 'key * other' is important: we want to force
# the implementation of __mul__ of 'key' to be used. This
# is correct as long as the symbols in 'key' and 'other' commute.
result
=
sum
((
type
(
self
)({
key
*
other
:
copy
(
val
)},
keep
=
keep
,
momenta
=
self
.
momenta
)
for
key
,
val
in
self
.
items
()
if
(
key
*
other
in
self
.
keep
or
not
self
.
keep
)),
if
(
key
*
other
in
keep
or
not
keep
)),
self
.
zeros_like
())
else
:
# Otherwise try to multiply every value with other
...
...
This diff is collapsed.
Click to expand it.