
     ic                         d Z ddlZddlmZ ddlZddlZddl	m
Z
mZ ddlmZ ddlmZmZ  G d de
          Z G d d	e
          Z G d
 de          ZdS )u  Dihedral angles analysis --- :mod:`MDAnalysis.analysis.dihedrals`
=================================================================

:Author: Henry Mull
:Year: 2018
:Copyright: Lesser GNU Public License v2.1+

.. versionadded:: 0.19.0

This module contains classes for calculating dihedral angles for a given set of
atoms or residues. This can be done for selected frames or whole trajectories.

A list of time steps that contain angles of interest is generated and can be
easily plotted if desired. For the :class:`~MDAnalysis.analysis.dihedrals.Ramachandran`
and :class:`~MDAnalysis.analysis.dihedrals.Janin` classes, basic plots can be
generated using the method :meth:`Ramachandran.plot` or :meth:`Janin.plot`.
These plots are best used as references, but they also allow for user customization.


See Also
--------
:func:`MDAnalysis.lib.distances.calc_dihedrals()`
   function to calculate dihedral angles from atom positions


Example applications
--------------------

General dihedral analysis
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The :class:`~MDAnalysis.analysis.dihedrals.Dihedral` class is useful for calculating
angles for many dihedrals of interest. For example, we can find the phi angles
for residues 5-10 of adenylate kinase (AdK). The trajectory is included within
the test data files::

   import MDAnalysis as mda
   from MDAnalysisTests.datafiles import GRO, XTC
   u = mda.Universe(GRO, XTC)

   # selection of atomgroups
   ags = [res.phi_selection() for res in u.residues[4:9]]

   from MDAnalysis.analysis.dihedrals import Dihedral
   R = Dihedral(ags).run()

The angles can then be accessed with :attr:`Dihedral.results.angles`.

Ramachandran analysis
~~~~~~~~~~~~~~~~~~~~~

The :class:`~MDAnalysis.analysis.dihedrals.Ramachandran` class allows for the
quick calculation of classical Ramachandran plots :footcite:p:`Ramachandran1963` in
the backbone :math:`phi` and :math:`psi` angles. Unlike the
:class:`~MDanalysis.analysis.dihedrals.Dihedral` class which takes a list of
`atomgroups`, this class only needs a list of residues or atoms from those
residues. The previous example can repeated with::

   u = mda.Universe(GRO, XTC)
   r = u.select_atoms("resid 5-10")

   R = Ramachandran(r).run()

Then it can be plotted using the built-in plotting method :meth:`Ramachandran.plot()`::

   import matplotlib.pyplot as plt
   fig, ax = plt.subplots(figsize=plt.figaspect(1))
   R.plot(ax=ax, color='k', marker='o', ref=True)
   fig.tight_layout()

as shown in the example :ref:`Ramachandran plot figure <figure-ramachandran>`.

.. _figure-ramachandran:

.. figure:: /images/rama_demo_plot.png
   :scale: 50 %
   :alt: Ramachandran plot

   Ramachandran plot for residues 5 to 10 of AdK, sampled from the AdK test
   trajectory (XTC). The contours in the background are the "allowed region"
   and the "marginally allowed" regions.

To plot the data yourself, the angles can be accessed using
:attr:`Ramachandran.results.angles`.

