ó
Ô™xTc           @   s-  d  d l  m Z d  d l m Z d  d l Z d  d l m Z d  d l m Z d  d l	 m
 Z
 m Z d  d l m Z m Z d  d l m Z d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ e d „ Z d „  Z d „  Z d „  Z d d „ Z d „  Z e d d d e e d d „ Z d „  Z d e d d „ Z d S(   iÿÿÿÿ(   t   division(   t   get_atom_selectionsN(   t   flex(   t   lbfgs(   t   format_valuet   make_sub_header(   t   Sorryt   null_out(   t   adopt_init_argst   managerc           B   s5   e  Z d  d d d d e d „ Z d „  Z d „  Z RS(   i   i   c	         C   sÑ  |  j  d | d | d d ƒ | j d | j d t ƒ | j j }	 | r| j j ƒ  }
 g  } x  |	 D]˜ } g  } xg | D]_ } t j ƒ  } x( | D]  } |
 | s� | j	 | ƒ q� q� W| j
 ƒ  d k rv | j	 | ƒ qv qv Wt | ƒ d k rc | j	 | ƒ qc qc W| }	 n  t |	 ƒ d k rÍt j ƒ  } x, |	 D]$ } x | D] } | j | ƒ q:Wq-W| j ƒ  j j ƒ  j d t ƒ | j ƒ  j j ƒ  j d	 | ƒ | j ƒ  j j d
 | d | d | ƒ | j ƒ  j j ƒ  } t j ƒ  } | j ƒ  j ƒ  } g  } d } xn |	 D]f } g  } xJ | D]B } | j	 | ƒ | d 7} t j | j | ƒ ƒ } | j	 | ƒ qW| j	 | ƒ qþWd  } x¾ t | ƒ D]° } | d  k	 r™| j } n  t d | d |	 d | d | d | ƒ } | d  k	 rØ| j } n  t d | j ƒ  j d | d |	 d | d k ƒ | j ƒ  j j d
 | d | d | ƒ q{W| j ƒ  j } | | _ | j d | d t ƒ | j ƒ  j ƒ  j | ƒ } t j | ƒ | k s“t ‚ t j | ƒ | k s®t ‚ |  j  d | d | d d ƒ n  d  S(   Nt   fmodelst   logt   messages   occupancy refinement: startt   xray_structuret   update_f_calci    t   statet
   iselectiont   occ_maxt   occ_mint	   selectioni   t
   selectionst   constrained_groups_selectionst   par_initialt   max_number_of_iterationst
   parameterst   enforce_positivitys   occupancy refinement: end(    t   showt   update_xray_structureR   t   Truet   refinement_flagst   s_occupanciest   hd_selectionR   t   size_tt   appendt   sizet   lent   extendt   fmodel_xrayt
   scattererst   flags_set_gradst   Falset   flags_set_grad_occupancyt   adjust_occupancyt   deep_copy_scattererst   doublet   extract_occupanciest   meant   selectt   Nonet   xranget   par_mint	   minimizert   set_refinable_parameterst   mint   AssertionErrort   max(   t   selfR
   t   modelR   t   number_of_macro_cyclest   occupancy_maxt   occupancy_minR   t
   exclude_hdR   t   hd_selt   tmp_selt   selt   tmp_sel_t   sel_t	   tmp_sel__t   sel__t   i_selectiont   st   sst   xray_structure_dcR   t   occupanciesR   t   group_countert   valt	   minimizedt   macro_cyclet   xray_structure_finalt   refined_occ(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyt   __init__   s–    
	
 	 		c   
      C   sv  | d  k	 rr| d | d d t d | d ƒ d IJ| j ƒ  | j ƒ  } } | d  k	 r‚ | d d d d d d d IJn  |  j d | d	 | ƒ | d  k	 rß | d d d
 d d d
 d IJ|  j d | d	 | ƒ n  | j j ƒ  j ƒ  } t d t	 j
 | ƒ ƒ } t d t	 j | ƒ ƒ } t d | d k  j t ƒ ƒ }	 | d | | |	 f IJ| d d d d IJn  d  S(   Ns   |-t   -iO   t   |t    i$   s   X-rayt   fmodelR   i#   t   neutrons   %4.2fs   %8dgš™™™™™¹?sE   | occupancies: max = %s  min = %s   number of occupancies < 0.1: %s |iM   (   R0   R#   R%   t   fmodel_neutront   show_helperR   R&   R-   R   R   R7   R5   t   countR   (
   R8   R
   R   R   t   fm_xt   fm_nRI   R   R   t   number_small(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyR   a   s"    ,%"c   	      C   s™   t  d | j ƒ  ƒ } t  d | j ƒ  ƒ } t  d | j ƒ  ƒ } t  d | j ƒ } d | | f } d | | f } | | d d t | | ƒ | IJd  S(   Ns   %6.4fs   %-13.3fs   %ss   | r_work = %s r_free = %ss   target_work(%s) = %s |RS   iO   (   R   t   r_workt   r_freet   target_wt   target_nameR#   (	   R8   RT   R   R\   R]   t   targetR_   t   p1t   p2(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyRW   t   s    N(   t   __name__t
   __module__R0   R(   RP   R   RW   (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyR	      s   N	R3   c           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   s  t  |  t ƒ  ƒ |  j j ƒ  |  j j ƒ  d d l m } | j d d d d d d  d d d d d	 d  d
 d d d ƒ |  _ |  j	 j
 ƒ  |  _ |  j |  j ƒ |  _ |  j j ƒ  |  _ t j d |  d t j d | ƒ d t j d t d t ƒ ƒ |  _ |  j ƒ  |  ` d  S(   Niÿÿÿÿ(   t   weight_xray_chemt   wxi   t   wx_scalet   angle_xt   wnt   wn_scalet   angle_nt   wi    t   wxnt   target_evaluatort   termination_paramst   max_iterationst   exception_handling_paramst-   ignore_line_search_failed_step_at_lower_boundt-   ignore_line_search_failed_step_at_upper_bound(   R   t   localsR
   t   create_target_functorst(   prepare_target_functors_for_minimizationt   phenix.refinementRe   t   weightsR0   R   t	   deep_copyR2   t   packt   xR"   t   nR   t   runt   termination_parameterst   exception_handling_parametersR   R3   t    compute_functional_and_gradients(   R8   R
   R   R   R   R   Re   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyRP   ~   s0    				
c         C   s   t  d | d |  j ƒ S(   NR{   t   table(   t   pack_unpackR   (   R8   t   par(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyRz   �   s    c         C   s"   t  d |  j d |  j ƒ |  _ d  S(   NR{   R�   (   R‚   R{   R   R2   (   R8   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyt   unpack_x    s    c         C   s  |  j  ƒ  t d |  j j ƒ  j d |  j d |  j ƒ |  j j d t ƒ |  j j	 d |  j
 d t d t ƒ } | j ƒ  |  _ | j ƒ  } t j ƒ  } xA |  j D]6 } x- | D]% } | j t j | j | ƒ ƒ ƒ qª Wq� Wt d | d	 |  j ƒ |  _ |  j |  j f S(
   NR   R   R   R   Rx   t   compute_gradientst	   occupancyR{   R�   (   R„   R4   R
   R%   R   R2   R   R   R   t   target_and_gradientsRx   R`   t   ft	   gradientsR   R,   R!   t   sumR/   t   pack_gradientsR   t   g(   R8   t   fmodels_target_and_gradientsRŒ   t   grads_wrt_parR@   RB   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyR€   ¤   s&    
	
		'(   Rc   Rd   RP   Rz   R„   R€   (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyR3   }   s   			c         C   sE  |  j  ƒ  j ƒ  } d } x&| D]} t j ƒ  } t j ƒ  } | }	 xK | D]C }
 | |	 } | j | ƒ | d k  rƒ | j | ƒ n  |	 d 7}	 qJ W| rç | j ƒ  d k rç | t j | ƒ } t j | ƒ } | d k rç | | } qç n  xS t | ƒ D]E \ } }
 t j | t j	 |
 ƒ ƒ } |  j
 | | | ƒ | d 7} qô Wq Wd  S(   Ni    i   (   R&   R"   R   R,   R!   R5   RŠ   t	   enumeratet   boolR    t   set_occupancies(   R   R   R   R   t   szt   iR@   t   par_allt   par_negt   i_pRB   t   pt   fst   jt   sel__b(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyR4   »   s*    
 c         C   sš   |  j  ƒ  } x‡ | D] } t | ƒ d k rF | d } |  | | | <q d } x1 | d d !D]" } |  | | | <| |  | 7} qZ Wd | | | d <q W| S(   Ni   i    iÿÿÿÿg      ð?(   Ry   R#   (   R{   R�   t   resultt   indicest   i0t   xsumR“   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyR‚   Ö   s    
