Skip to main content

Spgrep

testing codecov License PyPI - Python Version PyPI version PyPI Downloads 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.10+ and can be installed via PyPI:

pip install spgrep

or in local:

git clone git@github.com:spglib/spgrep.git
cd spgrep
pip install -e .

Change log

See the change log for recent changes.

How to cite spgrep

If you use spgrep in your research, please consider citing the following work:

@article{spgrep,
    doi = {10.21105/joss.05269},
    url = {https://doi.org/10.21105/joss.05269},
    year = {2023},
    publisher = {The Open Journal},
    volume = {8},
    number = {85},
    pages = {5269},
    author = {Shinohara, Kohei and Togo, Atsushi and Tanaka, Isao},
    title = {spgrep: On-the-fly generator of space-group irreducible representations},
    journal = {J. Open Source Softw.}
}

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.

Metadata

Release files for spgrep 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for spgrep 0.7.0
File Interpreter ABI Platform
spgrep-0.7.0-py3-none-any.whl Python 3 none any Details

Release files / spgrep-0.7.0-py3-none-any.whl

Download URL spgrep-0.7.0-py3-none-any.whl
Size 47.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36b4744715a732d0359e9f1b7b4a4c6ab8c69f56749275825cdd56fe352391ed
BLAKE2b-256 checksum
How to use checksums
02683f53655035c17bbaec319ed7151cd53aff4f56ce735af3f58cf8ecbfba43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.7.0 This release

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.11

1 release file

0.3.10

1 release file

0.3.8

1 release file

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.12

2 release files

0.2.11

2 release files

0.2.9

2 release files

0.2.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page