Skip to content
Snippets Groups Projects
Commit 8d1396b8 authored by Anton Akhmerov's avatar Anton Akhmerov Committed by Isidora Araya
Browse files

Apply 4 suggestion(s) to 2 file(s)

parent 4cd7a01e
Branches
Tags
1 merge request!23Saving qsymm models
Pipeline #114415 passed
......@@ -213,20 +213,23 @@ and :ref:`tutorial_kekule`.
Saving and loading Qsymm models
-------------------------------------------------
We can save and load 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_str = str(H2D.tosympy(nsimplify=True))
H2D_sympy = H2D.tosympy()
file = open("H2D.txt", "w")
file.write(H2D_str)
file.close()
with open("H2D.txt", "w") as f:
f.write(str(H2D))
To load we do:
.. jupyter-execute::
f = open('H2D.txt','r').read()
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'])
......@@ -9,4 +9,4 @@ filterwarnings =
# Remove once this does not need to be ignored
ignore:np\.asscalar\(a\) is deprecated since NumPy v1\.16, use a\.item\(\) instead:DeprecationWarning
# Remove once setuptools figures it out
ignore:lib2to3:PendingDeprecationWarning
\ No newline at end of file
ignore:lib2to3:PendingDeprecationWarning
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment