
     im                     t    d Z ddlZddlZddlmZ ddlmZmZ d Z	 G d d	e          Z
 G d
 de          ZdS )a  Radial Distribution Functions --- :mod:`MDAnalysis.analysis.rdf`
====================================================================

This module contains two classes to calculate radial
`pair distribution functions`_ (`radial distribution functions`_ or "RDF").
The RDF :math:`g_{ab}(r)` between types of particles :math:`a` and :math:`b` is

.. _equation-gab:

.. math::

   g_{ab}(r) = \frac{1}{N_{a}} \frac{1}{N_{b}/V} \sum_{i=1}^{N_a} \sum_{j=1}^{N_b}
               \langle \delta(|\mathbf{r}_i - \mathbf{r}_j| - r) \rangle

which is normalized so that the RDF becomes 1 for large separations in a
homogenous system. The RDF effectively counts the average number of :math:`b`
neighbours in a shell at distance :math:`r` around a :math:`a` particle and
represents it as a density.

The radial cumulative distribution function is

.. math::

   G_{ab}(r) = \int_0^r \!\!dr' 4\pi r'^2 g_{ab}(r')

and the average number of :math:`b` particles within radius :math:`r`

.. _equation-countab:

.. math::

   N_{ab}(r) = \rho G_{ab}(r)

(with the appropriate density :math:`\rho`). The latter function can be used to
compute, for instance, coordination numbers such as the number of neighbors in
the first solvation shell :math:`N(r_1)` where :math:`r_1` is the position of
the first minimum in :math:`g(r)`.

We provide options for calculating the density of particle :math:`b`
in a shell at distance :math:`r` around a :math:`a` particle, which is

.. _equation-nab:

.. math::
   n_{ab}(r) = \rho g_{ab}(r)

.. _`pair distribution functions`:
   https://en.wikipedia.org/wiki/Pair_distribution_function
.. _`radial distribution functions`:
   https://en.wikipedia.org/wiki/Radial_distribution_function

.. Not Implemented yet:
.. - Structure factor?
.. - Coordination number
    N   )	distances   )AnalysisBaseResultsGroupc                 >   fd |           }t          j        |d                   t          j        |d                   g}t          t          |          dz            D ]7}|dxx         |d|z           z  cc<   |dxx         |d|z  dz            z  cc<   8|S )a  Custom aggregator for nested arrays

    This function takes a nested list or tuple of NumPy arrays, flattens it
    into a single list, and aggregates the elements at alternating indices
    into two separate arrays. The first array accumulates elements at even
    indices, while the second accumulates elements at odd indices.

    Parameters
    ----------
    arrs : list
        List of arrays or nested lists of arrays

    Returns
    -------
    list of ndarray
        A list containing two NumPy arrays:
        - The first array is the sum of all elements at even indices
          in the sum of flattened arrays.
        - The second array is the sum of all elements at odd indices
          in the sum of flattened arrays.
    c                 ^    t          | t          t          f          rfd| D             S | gS )Nc                 0    g | ]} |          D ]}|S  r   ).0sublistitemflattens      a/srv/www/vhosts/g4struct/public_html/venv/lib/python3.11/site-packages/MDAnalysis/analysis/rdf.py