.. Note::

   The Ramachandran analysis is prone to errors if the topology contains
   duplicate or missing atoms (e.g. atoms with `altloc` or incomplete
   residues). If the topology has as an `altloc` attribute, you must specify
   only one `altloc` for the atoms with more than one (``"protein and not
   altloc B"``).


Janin analysis
~~~~~~~~~~~~~~

Janin plots :footcite:p:`Janin1978` for side chain conformations (:math:`\chi_1`
and :math:`chi_2` angles) can be created with the
:class:`~MDAnalysis.analysis.dihedrals.Janin` class. It works in the same way,
only needing a list of residues; see the :ref:`Janin plot figure
<figure-janin>` as an example.

The data for the angles can be accessed in the attribute
:attr:`Janin.results.angles`.

.. _figure-janin:

.. figure:: /images/janin_demo_plot.png
   :scale: 50 %
   :alt: Janin plot

   Janin plot for all residues of AdK, sampled from the AdK test trajectory
   (XTC). The contours in the background are the "allowed region" and the
   "marginally allowed" regions for all possible residues.

.. Note::

   The Janin analysis is prone to errors if the topology contains duplicate or
   missing atoms (e.g. atoms with `altloc` or incomplete residues). If the
   topology has as an `altloc` attribute, you must specify only one `altloc`
   for the atoms with more than one (``"protein and not altloc B"``).

   Furthermore, many residues do not have a :math:`\chi_2` dihedral and if the
   selections of residues is not carefully filtered to only include those
   residues with *both* sidechain dihedrals then a :exc:`ValueError` with the
   message *Too many or too few atoms selected* is raised.


Reference plots
~~~~~~~~~~~~~~~

Reference plots can be added to the axes for both the Ramachandran and Janin
classes using the kwarg ``ref=True`` for the :meth:`Ramachandran.plot`
and :meth:`Janin.plot` methods. The Ramachandran reference data
(:data:`~MDAnalysis.analysis.data.filenames.Rama_ref`) and Janin reference data
(:data:`~MDAnalysis.analysis.data.filenames.Janin_ref`) were made using data
obtained from a large selection of 500 PDB files, and were analyzed using these
classes :footcite:p:`Mull2018`. The allowed and marginally allowed regions of the
Ramachandran reference plot have cutoffs set to include 90% and 99% of the data
points, and the Janin reference plot has cutoffs for 90% and 98% of the data
points. The list of PDB files used for the reference plots was taken from
:footcite:p:`Lovell2003` and information about general Janin regions was taken from
:footcite:p:`Janin1978`.



Analysis Classes
----------------

.. autoclass:: Dihedral
   :members:
   :inherited-members:

   .. attribute:: results.angles

       Contains the time steps of the angles for each atomgroup in the list as
       an ``n_frames×len(atomgroups)`` :class:`numpy.ndarray` with content
       ``[[angle 1, angle 2, ...], [time step 2], ...]``.

       .. versionadded:: 2.0.0

   .. attribute:: angles

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

       .. deprecated:: 2.0.0
          Will be removed in MDAnalysis 3.0.0. Please use
          :attr:`results.angles` instead.


.. autoclass:: Ramachandran
   :members:
   :inherited-members:

   .. attribute:: results.angles

       Contains the time steps of the :math:`\phi` and :math:`\psi` angles for
       each residue as an ``n_frames×n_residues×2`` :class:`numpy.ndarray` with
       content ``[[[phi, psi], [residue 2], ...], [time step 2], ...]``.

       .. versionadded:: 2.0.0

   .. attribute:: angles

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

       .. deprecated:: 2.0.0
          Will be removed in MDAnalysis 3.0.0. Please use
          :attr:`results.angles` instead.


.. autoclass:: Janin
   :members:
   :inherited-members:

   .. attribute:: results.angles

       Contains the time steps of the :math:`\chi_1` and :math:`\chi_2` angles
       for each residue as an ``n_frames×n_residues×2`` :class:`numpy.ndarray`
       with content ``[[[chi1, chi2], [residue 2], ...], [time step 2], ...]``.

       .. versionadded:: 2.0.0

   .. attribute:: angles

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

       .. deprecated:: 2.0.0
          Will be removed in MDAnalysis 3.0.0. Please use
          :attr:`results.angles` instead.


References
----------

.. footbibliography::

    N)AnalysisBaseResultsGroup)calc_dihedrals)Rama_ref	Janin_refc                   j     e Zd ZdZdZed             Z fdZd Zd Z	d Z
