Metadata-Version: 2.4
Name: pyamtb
Version: 0.1.4
Summary: A tight-binding model package for altermagnets
Home-page: https://github.com/ooteki-teo/pyamtb
Author: Yu Xie
Author-email: Wang Dinghui <wangdh@cumt.edu.cn>, Junting Zhang <zhangjt@cumt.edu.cn>
License: MIT License
        
        Copyright (c) 2024 Wang Dinghui
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE. 
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: matplotlib
Requires-Dist: pythtb
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# PyAMTB

A Python package for tight-binding model calculations for altermagnets.

## Introduction

PyAMTB (Python Altermagnet Tight Binding) is built on top of the PythTB package, providing specialized tight-binding model calculations for altermagnets. It extends PythTB's capabilities by adding direct support for POSCAR structure files and altermagnet-specific features.

## Features

- Tight-binding model calculations for altermagnets
- Support for various lattice structures
- Band structure calculations
- Easy configuration through TOML files
- Command-line interface for quick calculations

## Installation

### From PyPI

```bash
pip install pyamtb
```

### From source

```bash
git clone https://github.com/ooteki-teo/pyamtb.git
cd pyamtb
pip install -e .
```

## Usage

### Command Line Interface

The package provides a command-line interface for easy calculations:

```bash
# Show help and available commands
pyamtb --help

# Calculate distances between atoms
pyamtb distance --poscar POSCAR --element1 Mn --element2 N

# create a template.toml file
pyamtb template 

# Calculate band structure using configuration file
pyamtb calculate --config config.toml --poscar POSCAR

```

### Configuration

The package uses TOML files for configuration. Here's an example configuration file (`config.toml`):

```toml
# Basic parameters
dimk = 3                    # Dimension of k-space (1, 2, or 3)
dimr = 3                    # Dimension of real space
nspin = 2                   # Number of spin components (1 or 2)
a0 = 1.0                    # Lattice constant scaling factor

# Band structure calculation
k_path = ["G", "X", "M", "G"]  # k-point path
num_k_points = 100             # Number of k-points
k_labels = ["Γ", "X", "M", "Γ"]  # k-point labels

# Hopping parameters
t0 = 1.0                      # Reference hopping strength
t0_distance = 2.0             # Reference distance
hopping_decay = 1.0                 # Decay parameter
max_neighbors = 2             # Maximum number of neighbors to consider
max_distance = 10.0           # Maximum hopping distance
min_distance = 0.1                 # Minimum hopping distance

# Onsite energy and magnetism
onsite_energy = [0.0, 0.0]    # Onsite energy for each atom
magnetic_moment = 1.0         # Magnetic moment
magnetic_order = "++--"       # Magnetic order pattern

# Output settings
output_filename = "band_structure"
output_format = "png"
savedir = "."

# Debug options
is_print_tb_model = false
is_print_tb_model_hop = false
is_check_flat_bands = true
is_black_degenerate_bands = true
energy_threshold = 0.00001   # used in flat band checking.
```

### Python API

You can also use the package in your Python code:

```python
from pyamtb import Parameters, calculate_band_structure, create_pythtb_model

# Load parameters from TOML file
params = Parameters("config.toml")

# Create pythtb tight-binding model
model = create_pythtb_model("POSCAR", params)  # this is pythtb tb_model, you may use it for furthur study.

# Calculate band structure
calculate_band_structure(model, params)
```

## Development

### Running Tests

```bash
pip install -e ".[dev]"
pytest
```

### Contributing

1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Citation

If you use this package in your research, please cite:

```bibtex
@software{pyamtb,
  author = {Dinghui Wang, Junting Zhang, Yu Xie},
  title = {PyAMTB: A Python package for tight-binding model calculations},
  year = {2025},
  url = {https://github.com/ooteki-teo/pyamtb.git}
}
``` 
