ó
Å™xTc           @   s&   d  d l  m Z d „  Z d „  Z d S(   iÿÿÿÿ(   t   divisionc         C   s¹   | j  } | |  ƒ } | | ƒ } | j ƒ  } | j ƒ  } | d k sQ | d k rp t d |  | | | f ƒ ‚ n7 | d k sˆ | d k r§ t d |  | | | f ƒ ‚ n  | d | d f S(   Ni    sJ   analyze_h_bonds: one or more atoms missing
  %s (%d atoms)
  %s (%d atoms)i   sT   analyze_h_bonds: multiple atoms matching a selection
  %s (%d atoms)
  %s (%d atoms)(   t
   iselectiont   sizet   RuntimeError(   t
   donor_selet   acceptor_selet   selection_cachet   iselt   donor_i_seqst   acceptor_i_seqst   n_donor_selt   n_acceptor_sel(    (    sM   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/secondary_structure/utils.pyt!   hydrogen_bond_from_selection_pair   s    	c         C   sÉ   | j  |  ƒ } t | ƒ d k r4 t d |  ƒ ‚ n  g  } x( | D]  } | j | | j ƒ  j ƒ qA Wt | ƒ } t | ƒ d k s‰ t ‚ t | ƒ d k r½ t d |  d j | ƒ f ƒ ‚ n | d Sd  S(   Ni    s   Empty selection '%s'i   s1   More than one residue name in selection '%s' (%s)s   , (	   R   t   lenR   t   appendt   fetch_labelst   resnamet   sett   AssertionErrort   join(   t	   resi_seleR   t   atomst   i_seqst   resnamest   i_seqt   unique_resnames(    (    sM   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/secondary_structure/utils.pyt   get_residue_name_from_selection   s    N(   t
   __future__R    R   R   (    (    (    sM   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/secondary_structure/utils.pyt   <module>   s   	