d Zed	             Z xZS )
Dihedrala  Calculate dihedral angles for specified atomgroups.

    Dihedral angles will be calculated for each atomgroup that is given for
    each step in the trajectory. Each :class:`~MDAnalysis.core.groups.AtomGroup`
    must contain 4 atoms.

    Note
    ----
    This class takes a list as an input and is most useful for a large
    selection of atomgroups. If there is only one atomgroup of interest, then
    it must be given as a list of one atomgroup.


    .. versionchanged:: 2.0.0
       :attr:`angles` results are now stored in a
       :class:`MDAnalysis.analysis.base.Results` instance.
    .. versionchanged:: 2.8.0
       introduced :meth:`get_supported_backends` allowing for parallel
       execution on ``multiprocessing`` and ``dask`` backends.
    Tc                     dS N)serialmultiprocessingdask clss    g/srv/www/vhosts/g4struct/public_html/venv/lib/python3.11/site-packages/MDAnalysis/analysis/dihedrals.pyget_supported_backendszDihedral.get_supported_backends      
 
    c                     t          t          |           j        |d         j        j        fi | || _        t          d |D                       rt          d          t          j	        d |D                       | _
        t          j	        d |D                       | _        t          j	        d |D                       | _        t          j	        d |D                       | _        dS )	a-  Parameters
        ----------
        atomgroups : list[AtomGroup]
            a list of :class:`~MDAnalysis.core.groups.AtomGroup` for which
            the dihedral angles are calculated

        Raises
        ------
        ValueError
            If any atomgroups do not contain 4 atoms

        r   c                 4    g | ]}t          |          d k    S )   )len.0ags     r   
<listcomp>z%Dihedral.__init__.<locals>.<listcomp>/  s"    222B1222r   z#All AtomGroups must contain 4 atomsc                     g | ]
}|d          S )r   r   r   s     r   r   z%Dihedral.__init__.<locals>.<listcomp>2      !=!=!=B"Q%!=!=!=r   c                     g | ]
}|d          S    r   r   s     r   r   z%Dihedral.__init__.<locals>.<listcomp>3  r   r   c                     g | ]
}|d          S )   r   r   s     r   r   z%Dihedral.__init__.<locals>.<listcomp>4  r   r   c                     g | ]
}|d          S )   r   r   s     r   r   z%Dihedral.__init__.<locals>.<listcomp>5  r   r   N)superr	   __init__universe
trajectory
atomgroupsany
ValueErrormda	AtomGroupag1ag2ag3ag4)selfr+   kwargs	__class__s      r   r(   zDihedral.__init__  s     	'h&qM"-	
 	
17	
 	
 	
 %22z22233 	DBCCC=!=!=*!=!=!=>>=!=!=*!=!=!=>>=!=!=*!=!=!=>>=!=!=*!=!=!=>>r   c                     g | j         _        d S Nresultsanglesr4   s    r   _preparezDihedral._prepare7       r   c                 :    t          dt           j        i          S Nr;   )lookupr   ndarray_vstackr<   s    r   _get_aggregatorzDihedral._get_aggregator:      Hl.I#JKKKKr   c                     t          | j        j        | j        j        | j        j        | j        j        | j        j                  }| j        j        	                    |           d S )Nbox)
r   r0   	positionsr1   r2   r3   
dimensionsr:   r;   append)r4   angles     r   _single_framezDihedral._single_frame=  s_    HHHH#
 
 
 	""5)))))r   c                 z    t          j        t          j        | j        j                            | j        _        d S r8   nprad2degarrayr:   r;   r<   s    r   	_concludezDihedral._concludeG  +     j$,2E)F)FGGr   c                 R    d}t          j        |t                     | j        j        S NzThe `angle` attribute was deprecated in MDAnalysis 2.0.0 and will be removed in MDAnalysis 3.0.0. Please use `results.angles` insteadwarningswarnDeprecationWarningr:   r;   r4   wmsgs     r   r;   zDihedral.anglesJ  ,    ' 	
 	d.///|""r   )__name__
