Skip to main content

Data structures for crystallography

Project description

Documentation Status AppVeyor Build Status PyPI Package latest release Conda-forge Version Supported Python versions Code formatting style

crystals is a library of data structure and algorithms to manipulate abstract crystals in a Pythonic way. crystals helps with reading crystallographic files (like .cif and .pdb), provides access to atomic positions, scattering utilities, and allows for symmetry determination. Although crystals can be used on its own, it was made to be integrated into larger projects (like scikit-ued).

Take a look at the documentation for more information.

Usage example

crystals is all about constructing crystals and getting information about the resulting object. Crystals can be built from a variety of sources:

Here’s a quick example of building a crystal from the internal database:

>>> from crystals import Crystal
>>>
>>> vo2 = Crystal.from_database('vo2-m1')
>>> print(vo2)         # Short string representation
< Crystal object with following unit cell:
    Atom O  @ (0.90, 0.79, 0.80)
    Atom O  @ (0.90, 0.71, 0.30)
    Atom O  @ (0.61, 0.31, 0.71)
    Atom O  @ (0.39, 0.69, 0.29)
    Atom O  @ (0.61, 0.19, 0.21)
    Atom O  @ (0.10, 0.29, 0.70)
    Atom O  @ (0.10, 0.21, 0.20)
    Atom O  @ (0.39, 0.81, 0.79)
    Atom V  @ (0.76, 0.03, 0.97)
    Atom V  @ (0.76, 0.48, 0.47)
    ... omitting 2 atoms ...
Lattice parameters:
    a=5.743Ã…, b=4.517Ã…, c=5.375Ã…
    α=90.000°, β=122.600°, γ=90.000°
Chemical composition:
    O: 66.667%
    V: 33.333%
Source:
    (...omitted...)\crystals\cifs\vo2-m1.cif >

Symmetry information is also readily available:

>>> print(vo2.symmetry())
{'international_symbol': 'P2_1/c',
 'hall_symbol': '-P 2ybc',
 'hm_symbol': 'P121/c1',
 'international_number': 14,
 'hall_number': 81,
 'international_full': 'P 1 2_1/c 1',
 'pointgroup': 'C2h'}

Installation

crystals is available on the Python Package Index:

pip install crystals

For users of the conda package manager, crystals is also available from the conda-forge channel:

conda install -c conda-forge crystals

From source

crystals can also be installed from source:

git clone https://github.com/LaurentRDC/crystals.git
cd crystals
python setup.py install

You can install the latest development version using pip as well:

python -m pip install git+git://github.com/LaurentRDC/crystals.git

To build documentation, you will need a few more packages, listed in dev-requirements.txt. For example, to build documentation from source:

git clone https://github.com/LaurentRDC/crystals.git
cd crystals
pip install -r dev-requirements.txt
python setup.py build_sphinx

Documentation

The documentation, including a user guide as well as detailed reference, is available here: https://crystals.readthedocs.io/

Development

Tests can be run with the standard library’s unittest module:

python -m unittest discover

Some optional tests might be skipped if dependencies are not installed, e.g. ASE.

Citations

As this package is a spinoff from scikit-ued, please consider citing the following publication if you find crystals useful:

Underlying algorithms provided by spglib are described in the following publication:

Structure parsing from CIF files has been tested for correctness against CIF2CELL, detailed here:

Structure parsing from PDB files has been tested for correctness against Bio.PDB, detailed here:

Atomic weights are reported in the following publication:

Aknowledgements

This package depends on the work of some amazing people. Of note are the spglib contributors.

Support / Report Issues

All support requests and issue reports should be filed on Github as an issue.

License

crystals is made available under the BSD 3-clause license. For more details, see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crystals-0.6.2.tar.gz (103.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crystals-0.6.2-py3-none-any.whl (207.5 kB view details)

Uploaded Python 3

File details

Details for the file crystals-0.6.2.tar.gz.

File metadata

  • Download URL: crystals-0.6.2.tar.gz
  • Upload date:
  • Size: 103.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for crystals-0.6.2.tar.gz
Algorithm Hash digest
SHA256 726c7ec5060863e9d0ed3dc08458c5f6ff0997ac8b75fd5473d10f27124534ef
MD5 e7c0410a2370ebd8520c3d5cd9a084b2
BLAKE2b-256 ff5417b43fce5c882d70ce3e861f4dc367a901aff9d039691e62034dfb76c269

See more details on using hashes here.

File details

Details for the file crystals-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: crystals-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 207.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for crystals-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b89c6151e94b5da515ec590ff8abaa00b5302f75f55f546a5bf8548aab1f1b1b
MD5 cf2b530be4bb886aee847dc0272961c9
BLAKE2b-256 7a5cc5e07c6e5843825859de0f781dec09b23286b5eb67e88f02caddacb606b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page