mdtraj.compute_rdf

mdtraj.compute_rdf(traj, pairs, r_range=None, bin_width=0.005, n_bins=None, periodic=True, opt=True)

Compute radial distribution functions for pairs in every frame.

Parameters
trajTrajectory

Trajectory to compute radial distribution function in.

pairsarray-like, shape=(n_pairs, 2), dtype=int

Each row gives the indices of two atoms.

r_rangearray-like, shape=(2,), optional, default=(0.0, 1.0)

Minimum and maximum radii.

bin_widthfloat, optional, default=0.005

Width of the bins in nanometers.

n_binsint, optional, default=None
The number of bins. If specified, this will override the bin_width

parameter.

periodicbool, default=True

If periodic is True and the trajectory contains unitcell information, we will compute distances under the minimum image convention.

optbool, default=True

Use an optimized native library to compute the pair wise distances.

Returns
rnp.ndarray, shape=(np.diff(r_range) / bin_width - 1), dtype=float

Radii values corresponding to the centers of the bins.

g_rnp.ndarray, shape=(np.diff(r_range) / bin_width - 1), dtype=float

Radial distribution function values at r.

See also

Topology.select_pairs