PDFPlanar#
- class maicos.PDFPlanar(g1: AtomGroup, g2: AtomGroup | None = None, pdf_bin_width: float = 0.3, dzheight: float = 0.1, dmin: float = 0.0, dmax: float | None = None, bin_method: str = 'com', output: str = 'pdf.dat', unwrap: bool = False, refgroup: AtomGroup | None = None, concfreq: int = 0, jitter: float = 0.0, dim: int = 2, zmin: float | None = None, zmax: float | None = None, bin_width: float = 1)[source]#
Bases:
PlanarBase
Slab-wise planar 2D pair distribution functions.
The pair distribution function \(g_\mathrm{2D}(r)\) describes the spatial correlation between atoms in \(g_1\) and atoms in \(g_2\), which lie in the same plane. It gives the average number density of \(g_2\) atoms as a function of lateral distance \(r\) from a centered \(g_1\) atom. PDFPlanar can be used in systems that are inhomogeneous along one axis, and homogeneous in a plane. In fully homogeneous systems and in the limit of small ‘dzheight’ \(\Delta z\), it is the same as the well known three dimensional PDF.
The planar PDF is defined by
\[g_\mathrm{2D}(r) = \left \langle \frac{1}{N_{g1}} \cdot \sum_{i}^{N_{g1}} \sum_{j}^{N_{g2}} \frac{1}{2 \pi r} \delta(r - r_{ij}) \delta(z_{ij}) \right \rangle .\]where the brackets \(\langle \cdot \rangle\) denote the ensemble average. \(\delta(r- r_{ij})\) counts the \(g_2\) atoms at distance \(r\) from atom \(i\). \(\delta(z_{ij})\) ensures that only atoms, which lie in the same plane \(z_i = z_j\), are considered for the PDF.
Discretized for computational purposes the equation reads as
\[g_\mathrm{2D}(r) = \frac{1}{N_{g1}} \cdot \sum_{i}^{N_{g1}} \frac{\mathrm{count}\; g_2 \; \mathrm{in}\; \Delta V_i(r) }{\Delta V_i(r)} .\]where \(\Delta V_i(r)\) is a ring around atom i, with inner radius \(r - \frac{\Delta r}{2}\), outer radius \(r + \frac{\Delta r}{2}\) and height \(2 \Delta z\).
As the density to normalise the PDF with is unknown, the output is in the dimension of number/volume in 1/Å^3.
Functionally, PDFPlanar bins all pairwise \(g_1\)-\(g_2\) distances, where the z distance is smaller than ‘dzheight’ in a histogram.
For a more detailed explanation refer to Explanation: PDF and PDFPlanar Derivation
- Parameters:
g1 (MDAnalysis.core.groups.AtomGroup) – First AtomGroup.
g2 (MDAnalysis.core.groups.AtomGroup) – Second AtomGroup.
pdf_bin_width (float) – Binwidth of bins in the histogram of the PDF (Å).
dzheight (float) – dz height of a PDF slab \(\Delta z\) (Å). \(\Delta z\) is introduced to discretize the delta function \(\delta(z_{ij})\). It is the maximum \(z\) distance between atoms which are considered to lie in the same plane. In the limit of \(\Delta z \to 0\), PDFPlanar reaches the continous limit. However, if \(\Delta z\) is too small, there are no atoms in ‘g2’ to sample. We recommend a choice of \(\Delta z\) that is 1/10th of a bond length.
dmin (float) – Minimum pairwise distance between ‘g1’ and ‘g2’ (Å).
dmax (float) – Maximum pairwise distance between ‘g1’ and ‘g2’ (Å).
bin_method ({
"com"
,"cog"
,"coc"
}) –Method for the position binning.
The possible options are center of mass (
"com"
), center of geometry ("cog"
), and center of charge ("coc"
).output (str) – Output filename.
unwrap (bool) –
When
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 useunwrap=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.refgroup (MDAnalysis.core.groups.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.jitter (float) –
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when histogramming data. The jitter value should be about the precision of the trajectory. In that case, using jitter will not alter the results of the histogram. If
jitter = 0.0
(default), the original atomic positions are kept unchanged.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.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 ({0, 1, 2}) – Dimension for binning (
x=0
,y=1
,z=1
).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.bin_width (float) – Width of the bins (in Å).
- results.bin_pos#
Bin positions (in Å) ranging from
zmin
tozmax
.- Type:
- results.bins#
distances to which the PDF is calculated with shape (pdf_nbins) (Å)
- Type:
- results.pdf#
PDF with shape (pdf_nbins, n_bins) (1/Å^3)
- Type:
np.ndrray