<listcomp>z5nested_array_sum.<locals>.flatten.<locals>.<listcomp>o   s0    IIIW8H8HIIDIIII    )
isinstancelisttuple)arrr   s    r   r   z!nested_array_sum.<locals>.flattenm   s;    cD%=)) 	JIIIIIIIIur   r   r   r   )np
zeros_likerangelen)arrsflataggregated_arrir   s       @r   nested_array_sumr   V   s    .    
 74==DmDG,,bmDG.D.DEN3t99>"" - -qT!a%[(qT!a%!)_,r   c                        e Zd ZdZed             ZdZ	 	 	 	 	 	 d fd		Zd
 Zd Z	d Z
d Zed             Zed             Zed             Zed             Z xZS )InterRDFa  Radial distribution function

    :class:`InterRDF` is a tool to calculate average radial distribution
    functions between two groups of atoms. Suppose we have two AtomGroups ``A``
    and ``B``. ``A`` contains atom ``A1``, ``A2``, and ``B`` contains ``B1``,
    ``B2``. Given ``A`` and ``B`` to :class:`InterRDF`, the output will be the
    average of RDFs between ``A1`` and ``B1``, ``A1`` and ``B2``, ``A2`` and
    ``B1``, ``A2`` and ``B2``. A typical application is to calculate the RDF of
    solvent with itself or with another solute.

    The :ref:`radial distribution function<equation-gab>` is calculated by
    histogramming distances between all particles in `g1` and `g2` while taking
    periodic boundary conditions into account via the minimum image
    convention.

    The `exclusion_block` keyword may be used to exclude a set of distances
    from the calculations.

    Results are available in the attributes :attr:`results.rdf`
    and :attr:`results.count`.

    Parameters
    ----------
    g1 : AtomGroup
        First AtomGroup
    g2 : AtomGroup
        Second AtomGroup
    nbins : int
        Number of bins in the histogram
    range : tuple or list
        The size of the RDF
    norm : str, {'rdf', 'density', 'none'}
          For 'rdf' calculate :math:`g_{ab}(r)`. For
          'density' the :ref:`single particle density<equation-nab>`
          :math:`n_{ab}(r)` is computed. 'none' computes the number of
          particles occurences in each spherical shell.

          .. versionadded:: 2.3.0

    exclusion_block : tuple
        A tuple representing the tile to exclude from the distance array.
    exclude_same : str
        Will exclude pairs of atoms that share the same "residue", "segment", or "chain".
        Those are the only valid values. This is intended to remove atoms that are
        spatially correlated due to direct bonded connections.
    verbose : bool
        Show detailed progress of the calculation if set to `True`
    backend : {'serial', 'OpenMP', 'distopia'}, optional
        Keyword selecting the type of acceleration of the distance calculations.
        Default is 'serial'.

        .. versionadded:: 2.10.0

    Attributes
    ----------
    results.bins : numpy.ndarray
       :class:`numpy.ndarray` of the centers of the `nbins` histogram
       bins.

       .. versionadded:: 2.0.0

    bins : numpy.ndarray
       Alias to the :attr:`results.bins` attribute.

       .. deprecated:: 2.0.0
           This attribute will be removed in 3.0.0.
           Use :attr:`results.bins` instead.

    results.edges : numpy.ndarray

      :class:`numpy.ndarray` of the `nbins + 1` edges of the histogram
      bins.

       .. versionadded:: 2.0.0

    edges : numpy.ndarray

       Alias to the :attr:`results.edges` attribute.

       .. deprecated:: 2.0.0
           This attribute will be removed in 3.0.0.
           Use :attr:`results.edges` instead.

    results.rdf : numpy.ndarray
      :class:`numpy.ndarray` of the :ref:`radial distribution
      function<equation-gab>` values for the :attr:`results.bins`.

       .. versionadded:: 2.0.0

    rdf : numpy.ndarray
       Alias to the :attr:`results.rdf` attribute.

       .. deprecated:: 2.0.0
           This attribute will be removed in 3.0.0.
           Use :attr:`results.rdf` instead.

    results.count : numpy.ndarray
      :class:`numpy.ndarray` representing the radial histogram, i.e.,
      the raw counts, for all :attr:`results.bins`.

       .. versionadded:: 2.0.0

    count : numpy.ndarray
       Alias to the :attr:`results.count` attribute.

       .. deprecated:: 2.0.0
           This attribute will be removed in 3.0.0.
           Use :attr:`results.count` instead.

    Example
    -------
    First create the :class:`InterRDF` object, by supplying two
    AtomGroups then use the :meth:`run` method ::

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

    Results are available through the :attr:`results.bins` and
    :attr:`results.rdf` attributes::

      plt.plot(rdf.results.bins, rdf.results.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.


    .. versionadded:: 0.13.0

    .. versionchanged:: 1.0.0
       Support for the `start`, `stop`, and `step` keywords has been
       removed. These should instead be passed to :meth:`InterRDF.run`.

    .. versionchanged:: 2.0.0
       Store results as attributes `bins`, `edges`, `rdf` and `count`
       of the `results` attribute of
       :class:`~MDAnalysis.analysis.AnalysisBase`.

    .. versionchanged:: 2.10.0
       Enabled **parallel execution** with the ``multiprocessing`` and ``dask``
       backends; use the new method :meth:`get_supported_backends` to see all
       supported backends.
    c                     dS N)serialmultiprocessingdaskr   clss    r   get_supported_backendszInterRDF.get_supported_backends      
 
