Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

spglib

> 编程语言
Open source

C library for finding and handling crystal symmetries

371 stars0 likes0 views
WebsiteGitHub

About

C library for finding and handling crystal symmetries

Spglib

CI Status Documentation Status Codecov Status

License Status CMake Status Python Versions

Release Status Conda Status PyPI Status Fedora Status Homebrew Status Spack Status Vcpkg Status

PyPI Downloads Conda Downloads

C library for finding and handling crystal symmetries

  • Spglib
    • What does Spglib do?
    • Requirements
    • How to use Spglib
      • How install the python library
      • How to manually compile
    • How to run test
    • How to cite Spglib
    • Contributing
    • Documentation

What does Spglib do?

A crystal structure is given to a spglib function to obtain symmetry information. spg_get_dataset is the function that returns most fruitful space group information. This returns the result in the C-structure SpglibDataset. We don't know the length of symmetry operations to be returned, the memory spaces are allocated dynamically, which means we have to free them. by spg_free_dataset. To tolerate tiny distortion of crystal structure, it has to be specified when calling symmetry search function. The following pages show the details.

  • Crystal structure format
  • Functions
  • Spglib dataset
…

Requirements

  • C standard: As of version 2.1.0, Spglib explicitly enforces a minimum standard of C11

How to use Spglib

We currently only officially support conda and pip packaging of spglib, with plans to expand to FedoraProject in the near future. We are looking for additional contributors to package on other linux distributions. For the systems that are not yet officially supported please look at the instructions for manual compilation

The main interface for spglib is the C api, but we also officially support Fortran and Python interfaces. For a minimal example of how to use this library please check the provided examples

How install the python library

Spglib is available on PyPi, so it can be installed as:

bash
$ pip install spglib

Alternatively you can install the conda package that bundles the C and Fortran libraries

bash
$ conda install -c conda-forge spglib

This python library will default to the system installed Spglib library detected, specified via LD_LIBRARY_PATH on Linux or DYLD_LIBRARY_PATH on MacOS, otherwise defaulting to a bundled version.

For more details and how to build the python project from source, see the python documentation.

How to manually compile

The minimum configuration, build and install instructions are as follows:

bash
$ cmake . -B ./build
$ cmake --build ./build
$ cmake --install ./build

For more details on configuration options and how to link your project check the cmake documentation. A minimal example project using spglib is available at example.

How to run test

The C library tests are incorporated in the CMake projects and enabled by default. To execute these tests, run the following command with the appropriate path to the build directory

bash
$ ctest --test-dir ./build

Additionally, there are python tests that cover more use-cases. See the README in the python folder for more details

How to cite Spglib

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

  • Atsushi Togo, Kohei Shinohara and Isao Tanaka, Spglib: a software library for crystal symmetry search, Sci. Technol. Adv. Mater., Meth. 4, 2384822-2384836 (2024) (open access)
@article{spglib,
  author = {Atsushi Togo, Kohei Shinohara and Isao Tanaka},
  title = {Spglib: a software library for crystal symmetry search},
  journal = {Sci. Technol. Adv. Mater., Meth.},
  volume = {4},
  number = {1},
  pages = {2384822--2384836},
  year = {2024},
  doi = {10.1080/27660400.2024.2384822},
  url = {https://doi.org/10.1080/27660400.2024.2384822},
}

If you use functions to search for magnetic symmetry operations in spglib, please also consider citing the following work:

  • Kohei Shinohara, Atsushi Togo, and Isao Tanaka, Algorithms for magnetic symmetry operation search and identification of magnetic space group from magnetic crystal structure, Acta Cryst. A 79, 390-398 (2023) (open access)
@article{spglibv2,
  author = "Shinohara, Kohei and Togo, Atsushi and Tanaka, Isao",
  title = "{Algorithms for magnetic symmetry operation search and identification of magnetic space group from magnetic crystal structure}",
  journal = "Acta Cryst. A",
  year = "2023",
  volume = "79",
  number = "5",
  pages = "390--398",
  month = "Sep",
  doi = {10.1107/S2053273323005016},
  url = {https://doi.org/10.1107/S2053273323005016},
}

Contributing

We welcome any contribution from the core development of the library to documentation improvements. See Contributing.md for more details.

Documentation

See https://spglib.readthedocs.io/ for further documentation. See the documentation for more information on how to contribute to the documentation.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言