# RDFPlanar#

class maicos.modules.rdfplanar.RDFPlanar(g1, g2=None, rdf_bin_width=0.3, dzheight=0.1, range=(0.0, None), bin_method='com', output='rdf.dat', refgroup=None, unwrap=False, concfreq=0, dim=2, zmin=None, zmax=None, bin_width=1)[source]#

Bases: PlanarBase

Compute slab-wise planar 2D radial distribution functions.

The radial distribution function $$g_\mathrm{2d}(r)$$ describes the spatial correlation between atoms in $$g1$$ and atoms in $$g2$$. The 2D RDF can be used in systems that are inhomogeneous along one axis, and homogeneous in a plane. It gives the average number density of $$g2$$ as a function of lateral distance from a centered $$g1$$ atom. In fully homogeneous systems and in the limit of small ‘dzheight’ $$\Delta z$$, it is the same as the well known three dimensional RDF.

$g_\mathrm{2d}(r) = \frac{1}{N_{g1}2 \Delta z} \cdot \sum_{i}^{N_{g1}} \sum_{j}^{N_{g2}} \delta(r - r_{ij}) \cdot \left( \theta \left(|z_{ij}| + {\Delta z} \right) - \theta \left( |z_{ij}| - {\Delta z} \right) \right) .$

As the density to normalise the RDF with is unknown, the output is in the dimension of number/volume in 1/Å^3.

Functionally, RDFPlanar bins all pairwise $$g1$$-$$g2$$ distances where the z distance is smaller than dzheight in a histogram.

Parameters:
• g1 (AtomGroup) – First AtomGroup.

• g2 (AtomGroup) – Second AtomGroup.

• rdf_bin_width (int) – Binwidth of bins in the histogram of the RDF (Å).

• dzheight (float) – dz height of a RDF slab (Å).

• range ((float, float)) – the minimum and maximum pairwise distance between ‘g1’ and ‘g2’ (Å).

• bin_method (str) – Method for position binning; possible options are center of geometry (cog), center of mass (com) or center of charge (coc).

• output (str) – Output filename

• refgroup (AtomGroup) –

Reference AtomGroup used for the calculation.

If refgroup is provided, the calculation is performed relative to the center of mass of the AtomGroup.

If refgroup is None the calculations are performed to the center of the (changing) box.

• unwrap (bool) –

When unwrap = True, molecules that are broken due to the periodic boundary conditions are made whole.

If the input contains molecules that are already whole, speed up the calculation by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS from the command line, or use unwrap = False when using MAICoS from the Python interpreter.

Note: Molecules containing virtual sites (e.g. TIP4P water models) are not currently supported in MDAnalysis. In this case, you need to provide unwrapped trajectory files directly, and disable unwrap. Trajectories can be unwrapped, for example, using the trjconv command of GROMACS.

• concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude function is called and the output files are written every concfreq frames

• dim (int) – Dimension for binning (x=0, y=1, z=2).

• zmin (float) –

Minimal coordinate for evaluation (in Å) with respect to the center of mass of the refgroup.

If zmin=None, all coordinates down to the lower cell boundary are taken into account.

• zmax (float) –

Maximal coordinate for evaluation (in Å) with respect to the center of mass of the refgroup.

If zmax = None, all coordinates up to the upper cell boundary are taken into account.

• jitter (float) –

If jitter is not None, random numbers of the order of jitter (Å) are added to the atom positions.

The appilication of a jitter is rationalized in possible aliasing effects when histogramming data, i.e., for spatial profiles. These aliasing effects can be stabilized with the application of a numerical jitter. The jitter value should be about the precision of the trajectory and will not alter the results of the histogram.

You can estimate the precision of the positions in your trajectory with maicos.lib.util.trajectory_precision(). Note that if the precision is not the same for all frames, the smallest precision should be used.

• bin_width (float) – Width of the bins (in Å).

results.bin_pos#

Bin positions (in Å) ranging from zmin to zmax.

Type:

numpy.ndarray

results.bins#

distances to which the RDF is calculated with shape (rdf_nbins) (Å)

Type:

numpy.ndarray

results.rdf#

RDF with shape (rdf_nbins, n_bins) (1/Å^3)

Type:

np.ndrray

save()[source]#

Save results.