mdtraj.compute_rdf

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

Compute radial distribution functions for pairs in every frame.

Parameters:

traj : Trajectory

Trajectory to compute radial distribution function in.

pairs : array-like, shape=(n_pairs, 2), dtype=int, optional, default=None

Each row gives the indices of two atoms.

r_range : array-like, shape=(2,), optional, default=(0.0, 1.0)

Minimum and maximum radii.

bin_width : float, optional, default=0.005

Width of the bins in nanometers.

n_bins : int, optional, default=None

The number of bins. If specified, this will override the bin_width

parameter.

periodic : bool, default=True

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

opt : bool, default=True

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

Returns:

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

Radii values corresponding to the centers of the bins.

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

Radial distribution function values at r.

Versions