rad-plot-tb2j.py#
Script for visualizations of TB2J results.
Changed in version 0.6: Renamed from tb2j-plotter.py
The script displays isotropic exchange, distances and DMI (one output file for each).
Supports filtering by R vectors (see --R-vector), distances (see --max-distance, --min-distance and --distance), and template file (see --template-file). The result is defined by logical conjugate of the specified conditions.
--input-filename (or -if) argument is required, the rest of them are optional.
Output files have the following name structure: "output-name.display-data-type.png"
Usage example#
Example is based on the exchange.out file from examples folder.
There is one required argument in the script (--input-filename), therefore a minimum input for the script to run is:
rad-plot-tb2j.py -if exchange.out
which produces three pictures "exchange.iso.png", "exchange.distance.png", "exchange.distance.png". each file name has a shared default seedname ("exchange", use --output-name to change it), data type ("iso", "dmi", "distance", see --what-to-plot) and file extension ".png".
Note
In the following text only "exchange.iso.png" file is produced with the help of --what-to-plot argument.
Basic adjustments#
Since "the exchange.out" file contains a lot of exchange bonds the pictures with all of them are not really useful. Lets plot the isotropic exchange picture with some adjustments:
Filter the spin Hamiltonian by maximum distance (-md).
Draw unit cell borders (-dc)
Scale the marks of atoms (-sa)
Scale the data (-sd)
Add the title to the plot (-t)
rad-plot-tb2j.py -if exchange.out -wtp iso -maxd 5 -dc -sa 1.2 -sd 1.2 -t "First neighbour exchange" -on exchange_filtered

exchange_filtered.iso.png#
Filtering#
For filtering the spin Hamiltonian there are a few options available:
Here is an example of how to filter spin Hamiltonian in order to show first exchange neighbour, using different options: --max_distance --R-vector or --template arguments:
rad-plot-tb2j.py -if exchange.out -wtp iso -maxd 5 -dc -sa 1.2 -sd 1.2 -t "First neighbour exchange" -on exchange_filtered
rad-plot-tb2j.py -if exchange.out -wtp iso -tf template.txt -dc -sa 1.2 -sd 1.2 -t "First neighbour exchange" -on exchange_template
rad-plot-tb2j.py -if exchange.out -wtp iso -R 1 0 0 1 1 0 0 1 0 -1 0 0 -1 -1 0 0 -1 0 -dc -sa 1.2 -sd 1.2 -t "First neighbour exchange" -on exchange_R
where template file is the following:
====================
Neighbors template:
i j R_a R_b R_c
--------------------
J1 $J_1$
Ni1 Ni1 -1 0 0
Ni1 Ni1 1 0 0
Ni1 Ni1 0 1 0
Ni1 Ni1 0 -1 0
Ni1 Ni1 1 1 0
Ni1 Ni1 -1 -1 0
====================
The images should be the same:
Modifying the Hamiltonian#
By default rad-plot-tb2j.py
displays the bonds as it is in the model.
-fm argument helps
to reproduce particular spin Hamiltonian:
rad-plot-tb2j.py -if exchange.out -tf template.txt -fm -dc -sa 1.2 -sd 1.2 -t "Forced symmetry exchange" -on exchange_formed_model

exchange_formed_model.iso.png#
Only one exchange parameter is present in the template file, therefore the model is filtered with respect to the template and then the value of the exchange for each bond is set to the medium value of all bonds from the same exchange group. The direction of the DMI vectors is kept, but the magnitude of the DMI vector is scaled to the medium value.
Note
When --form-model argument is provided --template-file is required.
Arguments#
-if, --input-filename#
Relative or absolute path to the "exchange.out" file, including name and extension of the file.
required
type: str
-on, --output-name#
Seedname for the output files.
Output files have the following name structure: "output-name.display-data-type.png"
See also: example.
default: "exchange"
type: str
-wtp, --what-to-plot#
Type of data for display.
Specifying the data to be displayed in the graphs. Everything is displayed by default, each value in a separate picture. Currently available for display: Isotropic exchange parameter, distance, |DMI|.
default: "iso"
type: str
-dc, --draw-cells#
Whether to draw the cells.
If specified then the shapes of all cells presented in the model (after filtering) are drawn. (0, 0, 0) is red.
default: False
type: bool
-mind, --min-distance#
(>=) Minimum distance.
All the bonds with the distance between atom 1 and atom 2 lower than minimum distance are excluded from the model.
optional
type: float
-maxd, --max-distance#
(<=) Maximum distance.
All the bonds with the distance between atom 1 and atom 2 greater than maximum distance are excluded from the model.
optional
type: float
-d, --distance#
(=) Exact distance.
Only the bonds with the exact distance remains in the model. There is no point in specifying maximum or minimum distance when this parameter is provided.
optional
type: float
-tf, --template-file#
Relative or absolute path to the template file, including the name and extension of the file.
optional
type: str
-R, --R-vector#
R vectors for filtering the spin Hamiltonian.
In TB2J outputs the bond is defined by atom 1 (from) and atom 2 (to). Atom 1 is always located in (0, 0, 0) unit cell, while atom 2 is located in R = (i, j, k) unit cell. This parameter tells the script to keep only the bonds for which atom 2 is located in one of specified R supercells. Supercells are specified by a set of integers separated by spaces. They are grouped by three starting from the left and forms a set of R vectors. If the last group contains 1 or 2 integers they are ignored.
optional
type: list of int
-sa, --scale-atoms#
Scale for the size of atom marks.
Use it if you want to make atom marks bigger (>1) or smaller (<1). Has to be positive.
default: 1
type: float
-sd, --scale-data#
Scale for the size of data text.
Use it if you want to make data text marks bigger (>1) or smaller (<1). Has to be positive.
default: 1
type: float
-t, --title#
Title for the plots.
Title is displayed in the picture.
optional
type: str
-fm, --form-model#
Force the spin Hamiltonian to have the symmetry of the template.
default: False
type: bool
-v, --verbose#
Verbose output, propagates to the called methods.
default: False
type: bool