Skip to main content

On-the-fly generator of space-group irreducible representations

Project description

spgrep

testing pre-commit.ci status License PyPI - Python Version PyPI version PyPI Downloads

spgrep is a Python package of on-the-fly generator of space-group irreducible representations.

Features

  • Calculate irreducible representations (irreps) of space groups from spglib’s cell and kpoints
  • Calculate irreps of crystallographic point groups
  • Calculate physically irreducible representations (irreps over real numbers)
  • Find symmetry-adapted basis forming given irreps
  • Minimal dependencies (numpy and spglib)

Usage

from spgrep import get_spacegroup_irreps
from spgrep.representation import get_character

# Rutile structure (https://materialsproject.org/materials/mp-2657/)
# P4_2/mnm (No. 136)
a = 4.603
c = 2.969
x_4f = 0.3046
lattice = [
    [a, 0, 0],
    [0, a, 0],
    [0, 0, c],
]
positions = [
    [0, 0, 0],  # Ti(2a)
    [0.5, 0.5, 0.5],  # Ti(2a)
    [x_4f, x_4f, 0],  # O(4f)
    [-x_4f, -x_4f, 0],  # O(4f)
    [-x_4f + 0.5, x_4f + 0.5, 0.5],  # O(4f)
    [x_4f + 0.5, -x_4f + 0.5, 0.5],  # O(4f)
]
numbers = [0, 0, 1, 1, 1, 1]

kpoint = [0.5, 0, 0]  # X point
irreps, rotations, translations, mapping_little_group = get_spacegroup_irreps(
    lattice, positions, numbers, kpoint
)

# Symmetry operations by spglib
assert len(rotations) == 16
assert len(translations) == 16

# At X point, the little co-group is isomorphic to mmm (order=8)
assert len(mapping_little_group) == 8
print(mapping_little_group)  # [ 0,  1,  4,  5,  8,  9, 12, 13]

# Two two-dimensional irreps
for irrep in irreps:
    print(get_character(irrep))
# [2.+0.j 0.+0.j 0.+0.j 2.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]
# [2.+0.j 0.+0.j 0.+0.j -2.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]

See docs/examples for more detailed use cases.

Installation

conda create -n spgrep python=3.10 pip
conda activate spgrep
git clone git@github.com:spglib/spgrep.git
cd spgrep
pip install -e .

License

spgrep is released under a BSD 3-clause license.

Development

Installation

conda create -n spgrep python=3.10 pip
conda activate spgrep
git clone git@github.com:spglib/spgrep.git
cd spgrep
pip install -e ".[dev,docs]"
pre-commit install

# Run pre-commit manually
pre-commit run --all-file 

Document

sphinx-autobuild docs docs_build
# open localhost:8000 in your browser

Release

# Confirm the version number via `setuptools-scm`
python -m setuptools_scm
# Test a release version at rc branch
git checkout rc

# Update changelog here

# Push with tag
git tag <next-version>
git push --follow-tags origin rc

# Merge to main
git checkout main
git merge rc
git push --follow-tags origin main

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spgrep-0.2.9.tar.gz (68.9 kB view details)

Uploaded Source

Built Distribution

spgrep-0.2.9-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file spgrep-0.2.9.tar.gz.

File metadata

  • Download URL: spgrep-0.2.9.tar.gz
  • Upload date:
  • Size: 68.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for spgrep-0.2.9.tar.gz
Algorithm Hash digest
SHA256 587aeba6ef86c297ad6df624088e790085f963b018750deca35f089850b3ba78
MD5 1e0d33f45e96763d6a7e4b0f07bcde82
BLAKE2b-256 e5dc5dfdb59ee6534b46fd24c97fd4c3bc84d6a1b53301edec1f55b8dd5c0806

See more details on using hashes here.

File details

Details for the file spgrep-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: spgrep-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for spgrep-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 f9aeea01d643171e4c24c392c8eea22dc7399a9af23112632901a01bc63eade1
MD5 e6628547bb4bda6056311739f8bac7a8
BLAKE2b-256 3ae280c9fc42d0d2d371285d7c554c53792aaee35f91e2f426bdf0e2809999df

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page