__module____qualname____doc__%_analysis_algorithm_is_parallelizableclassmethodr   r(   r=   rD   rM   rS   propertyr;   __classcell__r6   s   @r   r	   r	      s         * -1)
 
 [
? ? ? ? ?4! ! !L L L* * *H H H # # X# # # # #r   r	   c                   |     e Zd ZdZdZed             Z	 	 	 	 d fd	Zd Zd	 Z	d
 Z
d ZddZed             Z xZS )Ramachandrana
  Calculate :math:`\phi` and :math:`\psi` dihedral angles of selected
    residues.

    :math:`\phi` and :math:`\psi` angles will be calculated for each residue
    corresponding to `atomgroup` for each time step in the trajectory. A
    :class:`~MDAnalysis.ResidueGroup` is generated from `atomgroup` which is
    compared to the protein to determine if it is a legitimate selection.

    Parameters
    ----------
    atomgroup : AtomGroup or ResidueGroup
        atoms for residues for which :math:`\phi` and :math:`\psi` are
        calculated
    c_name : str (optional)
        name for the backbone C atom
    n_name : str (optional)
        name for the backbone N atom
    ca_name : str (optional)
        name for the alpha-carbon atom
    check_protein : bool (optional)
        whether to raise an error if the provided atomgroup is not a
        subset of protein atoms

    Example
    -------
    For standard proteins, the default arguments will suffice to run a
    Ramachandran analysis::

        r = Ramachandran(u.select_atoms('protein')).run()

    For proteins with non-standard residues, or for calculating dihedral
    angles for other linear polymers, you can switch off the protein checking
    and provide your own atom names in place of the typical peptide backbone
    atoms::

        r = Ramachandran(u.atoms, c_name='CX', n_name='NT', ca_name='S',
                         check_protein=False).run()

    The above analysis will calculate angles from a "phi" selection of
    CX'-NT-S-CX and "psi" selections of NT-S-CX-NT'.

    Raises
    ------
    ValueError
        If the selection of residues is not contained within the protein
        and ``check_protein`` is ``True``

    Note
    ----
    If ``check_protein`` is ``True`` and the residue selection is beyond
    the scope of the protein and, then an error will be raised.
    If the residue selection includes the first or last residue,
    then a warning will be raised and they will be removed from the list of
    residues, but the analysis will still run. If a :math:`\phi` or :math:`\psi`
    selection cannot be made, that residue will be removed from the analysis.


    .. versionchanged:: 1.0.0
        added c_name, n_name, ca_name, and check_protein keyword arguments
    .. versionchanged:: 2.0.0
       :attr:`angles` results are now stored in a
       :class:`MDAnalysis.analysis.base.Results` instance.
    .. versionchanged:: 2.8.0
       introduced :meth:`get_supported_backends` allowing for parallel
       execution on ``multiprocessing`` and ``dask`` backends.
    Tc                     dS r   r   r   s    r   r   z#Ramachandran.get_supported_backends  r   r   CNCAc                 b    t          t          |           j        |j        j        fi | || _        | j        j        }|r| j        j                            d          j        }|                    |          st          d          |
                    |ddg                   s1t          j        d           |                    |ddg                   }|                                }	|                                }
