Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qsymm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
11
Issues
11
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Quantum Tinkerer
qsymm
Commits
82c780a2
Commit
82c780a2
authored
Nov 01, 2019
by
Joseph Weston
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug when multiplying BlochCoeff by sympy expression
parent
ae1ed26b
Pipeline
#23487
passed with stage
in 2 minutes and 44 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Sidebyside
Showing
3 changed files
with
9 additions
and
2 deletions
+9
2
CHANGELOG.md
CHANGELOG.md
+2
0
qsymm/hamiltonian_generator.py
qsymm/hamiltonian_generator.py
+3
1
qsymm/model.py
qsymm/model.py
+4
1
No files found.
CHANGELOG.md
View file @
82c780a2
...
...
@@ 12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### 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
...
...
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
:
...
...
qsymm/model.py
View file @
82c780a2
...
...
@@ 398,7 +398,10 @@ class Model(UserDict):
result
=
self
.
__mul__
(
other
)
elif
isinstance
(
other
,
Basic
):
keep
=
self
.
keep
result
=
sum
((
type
(
self
)({
other
*
key
:
copy
(
val
)},
# 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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment