Welcome to RadialDF’s documentation!

This package provides the radial distribution function to analyze the radial density of particles around other particles. The package provides a single function inner_rdf() that calculates the RDF but excludes the border regions (as they would require n-dimensional intersection of shapes, which isn’t computationally feasible).

A future version, if my short attention span permits it, will provide an rdf function that handles the 2D and 3D cases with the inclusion of the border regions.

Example

from radialdf import inner_rdf
import numpy as np
import plotly.graph_objs as go

# Generate 10000 random particles with 3 coordinates between 0 and 100
particles = np.random.rand(10000, 3) * 100
# Define a volume from 0 to 100 on 3 axes
box = [[0, 100]] * 3
# Check the radial distribution, which should be pretty boring and flat
g = inner_rdf(box, particles, 20, 0.2)
go.Figure(go.Scatter(x=[i * 0.2 for i in range(21)], y=g)).show()

radialdf package

Module contents

Radial Distribution Function module

radialdf.inner_rdf(boundary, particles, r, dr)

Computes the radial distribution function, showing the average density of other particles around each particle sampled in concentric shells of thickness dr within a maximum radius of r. This function stays a distance of r away from all borders as it currently does not deal with border effects. It will calculate the RDF only for those particles located at least r away from each border.

The particles argument should have an (n, k) shape where n is the amount of particles and k the number of dimensions.

The boundary argument should have shape (k, 2) where each row is the mimimum and maximum of a dimension of the volume within which particles should have been placed. An example for 3d-data would be [[0, 100], [0, 200], [0, 100]] for a 100x200x100 box.

Parameters
  • boundary (np.ndarray-like with shape (k, 2)) – The limits for each dimension of the particles. Used to normalize to volume and exclude boundary particles.

  • particles (np.ndarray-like with shape (n, k)) – The particles to investigate.

  • r (float) – The maximum search radius, and the boundary exclusion size

  • dr (float) – Resolution of the RDF. Thickness of the radial shells whose particle density is the basis of the RDF.

radialdf.rdf(boundary, particles, r, dr)

Indices and tables