.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "master-tutorial/2_black-box/plot-2-lswt.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_master-tutorial_2_black-box_plot-2-lswt.py: magnopy-lswt ************ This page explains how to use optimize spin direction via numerical minimization. See docs for |magnopy-lswt|_ for full list of supported arguments. On this page we give examples of how to use the script and text and files that it can produce. Spin Hamiltonian and its source =============================== This script works with the spin Hamiltonian that is coming from some third-party software. At the moment magnopy supports |TB2J|_ and |GROGU|_. .. hint:: There is a number of ways to use this script with the hand-made Hamiltonian: * Prepare the file that mimics the format of |TB2J|_. * Prepare the file that mimics the |GROGU-FF|_. * Prepare the spin Hamiltonian programmatically and use the scenario of this command-line script from within your python script: :py:func:`magnopy.scenarios.optimize_sd`. Two parameters are required * Source of the spin Hamiltonian (``--spinham-source``); * Path to the file with the spin Hamiltonian (``--spinham-filename``) For example, if "ferro-easy-axis.txt" is a file with the spin Hamiltonian and the source of the file is |GROGU|_, then you can run the script as .. dropdown:: :octicon:`file;1em;custom-octicon-input` Input files * :download:`ferro-easy-axis.txt <../../resources/ferro-easy-axis.txt>` .. prompt-run:: :input-prefix: ../../resources/ :output-prefix: 1 :extra-command: -of {{OP:magnopy-results}} magnopy-lswt --spinham-source GROGU --spinham-filename {{IP:ferro-easy-axis.txt}} .. dropdown:: :octicon:`command-palette;1em;custom-octicon-output` Output to the console .. literalinclude:: prompt-run_plot-2-lswt/1/console-output.txt .. dropdown:: :octicon:`file;1em;custom-octicon-output` Created files * :download:`E_0.txt ` * :download:`E_2.txt ` * :download:`DELTAS.txt ` * :download:`DELTAS.png ` * :download:`HIGH-SYMMETRY_POINTS.txt ` * :download:`K-POINTS.txt ` * :download:`K-POINTS.html ` * :download:`OMEGAS.txt ` * :download:`OMEGAS.png ` * :download:`SPIN_VECTORS.txt ` * :download:`SPIN_DIRECTIONS.html ` Ground state ============ One need to know the ground state (i. e. spin directions for every spin of the Hamiltonian) for the calculation of the exited states. There are two ways for magnopy to know the spin directions * Input from the user User can provide a file with spin directions using the command .. dropdown:: :octicon:`file;1em;custom-octicon-input` Input files * :download:`ferro-easy-axis.txt <../../resources/ferro-easy-axis.txt>` * :download:`sd-ferro-easy-axis.txt <../../resources/sd-ferro-easy-axis.txt>` .. prompt-run:: :input-prefix: ../../resources/ :output-prefix: 2 :extra-command: -of {{OP:magnopy-results}} magnopy-lswt --spin-directions {{IP:sd-ferro-easy-axis.txt}} --spinham-source GROGU --spinham-filename {{IP:ferro-easy-axis.txt}} .. dropdown:: :octicon:`command-palette;1em;custom-octicon-output` Output to the console .. literalinclude:: prompt-run_plot-2-lswt/2/console-output.txt .. dropdown:: :octicon:`file;1em;custom-octicon-output` Created files * :download:`E_0.txt ` * :download:`E_2.txt ` * :download:`DELTAS.txt ` * :download:`DELTAS.png ` * :download:`HIGH-SYMMETRY_POINTS.txt ` * :download:`K-POINTS.txt ` * :download:`K-POINTS.html ` * :download:`OMEGAS.txt ` * :download:`OMEGAS.png ` * :download:`SPIN_VECTORS.txt ` * :download:`SPIN_DIRECTIONS.html ` * Internal optimization If user do not provide any input, then magnopy tries to optimize spin directions within unit cell. See also |magnopy-optimize-sd|_. K-path and k-points =================== Magnopy solves magnon problem for a set of points in reciprocal space. Therefore, it needs to know a set of k-points to perform the calculations. User is left with two options * ``--kpoints`` Provide explicit list of k-points .. dropdown:: :octicon:`file;1em;custom-octicon-input` Input files * :download:`ferro-easy-axis.txt <../../resources/ferro-easy-axis.txt>` * :download:`k-points-ferro-easy-axis.txt <../../resources/k-points-ferro-easy-axis.txt>` .. prompt-run:: :input-prefix: ../../resources/ :output-prefix: 3 :extra-command: -of {{OP:magnopy-results}} magnopy-lswt --kpoints {{IP:k-points-ferro-easy-axis.txt}} --relative --spinham-source GROGU --spinham-filename {{IP:ferro-easy-axis.txt}} .. dropdown:: :octicon:`command-palette;1em;custom-octicon-output` Output to the console .. literalinclude:: prompt-run_plot-2-lswt/3/console-output.txt .. dropdown:: :octicon:`file;1em;custom-octicon-output` Created files * :download:`E_0.txt ` * :download:`E_2.txt ` * :download:`DELTAS.txt ` * :download:`DELTAS.png ` * :download:`K-POINTS.txt ` * :download:`OMEGAS.txt ` * :download:`OMEGAS.png ` * :download:`SPIN_VECTORS.txt ` * :download:`SPIN_DIRECTIONS.html ` * ``--k-path`` Let magnopy deduce the set of high-symmetry points based on the space group of the crystal and use recommended k-path (see documentation of |wulfric|_ for more details, magnopy uses ``convention="HPKOT"``). User can control k-path, but limited to the list of the predefined high-symmetry points. .. dropdown:: :octicon:`file;1em;custom-octicon-input` Input files * :download:`ferro-easy-axis.txt <../../resources/ferro-easy-axis.txt>` .. prompt-run:: :input-prefix: ../../resources/ :output-prefix: 4 :extra-command: -of {{OP:magnopy-results}} magnopy-lswt --k-path GAMMA-X-S|GAMMA-Y --spinham-source GROGU --spinham-filename {{IP:ferro-easy-axis.txt}} .. dropdown:: :octicon:`command-palette;1em;custom-octicon-output` Output to the console .. literalinclude:: prompt-run_plot-2-lswt/4/console-output.txt .. dropdown:: :octicon:`file;1em;custom-octicon-output` Created files * :download:`E_0.txt ` * :download:`E_2.txt ` * :download:`DELTAS.txt ` * :download:`DELTAS.png ` * :download:`HIGH-SYMMETRY_POINTS.txt ` * :download:`K-POINTS.txt ` * :download:`K-POINTS.html ` * :download:`OMEGAS.txt ` * :download:`OMEGAS.png ` * :download:`SPIN_VECTORS.txt ` * :download:`SPIN_DIRECTIONS.html ` External magnetic field ======================= File with the spin Hamiltonian specifies interaction parameters that are intrinsic to the material. In order to add external effects, for instance an external magnetic field one can use ``--magnetic-field`` parameter. This parameter expects three numbers, that specify three Cartesian components of the external magnetic field (magnetic flux density, B). Values are interpreted in Tesla. For example, use the command .. dropdown:: :octicon:`file;1em;custom-octicon-input` Input files * :download:`ferro-easy-axis.txt <../../resources/ferro-easy-axis.txt>` .. prompt-run:: :input-prefix: ../../resources/ :output-prefix: 5 :extra-command: -of {{OP:magnopy-results}} magnopy-lswt --magnetic-field 1.7112 1.7112 0 --spinham-source GROGU --spinham-filename {{IP:ferro-easy-axis.txt}} .. dropdown:: :octicon:`command-palette;1em;custom-octicon-output` Output to the console .. literalinclude:: prompt-run_plot-2-lswt/5/console-output.txt .. dropdown:: :octicon:`file;1em;custom-octicon-output` Created files * :download:`E_0.txt ` * :download:`E_2.txt ` * :download:`DELTAS.txt ` * :download:`DELTAS.png ` * :download:`HIGH-SYMMETRY_POINTS.txt ` * :download:`K-POINTS.txt ` * :download:`K-POINTS.html ` * :download:`OMEGAS.txt ` * :download:`OMEGAS.png ` * :download:`SPIN_VECTORS.txt ` * :download:`SPIN_DIRECTIONS.html ` to add magnetic field of :math:`2.42` Tesla along the direction :math:`(1, 1, 0)` (i.e. in the :math:`xy` plane, right in between the :math:`x` and :math:`y` axis). .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.000 seconds) .. _sphx_glr_download_master-tutorial_2_black-box_plot-2-lswt.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot-2-lswt.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot-2-lswt.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot-2-lswt.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_