t!          j        d |	D                       }|t!          j        d |
D                       z  }t!          j        |          st          j        d           t'          |	|                   }	t'          |
|                   }
||         }fd	|	D             }|gfd
|D             }fd|
D             }t!          j        |          t!          j        |          z  t!          j        |          z  }|	|         }	||         }|
|         }
|j        j        |	j        |	j        j        k             | _        |j        k             | _        |j        |k             | _        |j        k             | _        |
j        |
j        j        k             | _        d S )NproteinznFound atoms outside of protein. Only atoms inside of a 'protein' selection can be used to calculate dihedrals.r   zBCannot determine phi and psi angles for the first or last residuesc                     g | ]}|d uS r8   r   r   rs     r   r   z)Ramachandran.__init__.<locals>.<listcomp>  s    5551$555r   c                     g | ]}|d uS r8   r   rq   s     r   r   z)Ramachandran.__init__.<locals>.<listcomp>  s    ;;;!;;;r   z<Some residues in selection do not have phi or psi selectionsc                 R    g | ]#}t          |j        j        k              d k    $S r!   sumatomsnames)r   rr   c_names     r   r   z)Ramachandran.__init__.<locals>.<listcomp>  s/    EEE1S&011Q6EEEr   c                 H    g | ]t          fd D                       S )c              3   Z   K   | ]%}t          j        j        |k              d k    V  &dS )r"   Nru   )r   nrr   s     r   	<genexpr>z3Ramachandran.__init__.<locals>.<listcomp>.<genexpr>  s9      ==AGMQ&''1,======r   )all)r   rr   rnamess    @r   r   z)Ramachandran.__init__.<locals>.<listcomp>  sD     
 
 
BCC====f=====
 
 
r   c                 R    g | ]#}t          |j        j        k              d k    $S r!   ru   )r   rr   n_names     r   r   z)Ramachandran.__init__.<locals>.<listcomp>  s/    DDD1S&011Q6DDDr   )r'   rh   r(   r)   r*   	atomgroupresiduesselect_atomsissubsetr-   
isdisjointrX   rY   
difference_get_prev_residues_by_resid_get_next_residues_by_residrP   rR   r~   rv   rw   rx   r0   r1   r2   r3   ag5)r4   r   ry   r   ca_namecheck_proteinr5   r   rn   prevnxtkeep	keep_prevkeep_res	keep_nextresr   r6   s     ``            @r   r(   zRamachandran.__init__  s    	+lD!!*)	
 	
-3	
 	
 	
 #>* 	An-::9EENG$$W-- A +  
 ((!R)9:: A'   $..w2w/?@@33552244x5555566bh;;s;;;<<<vd|| 	M(   4:#d)nnD> FEEEEEE	&'*
 
 
 
GO
 
 
 EDDDDDD	 x	""RXh%7%77"(9:M:MMDztn$i:dj.&899Vv-.9Vw./9Vv-.9SY_67r   c                     g | j         _        d S r8   r9   r<   s    r   r=   zRamachandran._prepare  r>   r   c                 :    t          dt           j        i          S r@   rB   r<   s    r   rD   zRamachandran._get_aggregator  rE   r   c                    t          | j        j        | j        j        | j        j        | j        j        | j        j                  }t          | j        j        | j        j        | j        j        | j        j        | j        j                  }d t          ||          D             }| j	        j
                            |           d S )NrG   c                     g | ]	\  }}||f
S r   r   )r   phipsis      r   r   z.Ramachandran._single_frame.<locals>.<listcomp>  s     JJJ(#sC:JJJr   )r   r0   rI   r1   r2   r3   rJ   r   zipr:   r;   rK   )r4   
phi_angles
psi_anglesphi_psis       r   rM   zRamachandran._single_frame  s    #HHHH#
 
 

 $HHHH#
 
 

 KJc*j.I.IJJJ""7+++++r   c                 z    t          j        t          j        | j        j                            | j        _        d S r8   rO   r<   s    r   rS   zRamachandran._conclude  rT   r   NFc                    |t          j                    }|                    g d           |                    ddd           |                    ddd           |                    t          ddd	          t          ddd	          d
d           t           j        j        	                    d          }|j
                            |           |j                            |           |ryt          j        t          j        ddd          t          j        ddd                    \  }}g d}ddg}|                    ||t          j        t$                    ||           | j        j                            t          j        | j        j        j        dd                   d          }	 |j        |	dddf         |	dddf         fi | |S )a  Plots data into standard Ramachandran plot.

        Each time step in :attr:`Ramachandran.results.angles` is plotted onto
        the same graph.

        Parameters
        ----------
        ax : :class:`matplotlib.axes.Axes`
              If no `ax` is supplied or set to ``None`` then the plot will
              be added to the current active axes.

        ref : bool, optional
              Adds a general Ramachandran plot which shows allowed and
              marginally allowed regions

        kwargs : optional
              All other kwargs are passed to :func:`matplotlib.pyplot.scatter`.

        Returns
        -------
        ax : :class:`matplotlib.axes.Axes`
             Axes with the plot, either `ax` or the current axes.

        N)L   r   r   r   kr"   colorlwr      <   z$\phi$z$\psi$xticksyticksxlabelylabel{x:g}$\degree$r   r   )r"      i:  #A1D4FF#35A1FFlevelscolorsr$   )pltgcaaxisaxhlineaxvlinesetrange
