[![PyPI version](https://badge.fury.io/py/bsym.svg)](https://badge.fury.io/py/bsym)
[![DOI](https://zenodo.org/badge/19279643.svg)](https://zenodo.org/badge/latestdoi/19279643)
[![status](http://joss.theoj.org/papers/6696543fc631bf66feb99a9cde808a39/status.svg)](http://joss.theoj.org/papers/6696543fc631bf66feb99a9cde808a39)
[![Build Status](https://travis-ci.org/bjmorgan/bsym.svg?branch=master)](https://travis-ci.org/bjmorgan/bsym)
[![Test Coverage](https://codeclimate.com/github/bjmorgan/bsym/badges/coverage.svg)](https://codeclimate.com/github/bjmorgan/bsym/coverage)
[![Documentation Status](https://readthedocs.org/projects/bsym/badge/?version=latest)](http://bsym.readthedocs.io/en/latest/?badge=latest)


`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`](http://pymatgen.org) `Structure` objects, to allow simple generation of disordered symmetry-inequivalent structures from a symmetric parent crystal structure.

Examples are provided in a Jupyter notebook [here][example_notebook].  
API documentation is [here][API].  
Source code is available as a git repository at [https://github.com/bjmorgan/bsym][github].


## Installation

```
pip install bsym
```

Or download the latest release from [GitHub](httpsL//github.com/bjmorgan/bsym/releases), and install
```
cd bsym
python setup.py install
```

Or clone the latest development version
```
git clone git@github.com:bjmorgan/bsym.git
```
and install the same way.
```
cd bsym
python setup.py install 
```

## Tests

Automated testing of the latest commit happens [here](https://travis-ci.org/bjmorgan/bsym).

Manual tests can be run using
```
python -m unittest discover
```

The code has been tested with Python versions 3.5 and above.

## Documentation
An overview of the capabilities of `bsym` along with example code is contained in a [Jupyter notebook](http://jupyter-notebook.readthedocs.io/en/latest/#) in the repository `examples` directory [examples/bsym_examples.ipynb][example_notebook].

API documentation is available [here](http://bsym.readthedocs.io).

## I want to generate a set of symmetry-inequivalent crystal structures
`bsym` can enumerate symmetry-inequivalent crystal structures generated by partial substitutions, starting from a parent structure described by a `pymatgen` `Structure` object.  
Example code is in the [example notebook][example_notebook].  
Also refer to the [`bsym.interface.pymatgen.unique_structure_substitutions`](http://bsym.readthedocs.io/en/latest/api/interface/pymatgen.html#bsym.interface.pymatgen.unique_structure_substitutions) 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}
}
```

[example_notebook]:http://nbviewer.jupyter.org/github/bjmorgan/bsym/blob/master/examples/bsym_examples.ipynb
[github]: https://github.com/bjmorgan/bsym
[doi]: https://zenodo.org/badge/latestdoi/19279643
[API]: http://bsym.readthedocs.io/en/latest/modules.html
