Metadata-Version: 2.1
Name: spinspg
Version: 0.1.2
Summary: Python package for detecting spin space group on top of spglib
Author-email: Kohei Shinohara <kshinohara0508@gmail.com>
License: BSD 3-Clause License
        
        Copyright (c) 2022, Kohei Shinohara
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: homepage, https://github.com/spglib/spinspg
Project-URL: repository, https://github.com/spglib/spinspg
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.8.0
Description-Content-Type: text/markdown
Provides-Extra: dev
Provides-Extra: docs
License-File: LICENSE

# spinspg
[![testing](https://github.com/spglib/spinspg/actions/workflows/testing.yml/badge.svg)](https://github.com/spglib/spinspg/actions/workflows/testing.yml)
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)


Python package for detecting spin space group on top of spglib

- Document(latest): <https://spinspg.readthedocs.io/en/latest/>
- GitHub: <https://github.com/spglib/spinspg>

## Features

- Find spin symmetry operations from spin arrangements

## Usage

```python
import numpy as np
from spinspg import get_spin_symmetry

# Antiferromagnetic rutile structure
a = 4.87
c = 3.31
x_4f = 0.695169
lattice = np.diag([a, a, c])
positions = np.array([  # Fractional coordinates
    [0, 0, 0],  # Mn(2a)
    [0.5, 0.5, 0.5],  # Mn(2a)
    [x_4f, x_4f, 0],  # F(4f)
    [-x_4f, -x_4f, 0],  # F(4f)
    [-x_4f + 0.5, x_4f + 0.5, 0.5],  # F(4f)
    [x_4f + 0.5, -x_4f + 0.5, 0.5],  # F(4f)
])
numbers = np.array([0, 0, 1, 1, 1, 1])
magmoms = np.array([  # In Cartesian coordinates
    [0, 0, 2.5],
    [0, 0, -2.5],
    [0, 0, 0],
    [0, 0, 0],
    [0, 0, 0],
    [0, 0, 0],
])

# Find spin symmetry operations
sog, rotations, translations, spin_rotations = get_spin_symmetry(lattice, positions, numbers, magmoms)

print(f"Spin-only group: {sog}")  # COLLINEAR(axis=[0. 0. 1.])

# Some operations have nontrivial spin rotations
idx = 2
print(f"Rotation ({idx})\n{rotations[idx]}")
print(f"Translation ({idx})\n{translations[idx]}")
print(f"Spin rotation ({idx})\n{spin_rotations[idx]}")  # -> diag([1, 1, -1])
```

See [API documents](docs/api/api.md) for more details.

## Installation

```shell
git clone git@github.com:spglib/spinspg.git
cd spinspg
pip install .
```

## How to cite spinspg

If you use spinspg in your research, please cite [Spglib](https://spglib.readthedocs.io/en/latest/) and the following paper:

```
@misc{spinspg,
    author = {Kohei Shinohara and Atsushi Togo and Hikaru Watanabe and Takuya Nomoto and Isao Tanaka and Ryotaro Arita},
    title = {Algorithm for spin symmetry operation search},
    year = {2023},
    eprint = {arXiv:2307.12228},
    howpublished = {\url{https://arxiv.org/abs/2307.12228}},
}
```

## Change log

See the [change log](docs/changelog.md) for recent changes.

## License

Spinspg is distributed under a BSD 3-clause license.
