partycls

partycls: A Python package for structural clustering - Published in JOSS (2021)

https://github.com/jorisparet/partycls

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

clustering machine-learning molecular-dynamics physics python

Scientific Fields

Sociology Social Sciences - 35% confidence
Last synced: 4 months ago · JSON representation

Repository

Unsupervised learning of structure in systems of interacting particles.

Basic Info
Statistics
  • Stars: 14
  • Watchers: 1
  • Forks: 5
  • Open Issues: 1
  • Releases: 0
Topics
clustering machine-learning molecular-dynamics physics python
Created over 4 years ago · Last pushed about 2 years ago
Metadata Files
Readme License Support

README.md

pypi version license DOI build coverage

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:

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

Optional

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

Joris Paret

Daniele Coslovich

Owner

  • Name: Joris Paret
  • Login: jorisparet
  • Kind: user
  • Location: France
  • Company: ITER Organization

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
Published
November 08, 2021
Volume 6, Issue 67, Page 3723
Authors
Joris Paret ORCID
Laboratoire Charles Coulomb (L2C), Université de Montpellier, CNRS, Montpellier, France
Daniele Coslovich
Dipartimento di Fisica, Università di Trieste, Italy
Editor
Lucy Whalley ORCID
Tags
clustering structure condensed matter physics

GitHub Events

Total
  • Watch event: 3
Last Year
  • Watch event: 3

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 491
  • Total Committers: 3
  • Avg Commits per committer: 163.667
  • Development Distribution Score (DDS): 0.126
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email 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

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 8 Last month
Rankings
Dependent packages count: 10.0%
Forks count: 13.3%
Stargazers count: 16.5%
Average: 21.0%
Dependent repos count: 21.8%
Downloads: 43.3%
Maintainers (1)
Last synced: 4 months ago

Dependencies

requirements.txt pypi
  • atooms <3
  • dscribe *
  • matplotlib *
  • mdtraj *
  • numpy *
  • ovito *
  • py3Dmol *
  • sklearn *
setup.py pypi
  • numpy *
  • sklearn *
.github/workflows/build-test.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
docs/requirements-docs.txt pypi
  • nbsphinx *
  • sphinx *
  • sphinx-rtd-theme *
  • sphinx_copybutton *
  • sphinxcontrib-bibtex *
requirements-mdtraj.txt pypi
  • h5py *
  • networkx *
  • tables *