English | 简体中文
MagneticTB constructs symmetry-constrained tight-binding Hamiltonians for magnetic space groups, nonmagnetic space groups, and spin-space groups. Given the symmetry and orbital information at the selected Wyckoff positions, it generates the symmetry-allowed Hamiltonian and provides tools for symmetry operations, band structures, and related tight-binding calculations.
This repository contains two independently usable implementations:
Mathematica/: the Wolfram Language package, magnetic symmetry data, English and Simplified Chinese documentation, and example notebooks.Python-Rust-Web/: the Rust computational core, Python API, Web interface, runtime data, and user documentation.
The two implementations do not require one another at runtime.
The current Mathematica paclet version is 2.0.10 and requires Wolfram
Language 12.1 or later.
Download MagneticTB-2.0.10.paclet from the release assets, then install it in
a Mathematica kernel using its absolute path:
PacletInstall["/absolute/path/to/MagneticTB-2.0.10.paclet"]After installation, quit and restart Mathematica. Then verify and load the package in a new kernel:
PacletFind["MagneticTB"]
Needs["MagneticTB`"]To open the installed documentation, choose Help > Wolfram Documentation
in Mathematica and search for MagneticTB. Open the MagneticTB guide from
the search results to browse the function pages, tutorials, and examples. You
can also search for a function name such as init, initfromrep, or symham
to open its reference page directly.
See the Mathematica README for updating, uninstalling, documentation, and examples.
The Python interface requires CPython 3.9 or later. Download the .whl file
matching your Python version, operating system, and CPU architecture from the
release assets. The wheel includes the compiled Rust core; users do not need
to install Rust or Cargo separately.
Using venv on macOS, Linux, or WSL:
python3 -m venv .venv
.venv/bin/python -m pip install /absolute/path/to/downloaded-wheel.whl
.venv/bin/python -c "import magnetictb; print(magnetictb.__version__)"
.venv/bin/magnetictb-webUsing venv in Windows PowerShell:
py -3 -m venv .venv
.venv\Scripts\python.exe -m pip install C:\absolute\path\to\downloaded-wheel.whl
.venv\Scripts\python.exe -c "import magnetictb; print(magnetictb.__version__)"
.venv\Scripts\magnetictb-web.exeUsing Conda is recommended. Open a Conda-enabled terminal (Anaconda Prompt or
Miniforge Prompt on Windows), create an environment, and install the wheel
with pip inside that environment:
conda create -n magnetictb --override-channels -c conda-forge python=3.12 pip
conda activate magnetictb
python -m pip install /absolute/path/to/downloaded-wheel.whl
python -c "import magnetictb; print(magnetictb.__version__)"
magnetictb-webThe current package version prints 0.1.0.
After starting magnetictb-web, open http://127.0.0.1:8000/ in a browser.
Interactive API documentation is available at http://127.0.0.1:8000/api/docs.
The service listens only on the local machine by default; press Ctrl+C to
stop it.
See the Python/Rust/Web README and the Web help center for the modeling workflow, API, exact inputs, and examples.
- Construct symmetry-constrained tight-binding Hamiltonians.
- Work with magnetic, nonmagnetic, and spin-space-group symmetry data.
- Obtain matrix representations of symmetry operations.
- Generate real-space and momentum-space Hamiltonians by bond shell.
- Manipulate and analyze band structures and related model properties.
- Use either the Mathematica interface or the Python API backed by the Rust computational core.
- Mathematica examples:
Mathematica/Examples/ - Mathematica bilingual help:
Mathematica/Documentation/ - Python/Rust Web help:
Python-Rust-Web/docs/user-guide/web/
Releases are listed from newest to oldest.
- Added the Rust computational core, Python API, and local Web interface.
- Expanded the English and Simplified Chinese documentation, tutorials, and quick-start material.
- Added real-space Hamiltonian, slab, surface Green-function, Berry geometry, Wilson-loop, crystal, Brillouin-zone, and k-path tools, Improved band visualization.
- Rewrote the core algorithms using linear algebra and group representation theory.
- Added the induced-representation mode, enabling construction of minimal tight-binding models.
- Added
initfromrep, enabling construction of a tight-binding model from site symmetry group representation input without basis-functions. - Added full support for spin-space groups (SSGs), including collinear, coplanar, and non-coplanar cases.
- Added the cyclotomic exact null-space kernel as a
KernelMethodavailable tosymham.
- Added beta support for spin-space groups.
- Added magnetic-space-group Wyckoff-position display and symmetry-operation data for magnetic layer and rod groups.
- Fixed a bug in
hop. - Added
readHRfor importingwannier90_hr.datfiles.
- Added the
CartesianCoordinatesoption tosymham. - Added
banddatafor generatingband.datfiles.
- Added a greedy algorithm for automatically finding space-group generators, significantly improving computational efficiency.
- Added an example showing how to obtain tight-binding parameters by hand.
- Added the English manual.
- Added tight-binding band co-representation calculations using the optional
SpaceGroupIrepandMSGCoreppackages. - Added
getMSGElemFromMSGCorepandgetTBBandCorep.
- Fixed a rare basis-function ordering change caused by automatic unitarization.
- Added the Chinese manual.
- Fixed monoclinic lattice-vector display.
- Added the charge-4 Weyl-point example for double magnetic space groups.
If MagneticTB is useful in your research, please cite:
Z. Zhang, Z.-M. Yu, G.-B. Liu, and Y. Yao, “MagneticTB: A package for tight-binding model of magnetic and nonmagnetic materials,” Computer Physics Communications 270, 108153 (2022).
MagneticTB is licensed under the GNU General Public License version 3 only
(GPL-3.0-only). See LICENSE.
Copyright (C) 2021-2026 Zhang Zeying.