c         C   sà   t  j |  j ƒ  d ƒ } xÁ | D]¹ } t | ƒ d k rR | d } |  | | | <q t | ƒ d k r˜ | \ } } |  | |  | | | <|  | | | <q x/ | d d !D]  } |  | |  | d | | <q¦ Wd | | d <q W| S(   Ni    i   i   iÿÿÿÿ(   R   R,   R"   R#   (   R{   R�   R›   Rœ   R�   t   i1R“   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyR‹   ä   s    
c         C   sl   t  j | t ƒ } xS |  D]K } xB | D]: } x1 | D]) } | | rR t d ƒ ‚ n  t | | <q3 Wq& Wq W| S(   Ns$   Duplicate selection for occupancies.(   R   R�   R(   R   R   (   t   list_3dR"   R›   R“   R™   t   k(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyt   list_3d_as_bool_selection÷   s    
c   
      C   sõ   t  d |  d | ƒ } | } t | t j ƒ rB t j | | ƒ } n  | d  k	 r‰ | | k | t k @} | | k | t k @j ƒ  } | } n | | k | t k @j ƒ  } g  } x! | D] }	 | j |	 g g ƒ q² Wt	 | ƒ d k rñ |  j
 | ƒ n  |  S(   NR    R"   i    (   R¢   t
   isinstanceR   R    R�   R0   R   R   R!   R#   R$   (
   R›   R"   R   t
   hd_specialt   result_as_1d_array_bt   sel_bt
   not_commont   not_common_t   sel_checkedR“   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyt   add_occupancy_selection  s    	c         C   s  g  } x|  j  ƒ  D]} xù | j ƒ  D]ë } xâ | j ƒ  D]Ô } | j ƒ  s9 t | j ƒ  ƒ d k si t ‚ t j ƒ  } g  } x4 | j	 ƒ  D]& } | j
 | j ƒ | j
 | j ƒ qˆ W| d d k  r| d d k r| j | d ƒ r| j ƒ  d k r| j
 | g ƒ qq9 q9 Wq& Wq W| S(   Ni   i    (   t   modelst   chainst   residue_groupst   have_conformersR#   t   atom_groupsR6   R   R,   t   atomsR!   t   occt   i_seqt   all_eqR"   (   t	   hierarchyR›   R9   t   chaint   residue_groupt   occst   i_seqst   atom(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyt$   extract_partial_occupancy_selections  s    E"c	         C   sâ  | d  k	 r' t | ƒ d k r' d  } n  | d  k	 rN t | ƒ d k rN d  } n  | d  k	 ru t | ƒ d k ru d  } n  |  j j d d  d t d t ƒ }	 t j j d |  j ƒ }
 t |
 ƒ d k rå |	 d  k	 rå t d |  j d |	 ƒ n  t j j	 d |	 d	 |
 d
 | j
 ƒ  j ƒ  ƒ }	 |	 j |
 ƒ t d |  j ƒ } g  } x= | D]5 } x, | D]$ } x | D] } | j | ƒ qXWqKWq>Wt j j	 d |	 d	 | d
 | j
 ƒ  j ƒ  ƒ }	 |	 j | ƒ | j
 ƒ  j ƒ  } | d k | d k @} t d |	 d
 | j
 ƒ  j ƒ  d | d d  ƒ }	 g  } | d  k	 r%| | } n  | d  k	 r{xG | D]< } x3 | D]+ } t | j ƒ d k rE| | j } qEqEWq8Wn  t | ƒ d k rðx` | D]U } t d |  d | g d t d | d t ƒ } | j ƒ  d k r”t d | ƒ ‚ q”q”Wn  | | g j d  ƒ d k r¼t d |  d | d t d | d t ƒ } x‡ | D]| } xs | D]k } xb | j D]W } t d |  d | d t d | d t ƒ } | j | ƒ j ƒ  d k rVt d ƒ ‚ qVqVWqFWq9Wn  | d  k	 r%t d |  d | d t d | d t ƒ } | j ƒ  d k rt d ƒ ‚ n  | d  k	 rpt d |  d | d t d | d t ƒ } | j | ƒ j ƒ  d k rpt d ƒ ‚ qpn  | d  k	 rõxv | D]k } xb | j D]W } t d |  d | d t d | d t ƒ } | j | ƒ j ƒ  d k r“t d ƒ ‚ q“q“WqƒWn  t j j	 d |	 d	 | d
 | j
 ƒ  j ƒ  ƒ }	 n  | d  k	 rµt d |  d | d t d | d t ƒ } t j j	 d |	 d	 | d
 | j
 ƒ  j ƒ  ƒ }	 t d |	 d
 | j
 ƒ  j ƒ  d | d d  ƒ }	 n  | d  k	 r�xÉ | D]¾ } g  } x� | j D]‚ } t d |  d | d t d | d t ƒ } t j j	 d |	 d	 | d
 | j
 ƒ  j ƒ  ƒ }	 | j ƒ  d k rÞ| j t | ƒ ƒ qÞqÞWt | ƒ d k rÈ|	 j | ƒ qÈqÈWn  | rót d |  d d g d t d | d t d t ƒ } t d |	 d
 | j
 ƒ  j ƒ  d | d d  ƒ }	 n  t d |	 d
 | j
 ƒ  j ƒ  ƒ t |	 ƒ d k r-d  }	 n  | rÞ|	 d  k	 rÞg  } xH |	 D]@ } g  } x$ | D] } | j t j | ƒ ƒ q_W| j | ƒ qLW| }	 | rÞt |	 ƒ d k rÞt d | d |  j j ƒ  d |	 d | ƒ }	 qÞn  |	 S(   Ni    t   common_residue_name_class_onlyt   always_group_adjacentt   ignore_hydrogensR´   t   pdb_hierarchyt   cgsR   t   otherR"   g      ð?g        R›   R¤   t   all_chain_proxiest   selection_stringsR   R   t   one_selection_arrays   Empty selection: %ssW   Duplicate selection: same atoms selected for individual and group occupancy refinement.s"   Empty selection: remove_selection.sV   Duplicate selection: occupancies of same atoms selected to be fixed and to be refined.t   watert   allow_empty_selectionR    t	   pdb_atomst   constraint_groupsR   (   R0   R#   R¾   t   occupancy_groups_simpleR(   t   mmtbxt   utilst   combine_hd_exchangablet   occupancy_regrouppingt   remove_selectionsR&   R"   R$   Rº   R!   R-   Rª   R   R   R   R   RX   t   intersectiont   listR¢   R   R    t   assemble_constraint_groups_3dR°   (   RÁ   R   t	   add_watert"   other_individual_selection_stringst   other_constrained_groupst   remove_selectiont   as_flex_arrayst   constrain_correlated_3d_groupsR   R›   t   exchangable_hd_pairst   poglt   rm_duplicate_with_poglt   t_t   t__t   t___RI   R@   t   all_sel_strgst   other_constrained_groupt   sel_strt   sel_str_selt   sel1t   cg_sel_strst   sel2t   cg_selt   water_selectiont   result_t   gselt   result__(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyt   occupancy_selections#  sP   					
												 	c         C   s›  |  } t  | j ƒ  ƒ } | j ƒ  j ƒ  } t  | j ƒ  ƒ } xÆ| D]¾} xµ| D]­} | | d j } d  }	 xe | D]] }
 | |
 j ƒ  j ƒ  d k rt | |
 j	 j ƒ  j ƒ  d k rt | j ƒ  d k rt |
 }	 Pqt qt W|	 d  k	 rP d  } xP t
 | ƒ D]B \ } } | d k rô |	 | j ƒ  j ƒ  k rô | | d } Pqô qô W| d  k rLqP n  | j ƒ  j ƒ  } | j ƒ  j ƒ  } g  } xB | j ƒ  D]4 } | j	 j ƒ  j ƒ  d k rƒ| j | j ƒ qƒqƒW| g  k rÍqP n  d  } xÒ | D]Ê } x± | D]© } t | ƒ j t | ƒ ƒ } t | ƒ d k sUt | ƒ d k rç| t  | ƒ d j	 j ƒ  j ƒ  d	 k rçx8 | D]- } x$ | D] } | | k ri| } PqiqiWq\WqçqçW| d  k	 rÚPqÚqÚW| d  k rºqP n  x< | D]4 } x+ | D]# } |	 | k rÎ| j |	 ƒ PqÎqÎWqÁWt } xû | j ƒ  D]ê } | j | k r| j ƒ  j ƒ  } xÀ | D]µ } x¬ | D]¤ } t | ƒ j t | ƒ ƒ } t | ƒ d k sµt | ƒ d k rG| t  | ƒ d j	 j ƒ  j ƒ  d
 k rGx3 | D]( } | | k r¼| j |	 ƒ t } q¼q¼WqGqGWq:WqqWqP qP WqC Wxf | D]^ } x, | j d  g ƒ d k r@| j d  g ƒ qWx& | j g  ƒ d k ri| j g  ƒ qDWqWx& | j g  ƒ d k r–| j g  ƒ qqWd  S(   Ni    t   Ht   Dt    i   t   C(   Rê   Rë   (   Rê   Rë   (   Rê   Rë   (   Rê   Rë   (   RÏ   t   atoms_with_labelsR°   t   extract_elementR­   t   altlocR0   t   stript   uppert   nameR�   t   extract_i_seqR!   R²   t   setRÎ   R#   t   removeR(   t
   conformersR   RX   (   R¾   R¿   t   ht   awlt   elementst   rgst   cgt   ct   altloc_ht   indt   ind_t   rg_prevt   i_rgt   rgt   rg_prev_i_seqst	   rg_i_seqst   i_seqs_c_prevt   a_prevt   cg_prevt   cg2t   c2t   i_seqs_intert   cg2_t   i_seq_c_prevt   foundt   conformer_prevt   conformer_prev_i_seqs(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyRÌ   Ü  s�    $  )  )*g      @c   $      C   sÆ  | d k r t ƒ  } n  t d d | ƒ| d IJ| j ƒ  } |  j d | ƒ } | j ƒ  } d }	 t | ƒ }
 x|	 t | ƒ k  r‹| |	 } | d |	 d t | ƒ f IJg  } x¶t | ƒ D]¨\ } } | j | ƒ } | | d j	 ƒ  j
 } | d | t | ƒ f IJ| j | d ƒ s8t d	 d
 d d ƒ ‚ n  x+| D]#} | | j	 ƒ  } | j
 j ƒ  d k rpq?n  | | } | r d | | j ƒ  |	 d f GHn  x¿ | j ƒ  D]± \ } } |	 d } x˜ | t | ƒ k  r]t } xf | | D]Z } | | k ré| r!d | | j ƒ  | d f GHn  | j | | ƒ | | =t } PqéqéW| sÆ| d 7} qÆqÆWq­Wq?Wq¾ Wt | ƒ d k r~| d t | ƒ |	 d f IJxe| D]]} | | d } | j	 ƒ  j
 } | j ƒ  d k rót d d | j ƒ  ƒ ‚ n  x| D] } d } xñ | t | ƒ k  rù| | } | | d j	 ƒ  j
 } | | k rì| d t | ƒ | f IJ| j | ƒ } | j | ƒ } | j | d ƒ s¨| j | d ƒ rÕt d d d d | d | d f ƒ ‚ n  | j | ƒ | | =q	| d 7} q	WqúWq¡Wxy | D]n } t | ƒ d k r	xS | D]H } | | d j	 ƒ  j
 } | d d t | ƒ | f IJ| j | ƒ q(Wq	q	Wn  |	 d 7}	 qq Wt | ƒ |
 k r®| d IJxt | ƒ D]ò \ } } | d | d IJxÑ | D]É } g  }  t ƒ  }! xV | D]N } | | j ƒ  }" |" j ƒ  }# |! j |" j
 ƒ |# |  k rö|  j |# ƒ qöqöWt |! ƒ d k s`t ‚ | d t |! ƒ d t | ƒ f IJx |  D] }# | d |# IJq‹WqÚWqµWn
 | d IJ| d IJ| S(    sÉ  
  Re-sorts occupancy constraint groups so that conformers whose motion is
  correlated (i.e. they interact in 3D, without necessarily being part of
  the same fragment/molecule/ASU) are grouped together.  As input, it expects
  the constraint groups output by mmtbx.utils.occupancy_selections(), which
  will already have connectivity taken into account.  This function will exit
  with an error if the occupancies for the new groups are not consistent.
  s   Correlated occupancy groupingt   outs*  
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  !!                  WARNING - EXPERIMENTAL FEATURE                        !!
  !!                                                                        !!
  !! Grouping of occupancy constraints in 3D is experimental and not fully  !!
  !! tested.  Use at your own risk!  For bug reports, etc. contact us by    !!
  !! email at bugs@phenix-online.org.                                       !!
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
t   distance_cutoffi    s"   Constraint group %d: %d conformersi   s     conformer '%s': %d atomss,   At least one occupancy constraint group has sB   inconsistent occupancies for atoms in a single conformer.  To use s?   the automatic 3D constraints, the starting occupancies must be s   uniform within each selection.Rì   s   %s (group %d):s     %s (group %d)s*   Merging %d constraint groups with group %ds,   Atom '%s' in occupancy constraint group has s   blank altloc IDs#     combining %d atoms with altloc %ss5   Inconsistent occupancies in spatially related groups s3   (%.2f versus %.2f).  To use automatic 3D occupancy s6   restraints, the correlated conformers must start with s   the same initial occupancy.s*     warning: %d atoms with altloc %s do not s   correspond to an existing groups    New occupancy constraint groups:s     group %d:s       conformer '%s' (%d atoms):s         atom_group %ss'   Occupancy constraint groups unmodified.N(   R0   R   R   t   extract_occt   pair_asu_tablet   extract_pair_sym_tableR#   R�   R/   t   fetch_labelsRð   R³   R   Rñ   t   id_strt   itemsR(   R!   R   t   RuntimeErrorR$   Rõ   t   parentt   addR6   RÏ   ($   R   RÆ   RÇ   t   interaction_distance_cutofft   verboseR   RI   R  t   pair_sym_tableR¡   t   n_groups_startt   groupst   merge_constraintst   i_selR   R±   Rð   R²   t   labelst   pair_sym_dictt   j_seqt   sym_opst   kkt   combine_groupt   other_selectiont
   first_atomt   merge_groupst   altloc2t   occ1t   occ2t   i_groupt   constraint_groupt   residst   altlocst
   atom_groupt   ag_id(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyRÐ   &  sÈ    		

 
 
(


	

(    t
   __future__R    t   mmtbx.utilsR   RÉ   t   cctbx.array_familyR   t   scitbxR   t   libtbx.str_utilsR   R   t   libtbx.utilsR   R   t   libtbxR   t   objectR	   R3   R(   R4   R‚   R‹   R¢   R0   Rª   Rº   R   Ré   RÌ   RÐ   (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/refinement/occupancies.pyt   <module>   s4   r?			
	°	N