matplotlibtickerStrMethodFormatterxaxisset_major_formatteryaxisrP   meshgridarangecontourfloadr   r:   r;   reshapeprodshapescatter
r4   axrefr5   degree_formatterXYr   r   as
             r   plotzRamachandran.plot   s   2 :B
&&&'''


1CA
&&&


1CA
&&&
sB''sB''	 	 	
 	
 	
 >0CC
 
 	$$%5666
$$%5666 	O;	$Q''4a)@)@ DAq $^^F+FKK1bgh//vKNNNL''GDL'-bqb122A
 
 	
1QQQT7AaaadG..v...	r   c                 R    d}t          j        |t                     | j        j        S rV   rW   r[   s     r   r;   zRamachandran.angles7  r]   r   )rj   rk   rl   TNF)r^   r_   r`   ra   rb   rc   r   r(   r=   rD   rM   rS   r   rd   r;   re   rf   s   @r   rh   rh   U  s        A AF -1)
 
 [
 @8 @8 @8 @8 @8 @8D! ! !L L L, , ,$H H H5 5 5 5n # # X# # # # #r   rh   c                   6     e Zd ZdZ	 	 d	 fd	Zd Zd
dZ xZS )Janina  Calculate :math:`\chi_1` and :math:`\chi_2` dihedral angles of selected
    residues.

    :math:`\chi_1` and :math:`\chi_2` angles will be calculated for each residue
    corresponding to `atomgroup` for each time step in the trajectory. A
    :class:`~MDAnalysis.ResidueGroup` is generated from `atomgroup` which is
    compared to the protein to determine if it is a legitimate selection.

    Note
    ----
    If the residue selection is beyond the scope of the protein, then an error
    will be raised. If the residue selection includes the residues ALA, CYS*,
    GLY, PRO, SER, THR, or VAL (the default of the `select_remove` keyword
    argument) then a warning will be raised and they will be removed from the
    list of residues, but the analysis will still run. Some topologies have
    altloc attributes which can add duplicate atoms to the selection and must
    be removed.

    $resname ALA CYS* GLY PRO SER THR VALrn   c                 x     t          t                     j        |j        j        fi | | _        |j        }|                    |          j        }|j                            |          j        }|	                    |          st          d| d          t          |          dk    r-t          j        d| d           |                    |          }|j                            d           _        |j                            d           _        |j                            d           _        |j                            d	           _        |j                            d
           _        t)           fd j         j         j         j        fD                       rt          d          dS )a  Parameters
        ----------
        atomgroup : AtomGroup or ResidueGroup
            atoms for residues for which :math:`\chi_1` and :math:`\chi_2` are
            calculated

        select_remove : str
            selection string to remove residues that do not have :math:`chi_2`
            angles

        select_protein : str
            selection string to subselect protein-only residues from
            `atomgroup` to check that only amino acids are selected; if you
            have non-standard amino acids then adjust this selection to include
            them

        Raises
        ------
        ValueError
             if the final selection of residues is not contained within the
             protein (as determined by
             ``atomgroup.select_atoms(select_protein)``)

        ValueError
             if not enough or too many atoms are found for a residue in the
             selection, usually due to missing atoms or alternative locations,
             or due to non-standard residues


        .. versionchanged:: 2.0.0
           `select_remove` and `select_protein` keywords were added.
           :attr:`angles` results are now stored in a
           :class:`MDAnalysis.analysis.base.Results` instance.
        zPFound atoms outside of protein. Only atoms inside of a protein (select_protein='z&') can be used to calculate dihedrals.r   zAll residues selected with 'z'' have been removed from the selection.zname Nzname CAzname CBzname CG CG1zname CD CD1 OD1 ND1 SDc              3   b   K   | ])}t          j                  t          |          k    V  *d S r8   )r   r0   )r   r   r4   s     r   r}   z!Janin.__init__.<locals>.<genexpr>  sJ       
 
 MMSWW$
 
 
 
 
 
r   zUToo many or too few atoms selected. Check for missing or duplicate atoms in topology.N)r'   rh   r(   r)   r*   r   r   r   rw   r   r-   r   rX   rY   r   r0   r1   r2   r3   r   r,   )	r4   r   select_removeselect_proteinr5   r   rn   remover6   s	   `       r   r(   zJanin.__init__W  s   R 	+lD!!*)	
 	
-3	
 	
 	
 #%((88A,,];;D  )) 	3/$2/ / /   [[AM8} 8 8 8    **622H>..x88>..y99>..y99>..}==>../GHH
  
 
 
 
x48TX>
 
 
 
 
 	 :  		 	r   c                     t          j        t          j        | j        j                            dz   dz  | j        _        d S )Nh  rO   r<   s    r   rS   zJanin._conclude  s8    Jrx 34455;r   NFc                    |t          j                    }|                    g d           |                    ddd           |                    ddd           |                    t          ddd	          t          ddd	          d
d           t           j        j        	                    d          }|j
                            |           |j                            |           |ryt          j        t          j        ddd          t          j        ddd                    \  }}g d}ddg}|                    ||t          j        t$                    ||           | j        j                            t          j        | j        j        j        dd                   d          }	 |j        |	dddf         |	dddf         fi | |S )a  Plots data into standard Janin plot.

        Each time step in :attr:`Janin.results.angles` is plotted onto the
        same graph.

        Parameters
        ----------
        ax : :class:`matplotlib.axes.Axes`
              If no `ax` is supplied or set to ``None`` then the plot will
              be added to the current active axes.

        ref : bool, optional
              Adds a general Janin plot which shows allowed and marginally
              allowed regions

        kwargs : optional
              All other kwargs are passed to :func:`matplotlib.pyplot.scatter`.

        Returns
        -------
        ax : :class:`matplotlib.axes.Axes`
             Axes with the plot, either `ax` or the current axes.

        N)r   r   r   r   r   r   r"   r   r   ii  r   z$\chi_1$z$\chi_2$r   r   r      )r"   r   iX  r   r   r   r$   )r   r   r   r   r   r   r   r   r   r   r   r   r   rP   r   r   r   r   r   r:   r;   r   r   r   r   r   s
             r   r   z
Janin.plot  s   2 :B
   !!!


3ca
(((


3ca
(((
C$$C$$	 	 	
 	
 	
 >0CC
 
 	$$%5666
$$%5666 	P;ryC33RYq#q5I5IJJDAq [[F+FKK1bgi00KOOOL''GDL'-bqb122A
 
 	
1QQQT7AaaadG..v...	r   )r   rn   r   )r^   r_   r`   ra   r(   rS   r   re   rf   s   @r   r   r   B  sy         . = 	O O O O O Ob  
3 3 3 3 3 3 3 3r   r   )ra   numpyrP   matplotlib.pyplotpyplotr   rX   
MDAnalysisr.   MDAnalysis.analysis.baser   r   MDAnalysis.lib.distancesr   "MDAnalysis.analysis.data.filenamesr   r   r	   rh   r   r   r   r   <module>r      s-  .Z Zv                ? ? ? ? ? ? ? ? 3 3 3 3 3 3 B B B B B B B BU# U# U# U# U#| U# U# U#pj# j# j# j# j#< j# j# j#Z^ ^ ^ ^ ^L ^ ^ ^ ^ ^r   