partycls
partycls: A Python package for structural clustering - Published in JOSS (2021)
Science Score: 95.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 8 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.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
Keywords
Scientific Fields
Repository
Unsupervised learning of structure in systems of interacting particles.
Basic Info
- Host: GitHub
- Owner: jorisparet
- License: gpl-3.0
- Language: Python
- Default Branch: master
- Homepage: https://www.jorisparet.com/partycls/
- Size: 28 MB
Statistics
- Stars: 14
- Watchers: 1
- Forks: 5
- Open Issues: 1
- Releases: 0
Topics
Metadata Files
README.md
partycls is a Python package for cluster analysis of systems of interacting particles. By grouping particles that share similar structural or dynamical properties, partycls enables rapid and unsupervised exploration of the system's relevant features. It provides descriptors suitable for applications in condensed matter physics, such as structural analysis of disordered or partially ordered materials, and integrates the necessary tools of unsupervised learning into a streamlined workflow.
Homepage
For more details and tutorials, visit the homepage at: https://www.jorisparet.com/partycls
Quick start
This quick example shows how to use partycls to identify grain boundaries in a polycrystalline system. The system configuration is stored in a XYZ trajectory file with a single frame. We use the local distribution of bond angles around each particle as a structural descriptor and perform a clustering using the K-Means algorithm.
```python from partycls import Trajectory, Workflow
traj = Trajectory('grains.xyz') wf = Workflow(traj, descriptor='ba', clustering='kmeans') wf.run() traj[0].show(color='label', backend='ovito') ```

The results are also written to a set of files including a labeled trajectory file and additional information on the clustering results. The whole workflow can be tuned and customized, check out the tutorials to see how and for further examples.
Thanks to a flexible system of filters, partycls makes it easy to restrict the analysis to a given subset of particles based on arbitrary particle properties. Say we have a binary mixture composed of particles with types A and B, and we are only interested in analyzing the bond angles of B particles in a vertical slice:
```python from partycls import Trajectory from partycls.descriptors import BondAngleDescriptor
traj = Trajectory('trajectory.xyz') D = BondAngleDescriptor(traj) D.addfilter("species == 'B'") D.addfilter("x > 0.0") D.add_filter("x < 1.0") D.compute()
Angular correlations for the selected particles
print(D.features) ```
We can then perform a clustering based on these structural features and ask for 3 clusters:
```python from partycls import KMeans
clustering = KMeans(n_clusters=3) clustering.fit(D.features) print('Cluster membership of the particles', clustering.labels) ```
Main features
Trajectory formats
partycls accepts several trajectory formats (including custom ones) either through its built-in trajectory reader or via third-party packages, such as MDTraj and atooms. The code is currently optimized for small and medium system sizes (of order 10⁴ particles). Multiple trajectory frames can be analyzed to extend the structural dataset.
Structural descriptors
partycls implements various structural descriptors:
- Radial descriptor
- Tetrahedral descriptor
- Bond-angle descriptor
- Smoothed bond-angle descriptor
- Bond-orientational descriptor
- Smoothed bond-orientational descriptor
- Locally averaged bond-orientational descriptor
- Radial bond-orientational descriptor
- Compactness descriptor
- Coordination descriptor
Machine learning
partycls performs feature scaling, dimensionality reduction and cluster analysis using the scikit-learn package and additional built-in algorithms.
Dependencies
partycls relies on several external packages, most of which only provide additional features and are not necessarily required.
Required
- Fortran compiler (e.g. gfortran)
- NumPy
- scikit-learn
Optional
- MDTraj (additional trajectory formats)
- atooms (additional trajectory formats)
- DScribe (additional descriptors)
- Matplotlib (visualization)
- OVITO < 3.7.0 (visualization)
- Py3DMol (interactive 3D visualization)
- pyvoro or its memory-optimized fork for large systems (Voronoi neighbors and tessellation)
- tqdm (progress bars)
Documentation
Check the tutorials to see various examples and detailed instructions on how to run the code, as well as an in-depth presentation of the built-in structural descriptors.
For a more detailed documentation, you can check the API.
Installation
From PyPI
The latest stable release is available on PyPI. Install it with pip:
bash
pip install partycls
From source
To install the latest development version from source, clone the source code from the official GitHub repository and install it with:
bash
git clone https://github.com/jorisparet/partycls.git
cd partycls
make install
Run the tests using:
bash
make test
or manually compile the Fortran sources and run the tests:
bash
cd partycls/
f2py -c -m neighbors_wrap neighbors.f90
cd descriptor/
f2py -c -m realspace_wrap realspace.f90
cd ../../
pytest tests/
Support and contribution
If you wish to contribute or report an issue, feel free to contact us or to use the issue tracker and pull requests from the code repository.
We largely follow the GitHub flow to integrate community contributions. In essence:
1. Fork the repository.
2. Create a feature branch from master.
3. Unleash your creativity.
4. Run the tests.
5. Open a pull request.
We also welcome contributions from other platforms, such as GitLab instances. Just let us know where to find your feature branch.
Citing partycls
If you use partycls in a scientific publication, please consider citing the following article:
partycls: A Python package for structural clustering. Paret et al., (2021). Journal of Open Source Software, 6(67), 3723
Bibtex entry:
@article{Paret2021,
doi = {10.21105/joss.03723},
url = {https://doi.org/10.21105/joss.03723},
year = {2021},
publisher = {The Open Journal},
volume = {6},
number = {67},
pages = {3723},
author = {Joris Paret and Daniele Coslovich},
title = {partycls: A Python package for structural clustering},
journal = {Journal of Open Source Software}
}
Authors
Owner
- Name: Joris Paret
- Login: jorisparet
- Kind: user
- Location: France
- Company: ITER Organization
- Website: https://www.jorisparet.com
- Repositories: 6
- Profile: https://github.com/jorisparet
PhD in computational physics, with a strong interest in machine learning, deep learning and indie game development.
JOSS Publication
partycls: A Python package for structural clustering
Authors
Dipartimento di Fisica, Università di Trieste, Italy
Tags
clustering structure condensed matter physicsGitHub Events
Total
- Watch event: 3
Last Year
- Watch event: 3
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Joris Paret | j****t@u****r | 429 |
| Daniele Coslovich | 9****o@u****g | 37 |
| Joris Paret | 5****t | 25 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 11
- Total pull requests: 1
- Average time to close issues: 8 days
- Average time to close pull requests: 3 minutes
- Total issue authors: 3
- Total pull request authors: 1
- Average comments per issue: 1.36
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- govarguz (7)
- FTurci (3)
- chtchelkatchev (1)
Pull Request Authors
- jorisparet (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 8 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 5
- Total maintainers: 1
pypi.org: partycls
Unsupervised learning of the structure of particulate systems
- Homepage: https://github.com/jorisparet/partycls
- Documentation: https://partycls.readthedocs.io/
- License: GPLv3
-
Latest release: 2.0.2
published about 2 years ago
Rankings
Maintainers (1)
Dependencies
- atooms <3
- dscribe *
- matplotlib *
- mdtraj *
- numpy *
- ovito *
- py3Dmol *
- sklearn *
- numpy *
- sklearn *
- actions/checkout v2 composite
- actions/setup-python v2 composite
- nbsphinx *
- sphinx *
- sphinx-rtd-theme *
- sphinx_copybutton *
- sphinxcontrib-bibtex *
- h5py *
- networkx *
- tables *
