crystal-torture
crystal-torture: A crystal tortuosity module - Published in JOSS (2019)
Science Score: 100.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 5 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org, zenodo.org -
✓Committers with academic emails
1 of 3 committers (33.3%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Scientific Fields
Repository
crystal_torture: A crystal structure analysis code, allowing site tortuosity to be calculated.
Basic Info
Statistics
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
- Releases: 3
Metadata Files
README.md
crystal_torture:
crystal_torture is a Python, Fortran and OpenMP crystal structure analysis module. The module contains a set of classes that enable:
- a crystal structure to be converted into a graph for network analysis.
- connected clusters of crystal sites (nodes) to be retrieved and output.
- periodicity of connected clusters of crystal sites to be determined.
- relative path tortuosity to traverse a crystal within a connected cluster to be calculated for each site.
Ionic diffusion through crystalline solids depends not only on the dynamics of ions within the crystal, but also the connectivity of the transport network. Understanding how the connectivity of diffusion pathways in crystal structures is affected by changes in chemistry is necessary for understanding how chemical modifications change ionic conductivities, for example the doping of solid electrolytes.
crystal-torture provides a Python API for interrogating network connectivity and diffusion pathways in partially blocked crystal structures. It can be used as a tool for materials scientists to quickly build up network connectivity statistics in order to determine the viability of potential ionic conductors, and how chemical modification affects network connectivity, before the use of more computationally expensive approaches modelling the full dynamics.
Features
- Fast Performance: Fortran extensions with OpenMP parallelisation for computationally intensive operations
- Fallback Support: Pure Python implementations available when Fortran extensions unavailable
- Modern Build System: Uses meson-python for reliable cross-platform builds
- Comprehensive Testing: Extensive test suite covering both Fortran and Python code paths
- Type Hints: Modern Python with type annotations for better development experience
Installation
crystal_torture requires Python 3.10 or above.
From PyPI (Recommended)
For most users, installation from PyPI will provide pre-compiled packages:
bash
pip install crystal-torture
From Source
Building from source enables Fortran extensions for optimal performance. This requires a Fortran compiler and build tools:
System Dependencies
Ubuntu/Debian:
bash
sudo apt-get update
sudo apt-get install gfortran build-essential
macOS (with Homebrew):
bash
brew install gfortran
Windows: Install a Fortran compiler such as MinGW-w64 or use Windows Subsystem for Linux.
Installation
bash
git clone https://github.com/connorourke/crystal_torture
cd crystal_torture
pip install . --use-pep517
Development Installation
bash
git clone https://github.com/connorourke/crystal_torture
cd crystal_torture
pip install ."[dev]" --use-pep517
Fortran Extensions
Performance Note: The Fortran extensions provide significant performance improvements for large systems. If Fortran compilation fails, some functions will fall back to Python implementations, while others (like torture_fort()) will require using the Python equivalent (torture_py()).
To verify Fortran extensions loaded successfully:
python
from crystal_torture import tort, dist
print(f"Fortran tort available: {tort.tort_mod is not None}")
print(f"Fortran dist available: {dist._DIST_AVAILABLE}")
Quick Start
```python from crystaltorture.pymatgeninterface import graphfromfile
Load structure and create graph
graph = graphfromfile("my_structure.cif", rcut=4.0, elements={"Li"})
Analyse tortuosity (uses Fortran if available)
graph.torture() # or graph.torture_py() for pure Python
Get results
percolatingfraction = graph.returnfracpercolating() for cluster in graph.minimalclusters: print(f"Cluster size: {cluster.size}, Tortuosity: {cluster.tortuosity}") ```
Tests
crystal_torture is automatically tested on each commit via GitHub Actions across Python 3.10-3.13, but tests can be run manually:
```bash
Run all tests
pytest
Run with coverage
pytest --cov=crystal_torture
Run specific test file
pytest tests/test_node.py -v ```
Examples
Examples on how to use crystal_torture can be found in a Jupyter notebook in the examples directory crystaltortureexamples.ipynb
Documentation
Documentation can be found here
Dependencies
Runtime Dependencies
numpy>=1.19.0pymatgen>=2022.0.0
Build Dependencies (for source installation)
meson-python>=0.12.0gfortran(Fortran compiler)ninja(build tool)- OpenMP (optional, for parallelisation)
Development Dependencies
pytest>=6.0pytest-covcoverageddt
Performance
The Fortran extensions with OpenMP provide substantial performance improvements over pure Python implementations, particularly for large crystal structures with many atoms.
Contributing
Bug Reports and Feature Requests
If you think you have found a bug, please report it on the Issue Tracker. This is also the place to propose ideas for new features or ask questions about the design of crystal_torture. Poor documentation is considered a bug, but please be as specific as possible when asking for improvements.
Code Contributions
We welcome your help in improving and extending the package with your own contributions. This is managed through GitHub pull requests; for external contributions we prefer the "fork and pull" workflow, while core developers use branches in the main repository:
- First open an Issue to discuss the proposed contribution. This discussion might include how the changes fit crystal_torture's scope and a general technical approach.
- Make your own project fork and implement the changes there. Please keep your code style compliant with PEP8.
- Add or update tests for your changes.
- Open a pull request to merge the changes into the main project. A more detailed discussion can take place there before the changes are accepted.
Development Setup
bash
git clone https://github.com/connorourke/crystal_torture
cd crystal_torture
pip install ."[dev]" --use-pep517
pytest # Run tests to verify installation
Citation
If you use crystal_torture in your research, please cite:
bibtex
@article{ORourke2019,
title = {crystal-torture: A crystal tortuosity module},
volume = {4},
ISSN = {2475-9066},
url = {http://dx.doi.org/10.21105/joss.01306},
DOI = {10.21105/joss.01306},
number = {38},
journal = {Journal of Open Source Software},
publisher = {The Open Journal},
author = {O'Rourke, Conn and Morgan, Benjamin},
year = {2019},
month = jun,
pages = {1306}
}
License
This project is licensed under the MIT License - see the LICENSE file for details.
Version
Current version: 1.2.0
Changelog
- v1.2.0: Modern meson-python build system, improved Fortran integration, Python 3.10+ support
- v1.1.x: Previous stable releases with setuptools build system
Owner
- Name: Conn O'Rourke
- Login: connorourke
- Kind: user
- Company: University of Southampton
- Repositories: 3
- Profile: https://github.com/connorourke
JOSS Publication
crystal-torture: A crystal tortuosity module
Authors
Tags
OpenMP chemistry diffusion tortuosityCitation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
type: software
title: "crystal-torture: A crystal tortuosity module"
version: "1.2.0"
date-released: "2025-01-01" # Update this to actual release date
url: "https://github.com/connorourke/crystal_torture"
repository-code: "https://github.com/connorourke/crystal_torture"
license: MIT
authors:
- family-names: "O'Rourke"
given-names: "Conn"
orcid: "https://orcid.org/0000-0002-0703-8234"
- family-names: "Morgan"
given-names: "Benjamin"
orcid: "https://orcid.org/0000-0002-3056-8233"
abstract: >-
crystal-torture is a Python, Fortran, and OpenMP module for the analysis of diffusion
networks in crystal structures. Ionic diffusion through crystalline solids depends not only on
the dynamics of ions within the crystal, but also the connectivity of the transport network.
Understanding how the connectivity of diffusion pathways in crystal structures is affected by
changes in chemistry is necessary for understanding how chemical modifications change ionic
conductivities, for example the doping of solid electrolytes. crystal-torture provides a
Python API for interrogating network connectivity and diffusion pathways in partially blocked
crystal structures. It can be used as a tool for materials scientists to quickly build up network
connectivity statistics to determine the viability of potential ionic conductors, and how
chemical modification affects network connectivity, before the use of more computationally
expensive approaches modelling the full dynamics.
keywords:
- crystallography
- materials science
- tortuosity
- percolation
- fortran
- scientific computing
- ionic conductivity
- crystal structure analysis
preferred-citation:
type: article
title: "crystal-torture: A crystal tortuosity module"
authors:
- family-names: "O'Rourke"
given-names: "Conn"
- family-names: "Morgan"
given-names: "Benjamin"
doi: "10.21105/joss.01306"
url: "http://dx.doi.org/10.21105/joss.01306"
journal: "Journal of Open Source Software"
volume: 4
issue: 38
start: 1306
end: 1306
year: 2019
month: 6
Papers & Mentions
Total mentions: 1
Mechanistic Origin of Superionic Lithium Diffusion in Anion-Disordered Li<sub>6</sub>PS<sub>5</sub><i>X</i> Argyrodites
- DOI: 10.1021/acs.chemmater.0c03738
- OpenAlex ID: https://openalex.org/W3032425193
- Published: March 2021
GitHub Events
Total
- Release event: 3
- Watch event: 1
- Delete event: 6
- Push event: 55
- Create event: 2
Last Year
- Release event: 3
- Watch event: 1
- Delete event: 6
- Push event: 55
- Create event: 2
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| connorourke | c****e@g****m | 193 |
| Benjamin | b****n@b****k | 137 |
| alexsquires | a****s@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 3
- Total pull requests: 5
- Average time to close issues: 20 days
- Average time to close pull requests: about 12 hours
- Total issue authors: 2
- Total pull request authors: 2
- Average comments per issue: 3.0
- Average comments per pull request: 1.4
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: less than a minute
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- mkhorton (2)
- katyhuff (1)
Pull Request Authors
- bjmorgan (4)
- alexsquires (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 129 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 9
- Total maintainers: 2
pypi.org: crystal-torture
Crystal Tortuosity Analysis with Fortran Extensions
- Homepage: https://github.com/connorourke/crystal_torture
- Documentation: https://github.com/connorourke/crystal_torture
- License: MIT
-
Latest release: 1.2.0
published 7 months ago
Rankings
Maintainers (2)
Dependencies
- Sphinx >=1.7.6
- alabaster *
- bleach *
- certifi *
- coverage *
- ddt *
- docutils *
- sphinxcontrib-websupport *
- coverage *
- ddt *
- numpy *
- pymatgen >=2022.0.0
