SkillAgentSearch skills...

Rdfpy

A Python module for fast computation of 2D and 3D radial distribution functions (RDFs).

Install / Use

/learn @by256/Rdfpy

README

<img alt="rdfpy" src="./logo.png" height="100">

Build Status Documentation Status PyPI version License

rdfpy is a Python module for fast computation of 2D and 3D radial distribution functions (RDFs).

Installation

$ pip install rdfpy

Usage

import numpy as np
from rdfpy import rdf

# create random particle coordinates in a 20x20x20 box
coords = np.random.uniform(0.0, 20.0, size=(2500, 3))  

# compute radial distribution function with step size = 0.1
g_r, radii = rdf(coords, dr=0.1)

You can find a more detailed example in the Documentation.

Note: In order for rdfpy to work correctly, your particles should spatially be in a cuboidal box, where the entire box is filled with particles.

How does it work?

rdfpy achieves significant speed-up due to:

  • Fast nearest-neighbor look-up: a k-d tree is utilized when counting the number of particles as a function of distance from an origin particle.
  • Multiprocessing: computation of the particle count histogram is parallelized across multiple cores, with each core sharing the aforementioned k-d tree.

Authors

rdfpy was developed by Batuhan Yildirim under the supervision of Prof. Jacqueline M. Cole.

Citation

If you use rdfpy in your work, please cite:

@software{rdfpy,
  author       = {Batuhan Yildirim and
                  Hamish Galloway Brown},
  title        = {by256/rdfpy: rdfpy-v1.0.0},
  month        = mar,
  year         = 2021,
  publisher    = {Zenodo},
  version      = {v1.0.0},
  doi          = {10.5281/zenodo.4625675},
  url          = {https://doi.org/10.5281/zenodo.4625675}
}

DOI

Funding

This project was financially supported by the Science and Technology Facilities Council (STFC) and the Royal Academy of Engineering (RCSRF1819\7\10).

View on GitHub
GitHub Stars31
CategoryDevelopment
Updated6mo ago
Forks13

Languages

Python

Security Score

87/100

Audited on Sep 9, 2025

No findings