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
No related branches found
No related tags found
1 merge request!23Saving qsymm models
Pipeline #114415 passed
...@@ -213,20 +213,23 @@ and :ref:`tutorial_kekule`. ...@@ -213,20 +213,23 @@ and :ref:`tutorial_kekule`.
Saving and loading Qsymm models 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: To save we do:
.. jupyter-execute:: .. jupyter-execute::
H2D_str = str(H2D.tosympy(nsimplify=True)) H2D_sympy = H2D.tosympy()
file = open("H2D.txt", "w") with open("H2D.txt", "w") as f:
file.write(H2D_str) f.write(str(H2D))
file.close()
To load we do: To load we do:
.. jupyter-execute:: .. 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']) loaded_H2D = qsymm.Model(sympy.parsing.sympy_parser.parse_expr(f), momenta=['k_x', 'k_z'])
...@@ -9,4 +9,4 @@ filterwarnings = ...@@ -9,4 +9,4 @@ filterwarnings =
# Remove once this does not need to be ignored # 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
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment