bsym
bsym is a basic Python symmetry module. It consists of core classes that describe configuration vector spaces, their symmetry operations, and specific configurations of objects within these spaces. The module also contains an interface for working with pymatgen Structure objects, to allow simple generation of disordered symmetry-inequivalent structures from a symmetric parent crystal structure.
Usage examples are provided in the documentation. API documentation is here. Source code is available at https://github.com/bjmorgan/bsym.
Requirements
bsym requires Python 3.10 or later.
Installation
Standard Installation
Install from PyPI:
pip install bsym
Installation from Source
Download the latest release from GitHub, and install:
cd bsym
pip install .
Or clone the latest development version:
git clone git@github.com:bjmorgan/bsym.git
cd bsym
pip install .
Development Installation
To install with development dependencies (for running tests, type checking, building docs, etc.):
git clone git@github.com:bjmorgan/bsym.git
cd bsym
pip install -e ".[dev]"
This installs bsym in editable mode with additional tools for development.
Tests
Tests use pytest. After installing with development dependencies, run:
pytest
For verbose output:
pytest -v
To run specific test files:
pytest tests/unit_tests/test_symmetry_group.py
Example Usage
Enumerating Symmetry-Inequivalent Structures
bsym can enumerate symmetry-inequivalent structures for disordered materials. Here's an example using a pymatgen Structure as input:
from bsym.interface.pymatgen import unique_structure_substitutions
unique_structures = unique_structure_substitutions(
parent_structure,
'X', # Sites to substitute
{'O': 8, 'F': 16} # 8 oxygen, 16 fluorine
)
print(f"Found {len(unique_structures)} unique structures")
Documentation
An overview of the capabilities of bsym along with example code is provided in the documentation.
Citing bsym
This code can be cited as:
Morgan, Benjamin J. (2017). bsym - a Basic Symmetry Module. The Journal of Open Source Software. http://doi.org/10.21105/joss.00370
BibTeX
@article{Morgan_JOSS2017b,
doi = {10.21105/joss.00370},
url = {https://doi.org/10.21105/joss.00370},
year = {2017},
month = {aug},
publisher = {The Open Journal},
volume = {2},
number = {16},
author = {Benjamin J. Morgan},
title = {bsym: A basic symmetry module},
journal = {The Journal of Open Source Software}
}
Release files for bsym 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bsym-2.2.0.tar.gz | 23.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bsym-2.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.8 kB
Release files / bsym-2.2.0.tar.gz
| Download URL | bsym-2.2.0.tar.gz |
|---|---|
| Size | 23.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
66b700f82c5b25da720ca15f0eb58a5a0ee8c2454c6c9f0dcb6be19f167d45e6
|
|
BLAKE2b-256 checksum How to use checksums |
7cebbd3e244dd81485fed72fb5fc69c577f77dc0d178cba35015e6c21feaadff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 21, 2026.
Transparency logRelease files / bsym-2.2.0-py3-none-any.whl
| Download URL | bsym-2.2.0-py3-none-any.whl |
|---|---|
| Size | 25.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6bf33c5bc8d92742dc9e5224c3251290185265ae08be0fef0a114c702f4c9a40
|
|
BLAKE2b-256 checksum How to use checksums |
9890128a8d51a4d38ac18011c43c2d2462ba505a2517892967cda01896bc082c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 21, 2026.
Transparency log