百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

spglib

> 编程语言
开源

用于查找和处理晶体对称性的 C 库

371 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

用于查找和处理晶体对称性的 C 库

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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

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