### Install TB2J from source Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/install.rst Alternatively, you can download TB2J from GitHub and install it using the setup script. The --user option can be used if permission issues arise. ```bash python setup.py install ``` -------------------------------- ### Install TB2J with all optional dependencies Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/install.rst To install TB2J along with all available optional dependencies, use the 'all' extra. ```bash pip install TB2J[all] ``` -------------------------------- ### Install TB2J Package Source: https://context7.com/mailhexu/tb2j/llms.txt Install TB2J using pip, with options for specific interface dependencies or all optional dependencies. Installation from source and recommended virtual environment setup are also shown. ```bash pip install TB2J ``` ```bash pip install TB2J[siesta] ``` ```bash pip install TB2J[lawaf] ``` ```bash pip install TB2J[all] ``` ```bash git clone https://github.com/mailhexu/TB2J cd TB2J pip install . ``` ```bash python3 -m venv tb2j-env source tb2j-env/bin/activate pip install TB2J ``` -------------------------------- ### Install TB2J-OpenMX Plugin Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/openmx.rst Install the TB2J-OpenMX plugin using pip. This plugin is required for parsing OpenMX output files. ```bash pip install TB2J-OpenMX ``` -------------------------------- ### Install TB2J using pip Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/install.rst The recommended method for installing TB2J is using pip. This command will install the package and its core dependencies. ```bash pip install TB2J ``` -------------------------------- ### Example Content of exchange.out Source: https://context7.com/mailhexu/tb2j/llms.txt This is an example of the human-readable output file 'exchange.out', showing the crystal cell, atomic positions and moments, and calculated exchange interactions (J_iso, DMI, J_ani) between atom pairs. ```text # Example content of exchange.out: # ============================================================== # Cell (Angstrom): # 0.030 3.950 3.950 # 3.950 0.030 3.950 # 3.950 3.950 0.030 # # Atoms: # Atom_number x y z w_charge M(x) M(y) M(z) # Fe1 0.000 0.000 0.000 6.356 -0.026 0.000 3.793 # ... # # Exchange: # i j R J_iso(meV) vector distance(A) # Fe1 Fe1 (1, 0, 0) 17.687 (2.467, 0.000, 0.000) 2.467 # J_iso: 17.687 # DMI: (0.000 0.000 0.000) # J_ani: # [[ 0.001 -0.000 0.000] # [-0.000 0.001 0.000] # [ 0.000 0.000 -0.002]] ``` -------------------------------- ### Example Usage of TB2J_symmetrize.py Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/symmetry.md This demonstrates how to run the TB2J_symmetrize.py script, specifying input and output directories and a custom symmetry detection precision. ```bash TB2J_symmetrize.py -i TB2J_results -o TB2J_symmetrized -s 1e-4 ``` -------------------------------- ### Install TB2J with lawaf interface dependencies Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/install.rst To use the lawaf interface, install TB2J with the 'lawaf' extra dependencies. ```bash pip install TB2J[lawaf] ``` -------------------------------- ### Install Siesta and netcdf4 dependencies separately Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/install.rst If you need the sisl and netcdf4 packages for Siesta or OpenMX output, they can be installed separately using pip. ```bash pip3 install sisl netcdf4 ``` -------------------------------- ### Install TB2J with Siesta interface dependencies Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/install.rst To use the Siesta interface, install TB2J with the 'siesta' extra dependencies. This includes packages like sisl and netcdf4. ```bash pip install TB2J[siesta] ``` -------------------------------- ### Quantization Axes File Example Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/magnon_bands.md Each row in the file represents the quantization axis direction for a spin. The row must contain exactly three components (x, y, z) and the number of rows must match the number of magnetic atoms. ```text 0.0 0.0 1.0 # atom 1: spin up 0.0 0.0 -1.0 # atom 2: spin down 1.0 0.0 0.0 # atom 3: spin along x 0.0 1.0 0.0 # atom 4: spin along y ``` -------------------------------- ### Interface TB2J with sisl Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/extend.rst This example shows how to read a Hamiltonian using sisl, wrap it in a SislWrapper, and pass it to the ExchangeNCL class for TB2J calculations. Ensure all necessary parameters like atoms, magnetic_elements, and kmesh are provided. ```python # read hamiltonian using sisl fdf = sisl.get_sile(fdf_fname) H = fdf.read_hamiltonian() # wrap the hamiltonian to SislWrapper tbmodel = SislWrapper(H, spin=None) # pass to ExchangeNCL exchange = ExchangeNCL( tbmodels=tbmodel, atoms=atoms, efermi=0.0, magnetic_elements=magnetic_elements, kmesh=kmesh, emin=emin, emax=emax, nz=nz, exclude_orbs=exclude_orbs, Rcut=Rcut, ne=ne, description=description) exchange.run() ``` -------------------------------- ### TB2J Information Section Example Source: https://github.com/mailhexu/tb2j/blob/main/skill/TB2J/references/outputs.md This section of the exchange.out file contains metadata about the TB2J calculation, such as the input data source and version. ```text ========================================================================================== Information: Input from collinear LaWaF data. Tight binding data from ./ . ... ``` -------------------------------- ### Plot Magnon Density of States with TB2J_magnon_dos.py Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/magnon_band.rst Example usage of TB2J_magnon_dos.py to plot the magnon density of states, specifying to show the plot, a smearing width, k-mesh dimensions, and the output figure name. ```bash TB2J_magnon_dos.py --show -s 10 -k 25 25 25 -f magnon_dos.png --show ``` -------------------------------- ### Install and use AiiDA TB2J plugin Source: https://context7.com/mailhexu/tb2j/llms.txt Install the AiiDA TB2J plugin to integrate Siesta+TB2J calculations within AiiDA's provenance framework. Submit a Siesta→TB2J calculation via AiiDA WorkChain. ```python # Install AiiDA TB2J plugin: # pip install aiida-tb2j (or from https://github.com/antelmor/aiida_tb2j_plugin) # The plugin wraps Siesta+TB2J calculations within AiiDA provenance framework. # Example: submit a Siesta→TB2J calculation via AiiDA WorkChain from aiida.plugins import WorkflowFactory from aiida.engine import submit TB2JWorkChain = WorkflowFactory('siesta.tb2j') builder = TB2JWorkChain.get_builder() builder.structure = structure_node builder.parameters = Dict(dict={ 'elements': ['Fe'], 'kmesh': [7, 7, 7], 'emin': -12.0, }) node = submit(builder) print(f"Submitted WorkChain pk={node.pk}") # Outputs available after completion: # node.outputs.exchange_parameters – TB2J results as AiiDA data node # node.outputs.magnon_bands – band structure data ``` -------------------------------- ### Plot Magnon Band Structure with TB2J_magnon.py Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/magnon_band.rst Example usage of TB2J_magnon.py to plot magnon band structure for BCC Fe, specifying the q-point path, output figure name, and to display the plot. ```bash TB2J_magnon.py --qpath GNPGHN --figfname magnon.png --show ``` -------------------------------- ### TB2J Exchange Parameters Section Example Source: https://github.com/mailhexu/tb2j/blob/main/skill/TB2J/references/outputs.md Details the calculated magnetic interaction parameters between atomic pairs, including isotropic exchange coupling (J_iso), vector, and distance. It also shows examples of DMI and anisotropic exchange for non-collinear calculations. ```text ========================================================================================== Exchange: i j R J_iso(meV) vector distance(A) ---------------------------------------------------------------------------------------- Fe1 Fe2 ( 0, 0, 0) 10.5000 ( 2.500, 2.500, 2.500) 4.330 J_iso: 10.5000 [Testing!] DMI: ( 0.1000 -0.2000 0.0000) [Testing!]J_ani: [[ 0.1 0.0 0.0] [ 0.0 0.2 0.0] [ 0.0 0.0 -0.3]] ``` -------------------------------- ### TB2J Atoms Section Example Source: https://github.com/mailhexu/tb2j/blob/main/skill/TB2J/references/outputs.md Lists each atom in the unit cell, including its coordinates, charge, and magnetic moment derived from Wannier functions. ```text ========================================================================================== Atoms: (Note: charge and magmoms only count the wannier functions.) Atom number x y z w_charge w_magmom Fe1 0.00000000 0.00000000 0.00000000 8.0000 2.2000 ... Total 16.0000 4.4000 ``` -------------------------------- ### Orbital Contributions for Fe (Siesta) Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/orbital_contribution.md Example output showing the decomposition of exchange interaction into orbital contributions for bcc Fe, considering only 3d orbitals. This format is used with Siesta inputs where orbital names are known and can be explicitly listed. ```text ========================================================================================== Orbitals used in decomposition: The name of the orbitals for the decomposition: Fe1 : ('3dxy', '3dyz', '3dz2', '3dxz', '3dx2-y2') ========================================================================================== Exchange: i j R J_iso(meV) vector distance(A) ---------------------------------------------------------------------------------------- Fe1 Fe1 ( -1, 0, 0) 17.6873 (-2.467, 0.000, 0.000) 2.467 J_iso: 17.6873 Orbital contributions: [[11.462 -0. 0.297 -0. 0.096] [-0. 3.69 -0. -0.214 -0. ] [-0.163 -0. 3.215 -0. -3.262] [-0. 0.396 -0. 11.451 -0. ] [-0.055 0. -3.263 0. -4.248]] ``` -------------------------------- ### TB2J CLI Help and Options Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/magnon_bands.md Displays the available command-line options for the `TB2J_plot_magnon_bands.py` script, detailing parameters for configuration, k-paths, interactions, and magnetic structures. ```bash TB2J_plot_magnon_bands.py --help ``` ```bash --config CONFIG Path to TOML configuration file --save-config FILE Save default configuration to specified TOML file --path PATH Path to TB2J results directory (default: TB2J_results) --kpath KPATH k-path specification (default: GXMR) --npoints NPOINTS Number of k-points along the path (default: 300) --output OUTPUT Output file name (default: magnon_bands.png) --Jiso Include isotropic exchange interactions (default: True) --no-Jiso Exclude isotropic exchange interactions --Jani Include anisotropic exchange interactions (default: False) --DMI Include Dzyaloshinskii-Moriya interactions (default: False) --Q Qx Qy Qz Propagation vector [Qx, Qy, Qz] (default: [0, 0, 0]) --uz-file FILE Path to file containing quantization axes for each spin --n nx ny nz Normal vector for rotation [nx, ny, nz] (default: [0, 0, 1]) ``` -------------------------------- ### Configuration File Support in CLI Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/magnon_bands.md Shows how to manage plotting configurations using TOML files with the command-line interface. Includes saving a default configuration and using an existing one. ```bash # Save default configuration TB2J_plot_magnon_bands.py --save-config config.toml # Use configuration file TB2J_plot_magnon_bands.py --config config.toml ``` -------------------------------- ### Configure Abinit for Wannier90 Integration Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/wannier.rst Add these lines to the Abinit input file to enable Wannier90 integration, specify projection usage, and control WF visualization. ```bash prtwant 2 # enable wannier90 w90iniprj 2 # use projection to orbitals instead of random. w90prtunk 0 # use 1 if you want to visualize the WF's later. ``` -------------------------------- ### Install Python Dependencies for TB2J Source: https://github.com/mailhexu/tb2j/blob/main/tests/README.md Installs necessary Python dependencies, including the TB2J package itself and pytest, from the repository root. Ensure the test data submodule is initialized before running tests that require it. ```bash python -m pip install --upgrade pip python -m pip install -r requirements.txt python -m pip install . python -m pip install pytest ``` -------------------------------- ### Display Help for TB2J_magnon.py Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/magnon_band.rst Use this command to view the available options and arguments for the TB2J_magnon.py script. ```bash TB2J_magnon.py --help ``` -------------------------------- ### Display abacus2J.py Help Message Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/abacus.md Use the --help flag to view all available parameters and their descriptions for the abacus2J.py script. This is useful for understanding the script's capabilities and options. ```bash abacus2J.py --help ``` -------------------------------- ### Plotting Magnon Bands with TB2J CLI Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/magnon_bands.md Demonstrates the basic command-line usage for plotting magnon band structures. It shows how to specify the k-path and output file, and how to include different exchange interactions. ```bash # Original plotting command TB2J_plot_magnon_bands.py --kpath GXMR --output bands.png # This creates: # - bands.png: the band structure plot # - bands.json: the band structure data # - plot_magnon_bands.py: a script to replot the data # Replot the data with the provided script ./plot_magnon_bands.py bands.json -o new_plot.png ``` ```bash # Default settings TB2J_plot_magnon_bands.py # Specify k-path and output file TB2J_plot_magnon_bands.py --kpath GXMR --output bands.png # Include different interactions TB2J_plot_magnon_bands.py --Jani --DMI ``` -------------------------------- ### Display Help for TB2J_magnon_dos.py Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/magnon_band.rst Use this command to view the available options and arguments for the TB2J_magnon_dos.py script. ```bash TB2J_magnon_dos.py --help ``` -------------------------------- ### TB2J Cell Section Example Source: https://github.com/mailhexu/tb2j/blob/main/skill/TB2J/references/outputs.md Displays the crystal lattice vectors in Angstroms for the unit cell. ```text ========================================================================================== Cell (Angstrom): 7.00000000 0.00000000 0.00000000 0.00000000 7.00000000 0.00000000 0.00000000 0.00000000 7.00000000 ``` -------------------------------- ### Configuration File Support in Python Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/magnon_bands.md Demonstrates how to save and load plotting parameters using TOML configuration files within the Python interface. ```python # Save parameters to TOML file params = MagnonParameters( kpath="GXMR", Q=[0.5, 0.0, 0.0], uz_file="spins.txt" ) params.to_toml("config.toml") # Load parameters from TOML file params = MagnonParameters.from_toml("config.toml") plot_magnon_bands_from_TB2J(params) ``` -------------------------------- ### TB2J_merge.py Usage Example Source: https://github.com/mailhexu/tb2j/blob/main/skill/TB2J/references/commands.md Demonstrates the command-line usage for merging results from rotated calculations. The last argument specifies the reference (unrotated) structure's result directory. ```bash TB2J_merge.py ... ``` -------------------------------- ### Configure MULTIBINIT Input for Spin Dynamics Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/multibinit.rst Set parameters for spin dynamics simulations in MULTIBINIT. This input file configures supercell size, simulation steps, temperature range, and magnetic field. ```fortran prt_model = 0 #-------------------------------------------------------------- #Monte carlo / molecular dynamics #-------------------------------------------------------------- dynamics = 0 ! disable molecular dynamics ncell = 28 28 28 ! size of supercell. #------------------------------------------------------------- #Spin dynamics #------------------------------------------------------------ spin_dynamics=1 ! enable spin dynamics spin_mag_field= 0.0 0.0 0.0 ! external magnetic field spin_ntime_pre = 10000 ! warming up steps. spin_ntime =10000 ! number of steps. spin_nctime=100 ! number of time steps between two nc file write spin_dt=1e-15 s ! time step. spin_init_state = 1 ! FM initial state. May cause some trouble spin_temperature=0.0 spin_var_temperature=1 ! switch on variable temperature calculation spin_temperature_start=0 ! starting point of temperature spin_temperature_end=1300 ! ending point of temperature. spin_temperature_nstep= 52 ! number of temperature steps. spin_sia_add = 1 ! add a single ion anistropy (SIA) term? spin_sia_k1amp = 1e-6 ! amplitude of SIA (in Ha), how large should be used? spin_sia_k1dir = 0.0 0.0 1.0 ! direction of SIA spin_calc_thermo_obs = 1 ! calculate thermodynamics related observables ``` -------------------------------- ### Run Abinit to Generate Wannier Function Files Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/wannier.rst Execute the Abinit calculation to generate Wannier function related files. This command redirects standard output and error streams. ```bash abinit < abinit.files > log 2> err ``` -------------------------------- ### Edit TB2J Results (Python API) Source: https://context7.com/mailhexu/tb2j/llms.txt Python API for modifying TB2J results, including loading, setting anisotropy, toggling interactions, removing sublattices, and symmetrizing. Use 'load' to get the spinio object. ```python from TB2J.io_exchange.edit import ( load, save, set_anisotropy, set_sia_tensor, remove_sia_tensor, toggle_DMI, toggle_Jani, toggle_exchange, remove_sublattice, symmetrize_exchange, ) import numpy as np # Load serialized TB2J results spinio = load('TB2J_results/TB2J.pickle') ``` ```python # Set uniaxial single-ion anisotropy (K1 in eV) set_anisotropy(spinio, species='Sm', k1=0.005, k1dir=[0, 0, 1]) ``` ```python # Set full 3×3 SIA tensor (eV) tensor = np.diag([0.001, 0.002, 0.003]) set_sia_tensor(spinio, species='Sm', tensor=tensor) ``` ```python # Remove SIA remove_sia_tensor(spinio, species='Sm') ``` ```python # Toggle interactions toggle_DMI(spinio, enabled=False) toggle_Jani(spinio, enabled=True) toggle_exchange(spinio, enabled=True) ``` ```python # Remove all interactions involving a sublattice remove_sublattice(spinio, sublattice_name='Sm') ``` -------------------------------- ### TB2J_eigen.py Help Output Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/eigen.rst This output details the arguments and options for the TB2J_eigen.py script, including path, qmesh, gamma centering, and output filename. ```text TB2J version 0.7.1.1 Copyright (C) 2018-2020 TB2J group. This software is distributed with the 2-Clause BSD License, without any warranty. For more details, see the LICENSE file delivered with this software. usage: TB2J_eigen.py [-h] [--path PATH] [--qmesh [QMESH ...]] [--gamma] [--output_fname OUTPUT_FNAME] TB2J_eigen.py: Write the eigen values and eigen vectors to file. optional arguments: -h, --help show this help message and exit --path PATH The path of the TB2J_results file --qmesh [QMESH ...] qmesh in the format of kx ky kz. Monkhorst pack or Gamma-centered. --gamma whether shift the qpoint grid to Gamma-centered. Default: False --output_fname OUTPUT_FNAME The file name of the output. Default: eigenJq.txt ``` -------------------------------- ### Orbital Contributions for SrMnO3 (Wannier90) Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/orbital_contribution.md Example output showing the decomposition of exchange interaction into orbital contributions for cubic SrMnO3, using Wannier90 orbitals named 'orb_1', 'orb_2', etc. This format is used when orbital names are not explicitly known from the input. ```text ======================================================================================= Orbitals used in decomposition: The name of the orbitals for the decomposition: Mn1 : ['orb_1', 'orb_2', 'orb_3', 'orb_4', 'orb_5'] ======================================================================================= Exchange: i j R J_iso(meV) vector distance(A) ---------------------------------------------------------------------------------------- Mn1 Mn1 ( 0, 0, 1) -7.1027 ( 0.000, 0.000, 3.810) 3.810 J_iso: -7.1027 Orbital contributions: [[ 3.184 -0. -0. 0. -0. ] [-0. -5.06 0. -0. 0. ] [-0. 0. -5.06 -0. 0. ] [ 0. -0. -0. -0.121 -0. ] [-0. 0. 0. 0. -0.047]] ``` -------------------------------- ### Advanced Python Usage with Magnetic Structure Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/magnon_bands.md Illustrates how to set up and plot magnon bands for non-collinear magnetic structures using custom quantization axes files. ```python import numpy as np # Create quantization axes file for non-collinear magnetism nspin = 4 # number of magnetic atoms uz = np.array([ [0.0, 0.0, 1.0], # atom 1: spin up [0.0, 0.0, -1.0], # atom 2: spin down [1.0, 0.0, 0.0], # atom 3: spin along x [-1.0, 0.0, 0.0], # atom 4: spin along -x ]) np.savetxt("spins.txt", uz) # Plot bands with custom magnetic configuration params = MagnonParameters( kpath="GXMR", Q=[0.5, 0.0, 0.0], # Propagation vector uz_file="spins.txt", # Quantization axes for each spin n=[0.0, 0.0, 1.0] # Normal vector for rotation ) plot_magnon_bands_from_TB2J(params) ``` -------------------------------- ### Run openmx2J.py Script Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/openmx.rst Execute the openmx2J.py script to convert OpenMX output files to TB2J format. Ensure the 'HS.fileout on' option is enabled in your OpenMX input for Hamiltonian and overlap matrices. Specify the calculation prefix, magnetic elements, and k-mesh. ```bash openmx2J.py -- prefix openmx --elements Fe --kmesh 7 7 7 ``` -------------------------------- ### Initialize MAEGreen with predefined angle sets Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/mae.md The `MAEGreen` class allows for MAE calculations using predefined angle sets for magnetization directions, such as 'xyz', 'fib' (Fibonacci sphere), 'miller' (Miller indices), or 'scan' (full angular scan). This simplifies the setup for common anisotropy studies. ```python from TB2J.MAEGreen import MAEGreen # Use predefined angle sets mae = MAEGreen( tbmodels=model, atoms=model.atoms, kmesh=[6,6,1], angles="xyz", # x, y, z axes # angles="fib", # Fibonacci sphere sampling # angles="miller", # Miller index directions # angles="scan", # Full angular scan ) ``` -------------------------------- ### Calculate Exchange Parameters with Siesta Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/siesta.rst Run the siesta2J.py script to calculate exchange parameters using Siesta output files. Specify the input file, elements, and k-mesh density. ```bash siesta2J.py --fdf_fname siesta.fdf --elements Fe --kmesh 7 7 7 ``` -------------------------------- ### Step One: Collinear Spin Calculation for MAE Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/mae.md Configure ABACUS for the first step of MAE calculation. Enable SOC with `lspinorb=1` but set `soc_lambda=0.0` to turn off SOC strength, ensuring the Hamiltonian is saved in spinor form. Use `nspin=4` for this purpose. ```text INPUT_PARAMETERS # SCF calculation with SOC turned on, but soc_lambda=0. calculation scf nspin 4 symmetry 0 noncolin 1 lspinorb 1 ecutwfc 100 scf_thr 1e-06 init_chg atomic out_mul 1 out_chg 1 out_dos 0 out_band 0 out_wfc_lcao 1 out_mat_hs2 1 ks_solver scalapack_gvx scf_nmax 500 out_bandgap 0 basis_type lcao gamma_only 0 smearing_method gaussian smearing_sigma 0.01 mixing_type broyden mixing_beta 0.5 soc_lambda 0.0 ntype 1 dft_functional PBE ``` -------------------------------- ### Basic Magnon Plot with Interactive Window Source: https://github.com/mailhexu/tb2j/blob/main/skill/TB2J/references/outputs.md Use this command to generate a basic plot of magnon frequencies and display it interactively. Ensure you have a display environment available. ```bash # Basic plot, showing the window TB2J_magnon.py --fname TB2J_results/exchange.xml --show ``` -------------------------------- ### Initialize MAEGreen with custom angle arrays Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/mae.md For custom angular explorations, you can provide your own theta and phi arrays to the `MAEGreen` class. This offers flexibility in defining the specific magnetization directions to be analyzed. ```python from TB2J.MAEGreen import MAEGreen # Custom angle arrays mae = MAEGreen( tbmodels=model, atoms=model.atoms, kmesh=[6,6,1], angles=[thetas, phis], # Custom theta, phi arrays ) ``` -------------------------------- ### Initialize Existing Git Submodules in CI/CD Source: https://github.com/mailhexu/tb2j/blob/main/tests/README.md This script initializes existing submodules, particularly useful in CI/CD environments or after cloning a repository. It checks for .gitmodules and runs `git submodule update --init --recursive`. ```bash ./tests/init_test_data.sh ``` -------------------------------- ### Run TB2J with Wannier90 Output Source: https://github.com/mailhexu/tb2j/blob/main/skill/TB2J/references/workflows.md Execute the `wann2J.py` script using output files from a Wannier90 calculation. Specify the structure file, Fermi energy, k-mesh, elements, and prefixes for spin-up/down Wannier Hamiltonians. ```bash wann2J.py --posfile structure.vasp --efermi --kmesh 5 5 5 --elements Mn --prefix_up wan_up --prefix_down wan_down ``` -------------------------------- ### Run MULTIBINIT Spin Dynamics Simulation Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/multibinit.rst Execute the MULTIBINIT code with the specified input files to perform spin dynamics calculations. This command uses MPI for parallel execution. ```bash mpirun -np 4 multibinit --F03 < mb.files ``` -------------------------------- ### Basic Python Usage for Magnon Band Plotting Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/magnon_bands.md Shows how to use the Python interface to plot magnon band structures. It covers using default parameters and customizing them for specific needs. ```python from TB2J.magnon.magnon3 import MagnonParameters, plot_magnon_bands_from_TB2J # Using default parameters params = MagnonParameters() plot_magnon_bands_from_TB2J(params) # Or customize parameters params = MagnonParameters( path="TB2J_results", kpath="GXMR", npoints=300, filename="magnon_bands.png", Jiso=True, Jani=False, DMI=False, ) plot_magnon_bands_from_TB2J(params) ``` -------------------------------- ### Run TB2J Calculation Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/wannier.rst Use this command to calculate exchange parameters. Ensure the `posfile` points to your atomic structure file and specify Fermi energy, k-mesh, magnetic elements, and prefixes for Wannier90 output. ```bash wann2J.py --posfile abinit.in --efermi 6.15 --kmesh 4 4 4 --elements Mn --prefix_up abinito_w90_up --prefix_down abinito_w90_down --emin -10.0 --emax 0.0 ``` -------------------------------- ### Step Two: Non-SCF Non-Collinear Spin Calculation for MAE Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/mae.md Configure ABACUS for the second step of MAE calculation. Read density from the previous step by setting `init_chg='file'`. Limit SCF steps to one (`scf_nmax=1`), use a large `scf_thr`, a small `mixing_beta`, and enable SOC by setting `soc_lambda=1.0`. Save the Hamiltonian by setting `out_mat_hs2=1`. ```text INPUT_PARAMETERS ``` -------------------------------- ### Generate Spin Down Wannier90 Files (Wannier90 < 3.0) Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/wannier.rst If using Wannier90 version less than 3.0, a bug may prevent automatic generation of spin-down files. Use this command to manually generate them. ```bash wannier90.x abinito_w90_down ``` -------------------------------- ### Perform Downfolding with TB2J_downfold.py Source: https://github.com/mailhexu/tb2j/blob/main/docs/src/downfold.md Execute `TB2J_downfold.py` to obtain the effective exchange parameters for transitional metals only. Specify input and output paths, and identify metal and ligand elements. ```bash TB2J_downfold.py --inpath TB2J_results --outpath TB2J_results_downfold --metals Cr --ligands I ``` -------------------------------- ### Calculate Exchange Parameters with siesta2J.py (SIESTA) Source: https://context7.com/mailhexu/tb2j/llms.txt Use siesta2J.py to compute exchange parameters from SIESTA output. Requires SIESTA to save the Hamiltonian (SaveHS True) and optionally uses netcdf format. Supports collinear and non-collinear calculations, orbital-specific decomposition, and experimental MAE splitting. ```bash siesta2J.py \ --fdf_fname siesta.fdf \ --elements Fe \ --kmesh 7 7 7 \ --emin -12.0 \ --np 4 ``` ```bash siesta2J.py \ --fdf_fname siesta.fdf \ --elements Fe \ --kmesh 7 7 7 \ --emin -12.0 ``` ```bash siesta2J.py \ --fdf_fname siesta.fdf \ --elements Fe_3d \ --kmesh 7 7 7 ``` ```bash siesta2J.py \ --fdf_fname siesta.fdf \ --elements Fe_3d_4s \ --kmesh 7 7 7 ``` ```bash siesta2J.py \ --fdf_fname siesta.fdf \ --elements Fe \ --kmesh 9 9 9 \ --split_soc ``` ```bash siesta2J.py \ --fdf_fname siesta.fdf \ --elements Mn O \ --kmesh 5 5 5 \ --rcut 8.0 \ --use_cache \ --output_path TB2J_BiFeO3 ```