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

For more advance user-case the file exchange.out from examples folder is used.

The code:

rad-make-template.py -if exchange.out -on full_template.txt

produces the file with the full template:

full_template.txt
Template is created based on the file: docs/examples/rad-make-template/exchange.out
on 29 June 2023 at 14:1:58 by rad-tools 0.7.14

====================
Neighbors template:
i j R_a R_b R_c
--------------------
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 <= 8 Angstroms.

rad-make-template.py -if exchange.out -on filtered_template.txt -maxd 8
filtered_template.txt
Template is created based on the file: docs/examples/rad-make-template/exchange.out
on 29 June 2023 at 14:1:59 by rad-tools 0.7.14

====================
Neighbors template:
i j R_a R_b R_c
--------------------
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 groups are assigned correctly and regroup if necessary.

Check the Arguments section for more sorting options.

Arguments#

-on, --output-name#

Name for the template output file.

default : template.txt

See also: example.

-if, --input-filename#

Relative or absolute path to the 'exchange.out' file, including name and extension of the file.

default : None

Changed in version 0.5.12: Renamed from "tb2j_filename"

-R, --R-vector#

R vectors for filtering the exchange 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.

default : None

-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.

default : None

-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.

default : None

-d, --distance#

(=) Exact distance.

Only the bonds with the exact distance remains in the model.

default : None

Hint

There is no point in specifying maximum or minimum distance when this parameter is provided.

-v, --verbose#

Verbose output, propagates to the called methods.

default : False

--eps#

Epsilon for the distance comparison.

default 0.001