Radial Distribution Functions — pmda.rdf

This module contains parallel versions of analysis tasks in MDAnalysis.analysis.rdf.

Classes

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

Intermolecular pair distribution function

bins

The distance \(r\) at which the distribution function \(g(r)\) is determined; these are calculated as the centers of the bins that were used for histogramming.

Type

array

rdf

The value of the pair distribution function \(g(r)\) at \(r\).

Type

array

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]

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.2.0.

Parameters
  • Universe (Universe) – a MDAnalysis.core.groups.Universe (the atomgroups must belong to this Universe)

  • atomgroups (tuple of AtomGroup) – atomgroups that are iterated in parallel

_results

The raw data from each process are stored as a list of lists, with each sublist containing the return values from pmda.parallel.ParallelAnalysisBase._single_frame().

Type

list

property cdf

Calculate the cumulative distribution functions (CDF). Note that this is the actual count within a given radius, i.e., \(N(r)\).

Returns

cdf – a numpy array with the same structure as rdf

Return type

numpy array

New in version 0.3.0.

readonly_attributes()

Set the attributes of this class to be read only

Useful to avoid the class being modified when passing it around.

To be used as a context manager:

with analysis.readonly_attributes():
    some_function(analysis)
run(start=None, stop=None, step=None, n_jobs=1, n_blocks=None)

Perform the calculation

Parameters
  • start (int, optional) – start frame of analysis

  • stop (int, optional) – stop frame of analysis

  • step (int, optional) – number of frames to skip between each analysed frame

  • n_jobs (int, optional) – number of jobs to start, if -1 use number of logical cpu cores. This argument will be ignored when the distributed scheduler is used

  • n_blocks (int, optional) – number of blocks to divide trajectory into. If None set equal to n_jobs or number of available workers in scheduler.