mdtraj.compute_rdf

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

Compute radial distribution functions for pairs in every frame.

Parameters:

traj : Trajectory

pair_names : array-like, shape=(2,), optional, default=None

Pair of atom names to consider. Atom names are matched using the same regex matching employed by MDTraj’s atom selection DSL. If pair_names is not provided, the RDF will be computed between all atoms.

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

Minimum and maximum radii.

bin_width : int, optional, default=0.005

Width of the bins in nanometers.

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