magnopy-optimize-sd#
This scenario optimizes classical energy of the spin Hamiltonian and finds a set of spin directions that describes a local minima of the energy landscape. It implements an algorithm described in [1].
Visit tutorial for magnopy-optimize-sd for examples of input and output files.
Getting help#
We recommend to get the accurate and full list of script's parameters, that reflects installed version of Magnopy with the command
magnopy-optimize-sd --help
which outputs to the standard output channel (console or terminal) Magnopy's metadata and full list of script's arguments. Here is an example of this output
Hint
Go here to learn how to read this help message.
usage: magnopy-optimize-sd [-h] -ss {GROGU,TB2J,tb2j,grogu} -sf FILENAME
[-et ENERGY_TOLERANCE] [-tt TORQUE_TOLERANCE]
[-s xA_1 xA_2 xA_3] [-mf B_X B_Y B_Z]
[-of OUTPUT_FOLDER] [-sv [S1 ...]] [-no-html]
[-hpd]
███╗ ███╗ █████╗ ██████╗ ███╗ ██╗ ██████╗ ██████╗ ██╗ ██╗
████╗ ████║ ██╔══██╗ ██╔════╝ ████╗ ██║ ██╔═══██╗ ██╔══██╗ ╚██╗ ██╔╝
██╔████╔██║ ███████║ ██║ ███╗ ██╔██╗ ██║ ██║ ██║ ██████╔╝ ╚████╔╝
██║╚██╔╝██║ ██╔══██║ ██║ ╚██║ ██║╚██╗██║ ██║ ██║ ██╔═══╝ ╚██╔╝
██║ ╚═╝ ██║ ██║ ██║ ╚██████╔╝ ██║ ╚████║ ╚██████╔╝ ██║ ██║
╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝
▄ ▄
Version: 0.5.0.dev █▀█▀█
Documentation: magnopy.org █▄█▄█
Release date: Undefined ███ ▄▄
License: GNU GPLv3 ████ █ █
Copyright (C) 2023-2026 Magnopy Team ████ █
▀▀▀▀▀▀▀▀
This script optimizes classical energy of the spin Hamiltonian and finds spin directions that describe a local minima of the energy landscape.
options:
-h, --help show this help message and exit
-ss, --spinham-source {GROGU,TB2J,tb2j,grogu}
Magnopy supports two sources of spin Hamiltonian:
GROGU or TB2J. Source of the spin Hamiltonian can not
be deduced reliably from the Hamiltonian file. Thus,
Magnopy asks you to specify what was the source of the
file that you pass to "--spinham-filename".
-sf, --spinham-filename FILENAME
Path to the file with the parameters of spin
Hamiltonian. If you use "--spinham-source TB2J", then
this is an "exchange.out" file, produced by TB2J. If
you use "--spinham-source GROGU", then this is a .txt
file with the Hamiltonian parameters produced by
GROGU.
-et, --energy-tolerance ENERGY_TOLERANCE
Tolerance parameter. Difference between classical
energies of two consecutive optimization steps.
-tt, --torque-tolerance TORQUE_TOLERANCE
Tolerance parameter. Maximum value of torque among all
spins at current optimization step.
-s, --supercell xA_1 xA_2 xA_3
Definition of the supercell for the spin optimization.
Expects three integers as an input, each integer is a
multiple of the original unit cell along one of the
three lattice vectors. By default optimizes on the
unit cell.
-mf, --magnetic-field B_X B_Y B_Z
Vector of the external magnetic field (magnetic flux
density, B), given in the units of Tesla.
-of, --output-folder OUTPUT_FOLDER
Path to the folder where all output files of Magnopy
wil be saved. Defaults to "magnopy-results". If the
folder does not exist, then Magnopy tries to create
it.
-sv, --spin-values [S1 ...]
Only works with "--spinham-source TB2J". This option
changes spin values of the magnetic atoms. It expects
M numbers in the same order as the order of magnetic
atoms in the input TB2J file. Magnetic atoms are
defined as the atoms that have at least one
interaction associated with them. Spin values are
always positive. If you want to specify spin-down
state or AFM order use spin directions and not the
spin values.
-no-html, --no-html .html files are generally heavy (~ 5 Mb). This option
allows to disable their generation to save disk space.
-hpd, --hide-personal-data
Whether not to use os.path.abspath. Hides the file
structure of your personal computer. Note, that the
relative paths can still expose the structure of you
filesystem.
Output files#
Human-readable text with the progress of calculations and compact output data is printed directly to the console. This output is meant to explain itself, thus we do not document it here.
In addition, a number of .txt and/or .html files is produced.
Visit tutorial for magnopy-optimize-sd for examples of the output text and files.
E_0.txt#
Added in version 0.4.0.
A file with the value of classical energy of the optimize state. It contains a number and unit string separated by a space symbol.
INITIAL_GUESS.txt#
Added in version 0.2.0.
A file with the spin directions of the initial guess.
Magnopy makes a new random guess for the spin directions prior to each optimization (in other words, for each execution of the script).
There are M lines in the file. M is a number of magnetic atoms in the spin Hamiltonian. Each line has three numbers on it, separated by at least one space symbol.
First number is an x component, second - y, third - z of the spin direction vector.
SPIN_DIRECTIONS.txt#
A file with the optimized spin directions.
There are M lines in the file. M is a number of magnetic atoms in the spin Hamiltonian. Each line has three numbers on it, separated by at least one space symbol.
First number is an x component, second - y, third - z of the spin direction vector.
SPIN_DIRECTIONS.html#
Added in version 0.2.0.
Requires : Installation of Plotly or magnopy[visual].
Options : Use --no-html to disable an output of this file.
An interactive .html file with 3D image of minimized spin directions and initial guess.
Data can be found in "SPIN_DIRECTIONS.txt", "INITIAL_GUESS.txt" and "SPIN_POSITIONS.txt".
SPIN_POSITIONS.txt#
Added in version 0.2.0.
A file with the absolute positions of the magnetic sites.
There are M lines in the file. M is a number of magnetic atoms in the spin Hamiltonian. Each line has three numbers on it, separated by at least one space symbol.
First number is an x coordinate, second - y, third - z.