Skip to main content

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

Project description

Spgrep

testing pre-commit.ci status codecov License PyPI - Python Version PyPI version PyPI Downloads Lines of code DOI

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

Features

  • Enumerate the following irreducible representations (irreps) of space groups from spglib’s cell and kpoints:
    • Linear irreps
    • Physically irreps (irreps over real numbers)
    • Projective irreps for spnior
    • Projective irreducible co-representations for spinor
  • Enumerate irreps of crystallographic point groups as well
  • 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 example pages for more detailed use cases and API summary for summary of functionalities.

Installation

Spgrep works with Python3.8+ and can be installed via PyPI:

pip install spgrep

or in local:

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

Change log

See the change log for recent changes.

How to contribute

We welcome any contributions to improve functionalities. Please open issues or create pull requests. See the development page for preparing an environment.

License

Spgrep is released under a BSD 3-clause license.

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.3.5.tar.gz (107.3 kB view details)

Uploaded Source

Built Distribution

spgrep-0.3.5-py3-none-any.whl (35.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spgrep-0.3.5.tar.gz
  • Upload date:
  • Size: 107.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for spgrep-0.3.5.tar.gz
Algorithm Hash digest
SHA256 37ee964d990ed158a396194e280dcc49a2501fac325e9ed82dab60b1f7f192d7
MD5 1b6c05996fd704301af17655c69ff8cc
BLAKE2b-256 c7931d9df2effa8e4640935e62995d9e5efbbc351d37a105d6f835b675ba6a3c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spgrep-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 35.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for spgrep-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 92f16c42395a7ba18ab6e366ac5154eabeac165b8ed186751f9f32a0edaf9278
MD5 25ed4e9fca144b104894b570a4d8cc84
BLAKE2b-256 589b65b9568d361a77abdf9c5087e4d559291543f02932d3d72692bf90daceb2

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