5.7.3. Radial Distribution Functions — MDAnalysis.analysis.rdf

Tools for calculating pair distribution functions (“radial distribution functions” or “RDF”).

class MDAnalysis.analysis.rdf.InterRDF(g1, g2, nbins=75, range=(0.0, 15.0), exclusion_block=None, **kwargs)[source]

Intermolecular pair distribution function

InterRDF(g1, g2, nbins=75, range=(0.0, 15.0))

Parameters:
  • g1 (AtomGroup) – First AtomGroup
  • g2 (AtomGroup) – Second AtomGroup
  • nbins (int (optional)) – Number of bins in the histogram [75]
  • range (tuple or list (optional)) – The size of the RDF [0.0, 15.0]
  • exclusion_block (tuple (optional)) – A tuple representing the tile to exclude from the distance array. [None]
  • start (int (optional)) – The frame to start at (default is first)
  • stop (int (optional)) – The frame to end at (default is last)
  • step (int (optional)) – The step size through the trajectory in frames (default is every frame)

Example

First create the InterRDF object, by supplying two AtomGroups then use the run() method

rdf = InterRDF(ag1, ag2)
rdf.run()

Results are available through the bins and rdf attributes:

plt.plot(rdf.bins, rdf.rdf)

The exclusion_block keyword allows the masking of pairs from within the same molecule. For example, if there are 7 of each atom in each molecule, the exclusion mask (7, 7) can be used.

New in version 0.13.0.