diff --git a/docs/source/tutorial/basics.rst b/docs/source/tutorial/basics.rst index 10f0fa6a861850fc9a94a7c4bda656cfabb15ddf..6d56caf46c4d6242b8e81742f5a4dc21bb5d4e7b 100644 --- a/docs/source/tutorial/basics.rst +++ b/docs/source/tutorial/basics.rst @@ -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` 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']) diff --git a/environment-latest.yml b/environment-latest.yml index 33dff4c2f684e1f74808318a0806f920c958d686..b428f1e1c0bfc69b9d8bbb2b233e8739b071c774 100644 --- a/environment-latest.yml +++ b/environment-latest.yml @@ -2,7 +2,7 @@ name: qsymm-latest channels: - conda-forge dependencies: - - python=3.9 + - python=3.10 - numpy - scipy - sympy diff --git a/pytest.ini b/pytest.ini index 64b068597c69f9c8ca36e3d199e20884c0187070..4fa8ee76f6731854d8c6b94d968c4b5b884d1b02 100644 --- a/pytest.ini +++ b/pytest.ini @@ -4,7 +4,9 @@ filterwarnings = # Remove once we rely on scipy v1.5 (maybe earlier) ignore:can't resolve package from __spec__ or __package__:ImportWarning 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 # Remove once setuptools figures it out ignore:lib2to3:PendingDeprecationWarning