r   TK           g      .@rdfNr$   c	                     t          t          |           j        |j        j        fi |	 || _        || _        t          |                                          | _	        ||d| _
        || _        ||dvrt          d          ||t          d          dddd}
|
                    |          | _        | j	        dvrt          d	| j	         d
          || _        d S )Nbinsr   )residuesegmentchainzTThe exclude_same argument to InterRDF must be None, 'residue', 'segment' or 'chain'.zJThe exclude_same argument to InterRDF cannot be used with exclusion_block.
resindices
segindiceschainIDsr.   densitynone'5' is an invalid norm. Use 'rdf', 'density' or 'none'.)superr!   __init__universe
trajectoryg1g2strlowernormrdf_settings_exclusion_block
ValueErrorgetexclude_samebackend)selfrA   rB   nbinsr   rE   exclusion_blockrJ   rK   kwargsname_to_attr	__class__s              r   r>   zInterRDF.__init__  s2    	'h&r{'=HHHHHIIOO%%	%*U;; /# =
 )
 )

    #(C\   $#
 

 ),,\::96662DI 2 2 2  
 r   c                 V   t          j        dgfi | j        \  }}|                    t           j                  }|dz  }|| j        _        || j        _        d|d d         |dd          z   z  | j        _        | j	        dk    rd| j        _
        | j        d         d         | _        d S )Nr-         ?r   r.   r   r   )r   	histogramrF   astypefloat64resultscountedgesr1   rE   
volume_cum	_maxrange)rL   rY   rZ   s      r   _preparezInterRDF._prepareD  s    |RD>>D,=>>uRZ((""5":abb	#9:9&'DL#*73A6r   c                    t          j        | j        j        | j        j        | j        | j        j        | j                  \  }}| j	        Z|d d df         | j	        d         z  }|d d df         | j	        d         z  }t          j        ||k              d         }||         }| j        zt          | j        | j                  |d d df                  }t          | j        | j                  |d d df                  }t          j        ||k              d         }||         }t          j        |fi | j        \  }}	| j        xj        |z  c_        | j        dk    r!| j        xj        | j        j        z  c_        d S d S )NboxrK   r   r   r.   )r   capped_distancerA   	positionsrB   r\   _ts
dimensionsrK   rG   r   whererJ   getattrrU   rF   rX   rY   rE   r[   volume)
rL   pairsdistidxAidxBmask	attr_ix_a	attr_ix_brY   _s
             r   _single_framezInterRDF._single_frameS  s   /GGN#L
 
 
t  ,A;$"7"::DA;$"7"::D8DDL))!,D:D():;;E!!!Q$KHI):;;E!!!Q$KHI8I233A6D:D<::(9::qe#9L##tx6#### r   c                 |    t          t           j        t           j        t           j        t           j        d          S N)rY   r[   r1   rZ   )lookup)r   ndarray_sumndarray_meanrL   s    r   _get_aggregatorzInterRDF._get_aggregatoro  s;    %1*6$0%2	 
 
 
 	
r   c                    | j         }| j        dv rFt          j        | j        j        d          }|dt          j        z  t          j        |          z  z  }| j        dk    rvt          | j	                  }t          | j
                  }||z  }| j        r| j        \  }}||z  }|||z  |z  z  }| j        j        | _        | j        | j         z  }	|||	z  z  }| j        j        |z  | j        _        d S )Nr.   r9      UUUUUU?r.   )n_framesrE   r   powerrX   rZ   pidiffr   rA   rB   rG   r[   rY   r.   )
