compute_rdf#

compute_rdf(source, type1, type2, cutoff=10.0, dr=0.1, **kwargs)[source]#
compute_rdf(source, type1, type2, cutoff=10.0, dr=0.1)
compute_rdf(source, type1, type2, cutoff=10.0, dr=0.1, skip=1)

Calculate the Radial Distribution Function (RDF) g(r), and its derivatives G(r) and n(r).

This function uses singledispatch to handle either a static AtomicSystem or an MDAnalysis Universe (for trajectory analysis).

Parameters:
sourceAtomicSystem or mda.Universe

The source structure or trajectory to analyze.

type1str

Atom type for the first selection (‘all’ or specific type).

type2str

Atom type for the second selection (‘all’ or specific type).

cutofffloat, optional

Maximum distance for the RDF calculation (in Angstroms).

drfloat, optional

Bin width for the histogram (in Angstroms).

skipint, optional

Number of frames to skip during trajectory analysis (only for mda.Universe).

Returns:
pd.DataFrame

Indexed by distance r, with columns g_r, G_r and n_r.

float

The number density of the second selection, in atoms per cubic Angstrom, that g_r was normalised by. Returned because the normalisation is what makes an RDF comparable between systems, and checking it is the quickest way to tell a real first peak from one produced by the wrong particle count.

Raises:
TypeError

If the provided source type is not supported.