rad-make-template.py#
Script for the creation of template`s draft.
For the full template specification see Template specification.
This script can provide blank template file or template file based on the TB2J "exchange.out" file (see --input-filename). Several filtering options are supported for the case of TB2J-based template file (--R-vector, --max-distance, --min-distance, --distance).
Important
When template file is made on the base of TB2J file it is grouped by distance. You can control the eps for distance comparison via --eps.
Usage example#
Example is based on the "exchange.out" file from the examples folder.
Minimal usage scenario creates template draft`s with the command (see template specification):
rad-make-template.py
The code:
rad-make-template.py -if exchange.out -on full_template.txt
produces the file with the full template:
full_template.txt
================================================================================
██████╗ █████╗ ██████╗ ████████╗ █████╗ █████╗ ██╗ ██████╗
██╔══██╗██╔══██╗██╔══██╗ ╚══██╔══╝██╔══██╗██╔══██╗██║ ██╔════╝
██████╔╝███████║██║ ██║█████╗ ██║ ██║ ██║██║ ██║██║ ╚═█████╗
██╔══██╗██╔══██║██║ ██║╚════╝ ██║ ██║ ██║██║ ██║██║ ╚══██║
██║ ██║██║ ██║██████╔╝ ██║ ╚█████╔╝╚█████╔╝███████╗██████╔╝
╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚════╝ ╚════╝ ╚══════╝╚═════╝
Version: 0.8.3 ▄ ▄
Documentation: rad-tools.org █▀█▀█
Release date: 14 September 2023 █▄█▄█
Git hash: 5b4dc9b04aecb7efebb9cd710c02e0ad7fb68e44 ███ ▄▄
Licence: GNU GPLv3 ████ █ █
████ █
Generated on 20 September 2023 at 2:21:38 ▀▀▀▀▀▀▀▀
Template is created based on the file:
/Users/rybakov.ad/Codes/rad-tools/docs/examples/rad-make-template/exchange.out
================================================================================
Neighbors template:
Atom1 Atom2 i j k
--------------------------------------------------------------------------------
J1 $J_{1}$
Ni1 Ni1 0 -1 0
Ni1 Ni1 0 1 0
Ni1 Ni1 1 0 0
Ni1 Ni1 -1 0 0
Ni1 Ni1 1 1 0
Ni1 Ni1 -1 -1 0
--------------------------------------------------------------------------------
J2 $J_{2}$
Ni1 Ni1 1 -1 0
Ni1 Ni1 -1 1 0
Ni1 Ni1 -1 -2 0
Ni1 Ni1 1 2 0
Ni1 Ni1 2 1 0
Ni1 Ni1 -2 -1 0
--------------------------------------------------------------------------------
J3 $J_{3}$
Ni1 Ni1 0 -2 0
Ni1 Ni1 0 2 0
Ni1 Ni1 2 0 0
Ni1 Ni1 -2 0 0
Ni1 Ni1 -2 -2 0
Ni1 Ni1 2 2 0
--------------------------------------------------------------------------------
J4 $J_{4}$
Ni1 Ni1 -1 2 0
Ni1 Ni1 1 -2 0
Ni1 Ni1 -1 -3 0
Ni1 Ni1 1 3 0
Ni1 Ni1 -2 1 0
Ni1 Ni1 2 -1 0
Ni1 Ni1 2 3 0
Ni1 Ni1 -2 -3 0
Ni1 Ni1 -3 -1 0
Ni1 Ni1 3 1 0
Ni1 Ni1 -3 -2 0
Ni1 Ni1 3 2 0
--------------------------------------------------------------------------------
J5 $J_{5}$
Ni1 Ni1 0 -3 0
Ni1 Ni1 0 3 0
--------------------------------------------------------------------------------
J6 $J_{6}$
Ni1 Ni1 -3 0 0
Ni1 Ni1 3 0 0
Ni1 Ni1 3 3 0
Ni1 Ni1 -3 -3 0
--------------------------------------------------------------------------------
J7 $J_{7}$
Ni1 Ni1 -2 2 0
Ni1 Ni1 2 -2 0
Ni1 Ni1 -2 -4 0
Ni1 Ni1 2 4 0
--------------------------------------------------------------------------------
J8 $J_{8}$
Ni1 Ni1 -4 -2 0
Ni1 Ni1 4 2 0
--------------------------------------------------------------------------------
J9 $J_{9}$
Ni1 Ni1 -1 3 0
Ni1 Ni1 1 -3 0
Ni1 Ni1 -1 -4 0
Ni1 Ni1 1 4 0
Ni1 Ni1 -3 1 0
Ni1 Ni1 3 -1 0
Ni1 Ni1 -3 -4 0
Ni1 Ni1 3 4 0
Ni1 Ni1 -4 -1 0
Ni1 Ni1 4 1 0
Ni1 Ni1 -4 -3 0
Ni1 Ni1 4 3 0
--------------------------------------------------------------------------------
J10 $J_{10}$
Ni1 Ni1 0 -4 0
Ni1 Ni1 0 4 0
--------------------------------------------------------------------------------
J11 $J_{11}$
Ni1 Ni1 -4 0 0
Ni1 Ni1 4 0 0
Ni1 Ni1 -4 -4 0
Ni1 Ni1 4 4 0
--------------------------------------------------------------------------------
J12 $J_{12}$
Ni1 Ni1 -2 3 0
Ni1 Ni1 2 -3 0
Ni1 Ni1 -2 -5 0
Ni1 Ni1 2 5 0
Ni1 Ni1 -3 2 0
Ni1 Ni1 3 -2 0
Ni1 Ni1 -3 -5 0
Ni1 Ni1 3 5 0
--------------------------------------------------------------------------------
J13 $J_{13}$
Ni1 Ni1 -5 -2 0
Ni1 Ni1 5 2 0
Ni1 Ni1 -5 -3 0
Ni1 Ni1 5 3 0
--------------------------------------------------------------------------------
J14 $J_{14}$
Ni1 Ni1 -1 4 0
Ni1 Ni1 1 -4 0
Ni1 Ni1 1 5 0
Ni1 Ni1 -1 -5 0
--------------------------------------------------------------------------------
J15 $J_{15}$
Ni1 Ni1 -4 1 0
Ni1 Ni1 4 -1 0
Ni1 Ni1 -4 -5 0
Ni1 Ni1 4 5 0
Ni1 Ni1 -5 -1 0
Ni1 Ni1 5 1 0
Ni1 Ni1 -5 -4 0
Ni1 Ni1 5 4 0
--------------------------------------------------------------------------------
J16 $J_{16}$
Ni1 Ni1 0 5 0
Ni1 Ni1 0 -5 0
--------------------------------------------------------------------------------
J17 $J_{17}$
Ni1 Ni1 -5 0 0
Ni1 Ni1 5 0 0
Ni1 Ni1 -5 -5 0
Ni1 Ni1 5 5 0
--------------------------------------------------------------------------------
J18 $J_{18}$
Ni1 Ni1 -3 3 0
Ni1 Ni1 3 -3 0
--------------------------------------------------------------------------------
J19 $J_{19}$
Ni1 Ni1 -2 4 0
Ni1 Ni1 2 -4 0
Ni1 Ni1 -4 2 0
Ni1 Ni1 4 -2 0
--------------------------------------------------------------------------------
J20 $J_{20}$
Ni1 Ni1 -1 5 0
Ni1 Ni1 1 -5 0
--------------------------------------------------------------------------------
J21 $J_{21}$
Ni1 Ni1 -5 1 0
Ni1 Ni1 5 -1 0
--------------------------------------------------------------------------------
J22 $J_{22}$
Ni1 Ni1 -3 4 0
Ni1 Ni1 3 -4 0
Ni1 Ni1 -4 3 0
Ni1 Ni1 4 -3 0
--------------------------------------------------------------------------------
J23 $J_{23}$
Ni1 Ni1 -2 5 0
Ni1 Ni1 2 -5 0
--------------------------------------------------------------------------------
J24 $J_{24}$
Ni1 Ni1 -5 2 0
Ni1 Ni1 5 -2 0
--------------------------------------------------------------------------------
J25 $J_{25}$
Ni1 Ni1 -4 4 0
Ni1 Ni1 4 -4 0
--------------------------------------------------------------------------------
J26 $J_{26}$
Ni1 Ni1 -3 5 0
Ni1 Ni1 3 -5 0
Ni1 Ni1 -5 3 0
Ni1 Ni1 5 -3 0
================================================================================
This template is very long since original TB2J file includes a lot of interaction pairs, lets filter some of them and keep only the interactions with the distance less or equal 8 Angstroms.
rad-make-template.py -if exchange.out -on filtered_template.txt -maxd 8
filtered_template.txt
================================================================================
██████╗ █████╗ ██████╗ ████████╗ █████╗ █████╗ ██╗ ██████╗
██╔══██╗██╔══██╗██╔══██╗ ╚══██╔══╝██╔══██╗██╔══██╗██║ ██╔════╝
██████╔╝███████║██║ ██║█████╗ ██║ ██║ ██║██║ ██║██║ ╚═█████╗
██╔══██╗██╔══██║██║ ██║╚════╝ ██║ ██║ ██║██║ ██║██║ ╚══██║
██║ ██║██║ ██║██████╔╝ ██║ ╚█████╔╝╚█████╔╝███████╗██████╔╝
╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚════╝ ╚════╝ ╚══════╝╚═════╝
Version: 0.8.3 ▄ ▄
Documentation: rad-tools.org █▀█▀█
Release date: 14 September 2023 █▄█▄█
Git hash: 5b4dc9b04aecb7efebb9cd710c02e0ad7fb68e44 ███ ▄▄
Licence: GNU GPLv3 ████ █ █
████ █
Generated on 20 September 2023 at 2:21:39 ▀▀▀▀▀▀▀▀
Template is created based on the file:
/Users/rybakov.ad/Codes/rad-tools/docs/examples/rad-make-template/exchange.out
================================================================================
Neighbors template:
Atom1 Atom2 i j k
--------------------------------------------------------------------------------
J1 $J_{1}$
Ni1 Ni1 0 -1 0
Ni1 Ni1 0 1 0
Ni1 Ni1 1 0 0
Ni1 Ni1 -1 0 0
Ni1 Ni1 1 1 0
Ni1 Ni1 -1 -1 0
--------------------------------------------------------------------------------
J2 $J_{2}$
Ni1 Ni1 1 -1 0
Ni1 Ni1 -1 1 0
Ni1 Ni1 -1 -2 0
Ni1 Ni1 1 2 0
Ni1 Ni1 2 1 0
Ni1 Ni1 -2 -1 0
--------------------------------------------------------------------------------
J3 $J_{3}$
Ni1 Ni1 0 -2 0
Ni1 Ni1 0 2 0
Ni1 Ni1 2 0 0
Ni1 Ni1 -2 0 0
Ni1 Ni1 -2 -2 0
Ni1 Ni1 2 2 0
================================================================================
For further usage of the template it is necessary to check if the bounds are grouped correctly and regroup if necessary. By default the bonds are grouped by distance.
Check the Arguments section for more sorting options.
Arguments#
-on, --output-name#
Name for the template output file.
See also: example.
default: "template.txt"
type: str
-if, --input-filename#
Relative or absolute path to the "exchange.out" file, including name and extension of the file.
optional
type: str
Changed in version 0.5.12: Renamed from "tb2j_filename"
-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
-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
-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 Hamiltonian.
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
-v, --verbose#
Verbose output, propagates to the called methods.
default: False
type: bool
--eps#
Epsilon for the distance comparison.
default: 1e-3
type: float