rL   rE   volsnAnBNxAxBnblocksbox_vols
             r   	_concludezInterRDF._concludey  s    }9***8DL.22DEBEMBGDMM11D9TWBTWBRA $ '.Br'R"Ww&& #l5DOo5GAKD<-4r   c                 R    d}t          j        |t                     | j        j        S NzThe `edges` attribute was deprecated in MDAnalysis 2.0.0 and will be removed in MDAnalysis 3.0.0. Please use `results.bins` insteadwarningswarnDeprecationWarningrX   rZ   rL   wmsgs     r   rZ   zInterRDF.edges  ,    % 	
 	d.///|!!r   c                 R    d}t          j        |t                     | j        j        S NzThe `count` attribute was deprecated in MDAnalysis 2.0.0 and will be removed in MDAnalysis 3.0.0. Please use `results.bins` insteadr   r   r   rX   rY   r   s     r   rY   zInterRDF.count  r   r   c                 R    d}t          j        |t                     | j        j        S NzThe `bins` attribute was deprecated in MDAnalysis 2.0.0 and will be removed in MDAnalysis 3.0.0. Please use `results.bins` insteadr   r   r   rX   r1   r   s     r   r1   zInterRDF.bins  ,    % 	
 	d.///|  r   c                 R    d}t          j        |t                     | j        j        S NzThe `rdf` attribute was deprecated in MDAnalysis 2.0.0 and will be removed in MDAnalysis 3.0.0. Please use `results.rdf` insteadr   r   r   rX   r.   r   s     r   r.   zInterRDF.rdf  ,    $ 	
 	d.///|r   )r+   r,   r.   NNr$   )__name__
