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
3adfe8c4
Commit
3adfe8c4
authored
2 years ago
by
Anton Akhmerov
Browse files
Options
Downloads
Plain Diff
Merge branch 'json-serialization' into 'master'
Saving qsymm models Closes
#34
See merge request
!23
parents
56be9ec9
8d1396b8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!23
Saving qsymm models
Pipeline
#114417
passed
2 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docs/source/tutorial/basics.rst
+24
-0
24 additions, 0 deletions
docs/source/tutorial/basics.rst
environment-latest.yml
+1
-1
1 addition, 1 deletion
environment-latest.yml
pytest.ini
+3
-1
3 additions, 1 deletion
pytest.ini
with
28 additions
and
2 deletions
docs/source/tutorial/basics.rst
+
24
−
0
View file @
3adfe8c4
...
@@ -209,3 +209,27 @@ It is exactly the Hamiltonian family we started with.
...
@@ -209,3 +209,27 @@ It is exactly the Hamiltonian family we started with.
For more detailed examples see :ref:`tutorial_kdotp_generator`, :ref:`tutorial_bloch_generator`
For more detailed examples see :ref:`tutorial_kdotp_generator`, :ref:`tutorial_bloch_generator`
and :ref:`tutorial_kekule`.
and :ref:`tutorial_kekule`.
Saving and loading Qsymm models
-------------------------------------------------
Qsymm models and identified symmetries don't guarantee consistent ordering and basis selection
across multiple runs. To avoid irrerproducible results you may use the ``Model.tosympy`` method
and serialize the resulting sympy expression as shown below.
To save we do:
.. jupyter-execute::
H2D_sympy = H2D.tosympy()
with open("H2D.txt", "w") as f:
f.write(str(H2D))
To load we do:
.. jupyter-execute::
with open("H2D.txt") as f:
data = f.read()
loaded_H2D = qsymm.Model(sympy.parsing.sympy_parser.parse_expr(f), momenta=['k_x', 'k_z'])
This diff is collapsed.
Click to expand it.
environment-latest.yml
+
1
−
1
View file @
3adfe8c4
...
@@ -2,7 +2,7 @@ name: qsymm-latest
...
@@ -2,7 +2,7 @@ name: qsymm-latest
channels
:
channels
:
-
conda-forge
-
conda-forge
dependencies
:
dependencies
:
-
python=3.
9
-
python=3.
10
-
numpy
-
numpy
-
scipy
-
scipy
-
sympy
-
sympy
...
...
This diff is collapsed.
Click to expand it.
pytest.ini
+
3
−
1
View file @
3adfe8c4
...
@@ -4,7 +4,9 @@ filterwarnings =
...
@@ -4,7 +4,9 @@ filterwarnings =
# Remove once we rely on scipy v1.5 (maybe earlier)
# Remove once we rely on scipy v1.5 (maybe earlier)
ignore:can't
resolve
package
from
__spec__
or
__package__:ImportWarning
ignore:can't
resolve
package
from
__spec__
or
__package__:ImportWarning
ignore:the
matrix
subclass
is
not
the
recommended
way
to
represent
matrices:PendingDeprecationWarning
ignore:the
matrix
subclass
is
not
the
recommended
way
to
represent
matrices:PendingDeprecationWarning
# Remove once we rely on sympy v1.3
# Remove once sympy fixes how it uses distutils
ignore:distutils
Version
classes
are
deprecated.
Use
packaging.version
instead:DeprecationWarning
# Remove once this does not need to be ignored
ignore:np\.asscalar\(a\)
is
deprecated
since
NumPy
v1\.16,
use
a\.item\(\)
instead:DeprecationWarning
ignore:np\.asscalar\(a\)
is
deprecated
since
NumPy
v1\.16,
use
a\.item\(\)
instead:DeprecationWarning
# Remove once setuptools figures it out
# Remove once setuptools figures it out
ignore:lib2to3:PendingDeprecationWarning
ignore:lib2to3:PendingDeprecationWarning
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