__module____qualname____doc__classmethodr)   %_analysis_algorithm_is_parallelizabler>   r]   rp   rw   r   propertyrZ   rY   r1   r.   __classcell__rQ   s   @r   r!   r!   z   s*       N N` 
 
 [
 -1) - - - - - -^7 7 77 7 78
 
 
5 5 54 " " X" " " X" ! ! X!     X         r   r!   c                        e Zd ZdZed             ZdZd Z	 	 	 	 	 d fd
	Zd Z	d Z
d Zd Zed             Zed             Zed             Zed             Zed             Z xZS )
InterRDF_sa  Site-specific radial distribution function

    Calculates site-specific radial distribution
    functions. Instead of two groups of atoms it takes as input a list of
    pairs of AtomGroup, ``[[A, B], [C, D], ...]``. Given the same ``A`` and
    ``B`` to
    :class:`InterRDF_s`, the output will be a list of individual RDFs between
    ``A1`` and ``B1``, ``A1`` and ``B2``, ``A2`` and ``B1``, ``A2`` and ``B2``
    (and
    similarly for ``C`` and ``D``). These site-specific radial distribution
    functions are typically calculated if one is interested in the solvation
    shells of a ligand in a binding site or the solvation of specific residues
    in a protein.

    Parameters
    ----------
    u : Universe
        a Universe that contains atoms in `ags`

       .. deprecated:: 2.3.0
           This parameter is superflous and will be removed in
           MDAnalysis 3.0.0.

    ags : list
        a list of pairs of :class:`~MDAnalysis.core.groups.AtomGroup`
        instances
    nbins : int
        Number of bins in the histogram
    range : tuple or list
        The size of the RDF
    norm : str, {'rdf', 'density', 'none'}
        For 'rdf' calculate :math:`g_{ab}(r)`. For
        'density' the :ref:`single particle density<equation-nab>`
        :math:`n_{ab}(r)` is computed. 'none' computes the number of
        particles occurences in each spherical shell.

        .. versionadded:: 2.3.0

    density : bool
        `False`: calculate :math:`g_{ab}(r)`; `True`: calculate
        the true :ref:`single particle density<equation-nab>`
        :math:`n_{ab}(r)`. `density` overwrites the `norm` parameter.

        .. versionadded:: 1.0.1

            This keyword was available since 0.19.0 but was not
            documented. Furthermore, it had the opposite
            meaning. Since 1.0.1 it is officially supported as
            documented.

        .. deprecated:: 2.3.0
            Instead of `density=True` use `norm='density'`

    backend : {'serial', 'OpenMP', 'distopia'}, optional
        Keyword selecting the type of acceleration of the distance calculations.
        Default is 'serial'.

        .. versionadded:: 2.10.0

    Attributes
    ----------
    results.bins : numpy.ndarray
        :class:`numpy.ndarray` of the centers of the `nbins` histogram
        bins; all individual site-specific RDFs have the same bins.

        .. versionadded:: 2.0.0

    bins : numpy.ndarray
        Alias to the :attr:`results.bins` attribute.

        .. deprecated:: 2.0.0
            This attribute will be removed in 3.0.0.
            Use :attr:`results.bins` instead.

    results.edges : numpy.ndarray
        array of the ``nbins + 1`` edges of the histogram
        bins; all individual site-specific RDFs have the same bins.

        .. versionadded:: 2.0.0

    edges : numpy.ndarray
        Alias to the :attr:`results.edges` attribute.

        .. deprecated:: 2.0.0
            This attribute will be removed in 3.0.0.
            Use :attr:`results.edges` instead.

    results.rdf : list
        :class:`list` of the site-specific :ref:`radial distribution
        functions<equation-gab>` if `norm='rdf'` or :ref:`density
        functions<equation-nab>` for the :attr:`bins`
        if `norm='density'`. The list contains
        ``len(ags)`` entries. Each entry for the ``i``-th pair `[A, B]
        = ags[i]` in `ags` is a :class:`numpy.ndarray` with shape
        ``(len(A), len(B))``, i.e., a stack of RDFs. For example,
        ``results.rdf[i][0, 2]`` is the RDF between atoms ``A[0]``
        and ``B[2]``.

        .. versionadded:: 2.0.0

    rdf : list
        Alias to the :attr:`results.rdf` attribute.

        .. deprecated:: 2.0.0
            This attribute will be removed in 3.0.0.
            Use :attr:`results.rdf` instead.

    results.count : list
        :class:`list` of the site-specific radial histograms, i.e., the
        raw counts, for all :attr:`results.bins`. The data have the same
        structure as :attr:`results.rdf` except that the arrays contain
        the raw counts.

        .. versionadded:: 2.0.0

    count : list
        Alias to the :attr:`results.count` attribute.

        .. deprecated:: 2.0.0
            This attribute will be removed in 3.0.0.
            Use :attr:`results.count` instead.

    results.cdf : list
        :class:`list` of the site-specific :ref:`cumulative
        counts<equation-countab>`, for all :attr:`results.bins`. The data
        have the same structure as :attr:`results.rdf` except that the arrays
        contain the cumulative counts.

        This attribute only exists after :meth:`get_cdf` has been run.

        .. versionadded:: 2.0.0

    cdf : list
        Alias to the :attr:`results.cdf` attribute.

        .. deprecated:: 2.0.0
            This attribute will be removed in 3.0.0.
            Use :attr:`results.cdf` instead.

    Example
    -------
    First create the :class:`InterRDF_s` object, by supplying one Universe and
    one list of pairs of AtomGroups, then use the :meth:`~InterRDF_s.run`
    method::

      from MDAnalysisTests.datafiles import GRO_MEMPROT, XTC_MEMPROT
      u = mda.Universe(GRO_MEMPROT, XTC_MEMPROT)

      s1 = u.select_atoms('name ZND and resid 289')
      s2 = u.select_atoms('(name OD1 or name OD2) and resid 51 and sphzone 5.0 (resid 289)')
      s3 = u.select_atoms('name ZND and (resid 291 or resid 292)')
      s4 = u.select_atoms('(name OD1 or name OD2) and sphzone 5.0 (resid 291)')
      ags = [[s1, s2], [s3, s4]]

      rdf = InterRDF_s(u, ags)
      rdf.run()

    Results are available through the :attr:`results.bins`
    and :attr:`results.rdf` attributes::

      plt.plot(rdf.results.bins, rdf.results.rdf[0][0, 0])

    (Which plots the rdf between the first atom in ``s1`` and the first atom in
    ``s2``)

    To generate the *cumulative distribution function* (cdf) in the sense of
    "particles within radius :math:`r`", i.e., :math:`N_{ab}(r)`, use the
    :meth:`~InterRDF_s.get_cdf` method ::

      cdf = rdf.get_cdf()

    Results are available through the :attr:`results.cdf` attribute::

      plt.plot(rdf.results.bins, rdf.results.cdf[0][0, 0])

    (Which plots the cdf between the first atom in ``s1`` and the first atom in
    ``s2``)


    .. versionadded:: 0.19.0

    .. versionchanged:: 1.0.0
       Support for the `start`, `stop`, and `step` keywords has been
       removed. These should instead be passed to :meth:`InterRDF_s.run`.

    .. versionchanged:: 2.0.0
       Store results as attributes `bins`, `edges`, `rdf`, `count`
       and `cdf` of the `results` attribute
       of :class:`~MDAnalysis.analysis.AnalysisBase`.

    .. versionchanged:: 2.3.0
       Introduce `norm` and `exclusion_blocks` attributes.
    .. deprecated:: 2.3.0
       Instead of `density=True` use `norm='density'`
    .. deprecated:: 2.3.0
       The `universe` parameter is superflous.
    .. versionchanged:: 2.10.0
       Enabled **parallel execution** with the ``multiprocessing`` and ``dask``
       backends; use the new method :meth:`get_supported_backends` to see all
       supported backends.
    c                     dS r#   r   r'   s    r   r)   z!InterRDF_s.get_supported_backends  r*   r   Tc                 r    t          t          t           j        t           j        t           j        d          S rr   )r   r   rt   ru   rv   s    r   rw   zInterRDF_s._get_aggregator  s8    )*6$1%2	 
 
 
 	
r   r+   r,   r.   Fr$   c                     t          t          |           j        |d         d         j        j        fi | t          j        dt                     || _        t          |          
                                | _        ||d| _        | j        dvrt          d| j         d          |r!t          j        dt                     d| _        || _        d S )	Nr   zHThe `u` attribute is superflous and will be removed in MDAnalysis 3.0.0.r0   r8   r;   r<   zThe `density` attribute was deprecated in MDAnalysis 2.3.0 and will be removed in MDAnalysis 3.0.0. Please use `norm=density` instead.r9   )r=   r   r>   r?   r@   r   r   r   agsrC   rD   rE   rF   rH   rK   )
rL   ur   rM   r   rE   r9   rK   rO   rQ   s
            r   r>   zInterRDF_s.__init__  s    	)j$(F1I)	
 	
-3	
 	
 	
 	#	
 	
 	
 IIOO%%	%*U;;96662DI 2 2 2  
  	"M #   "DIr   c                 2   t          j        dgfi | j        \  }fd| j        D             | j        _        || j        _        d|d d         |dd          z   z  | j        _        | j        dk    rd| j        _	        | j        d         d         | _
        d S )NrS   c           	          g | ]?\  }}t          j        |j        |j        t                    ft           j                   @S ))dtype)r   zerosn_atomsr   rW   )r   ag1ag2rY   s      r   r   z'InterRDF_s._prepare.<locals>.<listcomp>  sO     
 
 
S Hck3;E

;2:NNN
 
 
r   rT   r   r.   r   r   )r   rU   rF   r   rX   rY   rZ   r1   rE   r[   r\   )rL   rZ   rY   s     @r   r]   zInterRDF_s._prepare  s    |RD>>D,=>>u
 
 
 
 H
 
 
 #5":abb	#9:9&'DL#*73A6r   c                 n   t          | j                  D ]\  }\  }}t          j        |j        |j        | j        | j        j        | j                  \  }}| j	        d         }| j	        d         \  }}||z
  |z  ||z
  z  }	|	
                    t          j                  }	|	dk    |	|k     z  }
|

                    t          j                  }
|d d df         }|d d df         }| j        j        |         |||	fxx         |
z  cc<   | j        dk    r!| j        xj        | j        j        z  c_        d S d S )Nr_   r1   r   r   r   r.   )	enumerater   r   ra   rb   r\   rc   rd   rK   rF   rV   r   int64rX   rY   rE   r[   rg   )rL   r   r   r   rh   ri   rM   rminrmaxbin_indicescountsidx1sidx2ss                r   rp   zInterRDF_s._single_frame  sV   &tx00 	G 	GMAzS#3H'  KE4 %f-E*73JD$$;%/4$;?K%,,RX66K!Q&;+>?F]]28,,F!!!Q$KE!!!Q$KELq!%";<<<F<<<<9L##tx6#### r   c                 8   | j         }| j        dv rFt          j        | j        j        d          }|dt          j        z  t          j        |          z  z  }| j        dk    r&| j        j        | _        |d| j        | j         z  z  z  }g | j        _	        g | j        _
        t          | j                  D ]e\  }\  }}| j        j	                            |j	        |j	        g           | j        j
                            | j        j        |         |z             fd S )Nry   rz   r{   r.   r   )r|   rE   r   r}   rX   rZ   r~   r   r[   indicesr.   r   r   appendrY   )rL   rE   r   r   r   r   s         r   r   zInterRDF_s._conclude  s   }9***8DL.22DEBEMBGDMM11D9"l5DOA4=899D  "&tx00 	B 	BMAzSL ''ck(BCCCL##DL$6q$9D$@AAAA	B 	Br   c                     g | j         _        | j         j        D ]=}| j         j                            t	          j        |d          | j        z             >| j         j        S )a  Calculate the cumulative counts for all sites.

        This is the :ref:`cumulative count<equation-countab>` within a given
        radius, i.e., :math:`N_{ab}(r)`.

        The result is returned and also stored in the attribute
        :attr:`results.cdf`.

        Returns
        -------
        cdf : list
              list of arrays with the same structure as :attr:`results.rdf`
        r   )axis)rX   cdfrY   r   r   cumsumr|   )rL   rY   s     r   get_cdfzInterRDF_s.get_cdf  sa     \' 	N 	NEL##BIe!$<$<$<t}$LMMMM|r   c                 R    d}t          j        |t                     | j        j        S r   r   r   s     r   rZ   zInterRDF_s.edges  r   r   c                 R    d}t          j        |t                     | j        j        S r   r   r   s     r   rY   zInterRDF_s.count   r   r   c                 R    d}t          j        |t                     | j        j        S r   r   r   s     r   r1   zInterRDF_s.bins*  r   r   c                 R    d}t          j        |t                     | j        j        S r   r   r   s     r   r.   zInterRDF_s.rdf4  r   r   c                 R    d}t          j        |t                     | j        j        S )NzThe `cdf` attribute was deprecated in MDAnalysis 2.0.0 and will be removed in MDAnalysis 3.0.0. Please use `results.cdf` instead)r   r   r   rX   r   r   s     r   r   zInterRDF_s.cdf>  r   r   )r+   r,   r.   Fr$   )r   r   r   r   r   r)   r   rw   r>   r]   rp   r   r   r   rZ   rY   r1   r.   r   r   r   s   @r   r   r     sT       H HT 
 
 [
 -1)
 
 
 ) ) ) ) ) )V7 7 77 7 70B B B*     * " " X" " " X" ! ! X!     X      X         r   r   )r   r   numpyr   libr   baser   r   r   r!   r   r   r   r   <module>r      s   06 6n            , , , , , , , ,! ! !H         |      D
J  J  J  J  J  J  J  J  J  J r   