ó
L™xTc           @   sg  d  d l  m Z d  d l m Z d  d l m Z d  d l m Z d  d l m	 Z	 d  d l m
 Z
 d  d l m Z d  d l Z d  d l Z d  d	 l m Z d  d
 l m Z d  d l m Z d  d l Z d „  Z d „  Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d „  Z d S(   iÿÿÿÿ(   t   division(   t   flex(   t   sgtbx(   t   alternative_find_best_cell(   t   cosets(   t   crystal(   t   millerN(   t   matrix(   t   graph_tools(   t   Sorryc         C   sœ  d d d g } t  j d |  j t t ƒ ƒ } t  j d |  ƒ }  |  j ƒ  sQ t ‚ g  } t  j d ƒ j ƒ  j ƒ  } xÀ | D]¸ } t  j | ƒ } | j	 | ƒ } |  j	 | ƒ } | j
 ƒ  }	 | j
 ƒ  }
 t } t } | |
 j ƒ  j ƒ  k rñ t } n  | |	 j ƒ  j ƒ  k rt } n  | |	 | | f } | j | ƒ qy Wg  } | j | d d | d d ƒ x9 | D]1 } | d rc| d s”| j | d ƒ q”qcqcW| S(	   Ns   x,y,zs   y,z,xs   z,x,yt   groupi    i   i   i   (   R   t   space_group_infot   build_derived_groupt   Falset   is_reference_settingt   AssertionErrort   change_of_basis_opt   ct   rt   change_basist'   change_of_basis_op_to_reference_settingt   Truet   append(   t   space_groupt   cyclic_permutationst   adams_groupt   infot   identity_opt   cyclic_permutationt   cob_opt   transformed_adams_groupt   transformed_space_groupt   cob_to_ref_sgt   cob_to_ref_pgt
   adams_normt
   space_normt
   info_tuplet   possible_additional_transformst   ii(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   reference_setting_choices   s<    				!

c         C   s’   t  j d | d |  ƒ } g  } xm | j D]b } | d j ƒ  j ƒ  d k r( g  } x' | D] } | j | j ƒ  j ƒ  ƒ qW W| j | ƒ q( q( W| S(   Nt   gt   hi    (   R   t   left_decompositiont
   partitionsR   t   determinantR   t   as_hkl(   t   pg_lowt   pg_hight   cosett   full_cosetst   sett   tmpt   symop(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   coset_lookupN   s    	t   sub_super_point_group_relationsc           B   s_   e  Z e d  „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 d „ Z RS(
   c         C   s¦   | |  _  | rB | | j ƒ  k s' t ‚ | | j ƒ  k sB t ‚ n  | |  _ | |  _ g  |  _ g  |  _ g  |  _ g  |  _ g  |  _	 |  j
 | ƒ |  j ƒ  |  j ƒ  d  S(   N(   t   enforce_point_groupst   build_derived_point_groupR   t   sg_lowt   sg_hight   symopst   grouped_symopst   grouped_indext	   sg_groupst   left_over_symopst3   get_symops_from_supergroup_that_are_not_in_subgroupt   assemble_symopst   find_left_over_symops(   t   selfR9   R:   R7   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   __init__^   s    								
c         C   sŠ   t  j d | d |  j ƒ } xh | j d D]Y } |  j rn | d j ƒ  j ƒ  d k r‚ |  j j | d ƒ q‚ q) |  j j | d ƒ q) Wd  S(   NR(   R)   i   i    (	   R   R*   R9   R+   R7   R   R,   R;   R   (   RC   R:   R0   R2   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyR@   u   s    	c   
      C   s`  |  j  j ƒ  } |  j  j ƒ  } x;t |  j ƒ D]*\ } } g  } g  } t j |  j  ƒ } | j | j | | ƒ ƒ | |  j  k s† t	 ‚ | |  j
 k r. |  j
 j | ƒ | j | ƒ | j | ƒ xs t |  j ƒ D]b \ } }	 | j |	 j | | ƒ ƒ rÏ |	 | k r| j |	 ƒ n  | | k r1| j | ƒ q1qÏ qÏ W|  j j | ƒ |  j j | ƒ q. q. Wd  S(   N(   R9   t   t_dent   r_dent	   enumerateR;   R   R   t
   expand_smxt   new_denominatorsR   R>   R   t   containsR<   R=   (
   RC   RE   RF   t   itemR4   t
   tmp_symopst   tmp_indicest   check_sgt
   check_itemt   check_op(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyRA      s(    c         C   s¡   xš t  |  j |  j ƒ D]ƒ \ } } t | ƒ d k r‰ g  } x9 t |  j ƒ D]( \ } } | | k rJ | j | ƒ qJ qJ W|  j j | ƒ q |  j j g  ƒ q Wd  S(   Ni    (   t   zipR<   R>   t   lenRG   R;   R   R?   (   RC   R2   R
   t   selectRK   R4   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyRB   ¡   s    c         c   s   x |  j  D] } | Vq
 Wd  S(   N(   R<   (   RC   R2   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   return_next_set¯   s    c         c   s   x |  j  D] } | Vq
 Wd  S(   N(   R=   (   RC   t   iset(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   return_next_index³   s    c         c   s   x |  j  D] } | Vq
 Wd  S(   N(   R>   (   RC   t   sg(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   return_next_sg·   s    c         c   s   x |  j  D] } | Vq
 Wd  S(   N(   R?   (   RC   t   missing_set(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   return_next_left_over_set»   s    c         C   sa  | d  k r t j } n  | d t j d |  j ƒ IJ| d t j d |  j ƒ IJ| J| Jx t |  j |  j	 |  j
 ƒ D]ã \ } } } t | ƒ t | ƒ t |  j ƒ k s° t ‚ | d t j d | ƒ IJ| d IJx( | D]  } | d | j ƒ  j ƒ  IJqÛ W| J| d IJxA | D]9 } | d  k	 rC| d | j ƒ  j ƒ  IJq| d	 IJqW| J| Jqv Wd  S(
   Ns   Input subgroup      : %sR
   s   Input lattice group : %ss   Supergroup : %ss                Used symops:s                (%s)    s                Left over symops:s                (%s)  s                None(   t   Nonet   syst   stdoutR   R   R9   R:   RQ   R<   R>   R?   RR   R;   R   R   R-   (   RC   t   outR2   R
   t   leftoverR4   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   showÀ   s2    +

N(   t   __name__t
   __module__R   RD   R@   RA   RB   RT   RV   RX   RZ   R[   R`   (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyR6   ]   s   	
	"					t   edge_objectc           B   s8   e  Z e d  „ Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s   | |  _  | |  _ | |  _ d  S(   N(   t   symops_usedt   symops_unusedt   as_xyz(   RC   t   usedt   unusedRf   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyRD   á   s    		c         c   s   x |  j  D] } | Vq
 Wd  S(   N(   Rd   (   RC   R4   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   return_usedè   s    c         c   s   x |  j  D] } | Vq
 Wd  S(   N(   Re   (   RC   R4   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   return_unusedì   s    c         C   sŠ   t  ƒ  } | d 7} xS |  j D]H } |  j rG | d | j ƒ  d 7} q | d | j ƒ  j ƒ  d 7} q W| d t  t |  j ƒ ƒ 7} | S(   Ns	     using: t   (s   )  s     symops left: (   t   strRd   Rf   R   R-   RR   Re   (   RC   t   reprR4   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   __repr__ð   s    	
	"c         C   sŠ   t  ƒ  } | d 7} xS |  j D]H } |  j rG | d | j ƒ  d 7} q | d | j ƒ  j ƒ  d 7} q W| d t  t |  j ƒ ƒ 7} | S(   Ns	     using: Rk   s   )  s     symops left: (   Rl   Rd   Rf   R   R-   RR   Re   (   RC   Rm   R4   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   __str__û   s    	
	"(   Ra   Rb   R   RD   Ri   Rj   Rn   Ro   (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyRc   à   s
   			t   point_group_graphc           B   sD   e  Z e e d  „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   c         C   s½   | |  _  | | j ƒ  k } | r9 | s9 t d ƒ ‚ q9 n  | | j ƒ  k } | ri | si t d ƒ ‚ qi n  | |  _ t j ƒ  |  _ | |  _ | |  _ g  |  _ |  j	 ƒ  |  ` |  j j
 ƒ  d  S(   Ns"   Input spacegroup not a point group(   Rf   R8   R	   t	   assert_pgR   t   graphR.   R/   t   queuet   build_itt   assert_is_clean(   RC   R.   R/   t   enforce_point_groupRf   t   low_point_group_checkt   high_point_group_check(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyRD   	  s"    						
c         C   sR   |  j  j |  j ƒ x8 t |  j  ƒ d k rM |  j  j d ƒ } |  j | ƒ q Wd  S(   Ni    (   Rs   R   R.   RR   t   popt$   make_and_place_nodes_and_connections(   RC   t   this_sg(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyRt   +  s    c   
      C   só   t  j d | ƒ } t | ƒ } t | |  j |  j ƒ } i  } x‘ t | j ƒ  | j ƒ  | j	 ƒ  ƒ D]k \ } } } t
 d | d | d |  j ƒ }	 |	 | t t  j d | ƒ ƒ <| |  j k ra |  j j | ƒ qa qa W|  j j d | d | d | ƒ d  S(   NR
   Rg   Rh   Rf   t   nameRc   t   node_object(   R   R   Rl   R6   R/   Rq   RQ   RX   RT   RZ   Rc   Rf   Rs   R   Rr   t   insert_node(
   RC   t   input_sgt   objectR|   t   sg_relationst	   edge_listt   possible_super_sgt   used_symopst   unused_symopst   edge(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyRz   3  s(    	c   
      C   së   g  } xF |  j  j D]8 } t |  j  j | ƒ } | d k r | j | ƒ q q Wg  } xa | D]Y } |  j  j | | ƒ } x; | D]3 } x* | D]" }	 |	 | k r‹ | j |	 ƒ q‹ q‹ Wq~ Wq\ Wx | D] }	 |  j  j |	 ƒ qÀ W|  j  j ƒ  d  S(   Ni    (   Rr   t   edge_objectsRR   R   t   find_all_pathst   remove_nodeRu   (
   RC   t
   group_namet	   end_nodest
   trial_nodet   n_outt   to_be_removedt   trial_end_nodet	   tmp_pathst   pathRW   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt2   remove_point_group_and_its_super_groups_from_graphS  s    c         C   s‹   i  } x~ |  j  j D]p } xg |  j  j | D]U } | d  k	 r* | j | ƒ ro | | } | j | ƒ | | | <q | g | | <q* q* Wq W| S(   N(   Rr   t   oR[   t   has_keyR   (   RC   t   new_dictRK   t   valueR3   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   reverse_dicto  s    
c         C   sí   g  } |  j  ƒ  } | j | ƒ r. | | } n  i  } x | D] } t | | <q; Wg  } xf | D]^ } i  } | j | ƒ r„ | | } n  t }	 x- | D]% }
 |
 | k r‘ t | |
 <t } q‘ q‘ Wq\ Wx( | D]  }
 | |
 rÅ | j |
 ƒ qÅ qÅ W| S(   N(   R—   R”   R   R   R   (   RC   t   sg_namet	   subgroupst   reverse_grapht   maximalRW   t   resultt   trial_sgR3   t,   is_trial_sg_a_subgroup_of_items_in_subgroupsRK   t#   is_trial_sg_a_subgroup_of_subgroups(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   get_maximal_subgroup|  s*    

(
   Ra   Rb   R   R   RD   Rt   Rz   R’   R—   R    (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyRp     s   		 		t   find_compatible_space_groupsc           B   sY   e  Z d d d e d d  „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d d „ Z
 RS(   c      	   C   s  d  |  _ d  |  _ d  |  _ d  |  _ | d  k s< | d  k r® | d  k	 sN t ‚ | |  _ | d  k si t ‚ | |  _ | j ƒ  |  _ | j ƒ  |  _ | j ƒ  j t	 t	 ƒ |  _ n  | d  k r| d  k	 sÌ t ‚ | d  k	 sÞ t ‚ | d  k	 sð t ‚ | |  _ | |  _ | |  _ n  t
 j |  j d |  j ƒ|  _ |  j j ƒ  |  _ t j d |  j ƒ j ƒ  |  _ g  |  _ g  |  _ |  j ƒ  g  |  _ x|  j D]} t | ƒ } xû | D]ó } |  j j | |  j |  j ƒ }	 | r¤|  j |	 j ƒ  ƒ }
 |  j | ƒ } |  j |
 | ƒ } | r—t
 j d |	 j ƒ  d | d t ƒ } t | j ƒ  | j ƒ  ƒ } | j ƒ  } | j ƒ  } | | |  j |  j } |  j j | | f ƒ q—q¤q¤Wq‹Wd  |  _  |  j d  k	 rt! j" |  j j# ƒ  j$ ƒ  t	 ƒ |  _  x0 |  j D]" } | d j% ƒ  | d j& ƒ  qåWn  d  S(   NR   R
   t	   unit_cellt   assert_is_compatible_unit_celli    i   ('   R[   t   miller_arrayt   x_sgt   x_uct   x_lpgR   R   R¢   R   R   R   t   symmetryt   xst!   change_of_basis_op_to_niggli_cellt   cb_op_xs_to_niggliR   R   R   t   cb_op_lpg_to_ref_sett   point_group_compatible_sgt	   is_chiralt3   get_space_groups_compatible_with_likely_point_groupt   allowed_under_pg_and_sys_absR'   R   t   make_sys_abs_listt   compare_abs_listsR   R   t   return_best_xst&   return_change_of_basis_op_to_best_cellR   t	   full_maskR   t   boolt   datat   sizet   show_summaryRf   (   RC   t   likely_pointgroupt   xtal_sgR¢   t   sys_abs_flagR¤   RW   t   additional_cb_opst	   add_cb_opt   new_xst   current_xtal_sys_abst   trial_sg_abst   insidet   final_xst	   best_cellt	   tmp_cb_opt   final_cb_opt   xs_and_cb_op(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyRD   —  st    											
		
				
	$c           C   s   Hd  S(   N(    (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   find_absent_indicesð  s    c         C   sƒ   x| t  d d ƒ D]k } t j | ƒ j ƒ  } | j t t ƒ |  j j |  j ƒ k r |  j	 j
 | j	 ƒ  ƒ |  j j
 | ƒ q q Wd  S(   Ni   iç   (   t   xrangeR   R   R
   R   R   R§   R   R¬   R®   R   R­   (   RC   t   space_group_numbert   trial_group(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyR¯   ó  s    c         C   sv   d } t  j d ƒ j ƒ  } t j | t | ƒ j ƒ  } t j ƒ  } x- | D]% } | j	 | ƒ rI | j
 | ƒ qI qI W| S(   Ni   i   (   i   i   i   (   R   R   t   typeR   t   index_generatorR   t   to_arrayR   t   miller_indext   is_sys_absentR   (   RC   R   t	   max_indext   sg_typet   tmp_miller_listt   abs_listRÏ   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyR±   ý  s    	c         C   s0   t  } x# | D] } | | k r t } q q W| S(   N(   R   R   (   RC   t   abs_list_subt   abs_list_superRJ   t   sub_item(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyR²   	  s
    c         C   s   HHd  S(   N(    (   RC   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   full_sys_abs_mask  s    c         C   s¦   | d  k r t j } n  | d It j d |  j ƒ IJ| d I|  j j ƒ  IJ| d It j d |  j ƒ IJ| J| d IJx" |  j	 D] } | j
 | ƒ | Jq‡ Wd  S(   Ns   Input space group  : R
   s   Input unit cell    : s   Likely point group : s   Possible crystal symmetries: (   R[   R\   R]   R   R   R¥   R¦   t
   parameterst   lpgR°   R`   (   RC   R^   t   sx_cb(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyR`     s    
N(   Ra   Rb   R[   R   RD   RÈ   R¯   R±   R²   RØ   R`   (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyR¡   –  s   T		
		
	R}   c           B   s   e  Z d  „  Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   t   point_group_infot   allowed_xtal_syms(   RC   RÜ   RÝ   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyRD   +  s    	(   Ra   Rb   RD   (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyR}   *  s   t"   space_group_graph_from_cell_and_sgc           B   s5   e  Z d  d „ Z d „  Z d d „ Z d d „ Z RS(   g      @c   	      C   sh  | |  _  | |  _ | j ƒ  |  _ t j d |  j  d |  j ƒ |  _ |  j j |  j j ƒ  ƒ |  _	 |  j j |  j j ƒ  ƒ |  _
 t j j |  j
 j  ƒ  d | ƒ|  _ t |  j	 |  j ƒ |  _ t |  j	 |  j ƒ |  _ i  } xz |  j j j D]i } |  j j j | j ƒ  } t d | d |  j d |  j  ƒ } t |  j j j | | j ƒ } | | | <qè W| |  j j _ d  S(   NR¢   R   t	   max_deltaRº   R»   (   R¢   R9   R8   R.   R   R¨   t   xs_lowR   Rª   t   pg_low_prim_sett   xs_prim_setR   t   lattice_symmetryR
   R/   Rp   t   pg_graphR5   t   coset_tableRr   t   node_objectsR¡   R}   R°   (	   RC   R¢   R9   Rß   R•   t   pg_namet	   pg_objectt   tmp_allowed_sgst   new_node(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyRD   3  s8    								c         c   sd   x] |  j  j j D]L } |  j  j j | } x0 | j D]% } | d j ƒ  | d j ƒ  f Vq3 Wq Wd  S(   Ni    (   Rä   Rr   Ræ   RÝ   R   R¢   (   RC   t   pgR€   RW   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   return_likely_sg_and_celld  s    c         C   sõ  | d  k r t j } n  | d IJ| d IJ| d IJ| Jx— |  j j j D]† } | d I| Id IJt |  j j j t | ƒ ƒ d k r˜ | d IJn4 x1 |  j j j t | ƒ D] } | d I| IJq² W| JqJ W| J| J| d IJ| d	 IJ| d IJ| JxŸ |  j j j D]Ž } x… |  j j j	 | D]p } | d
 I| Id I| Id IJxA |  j j j	 | | j
 ƒ  D]" } | d I| j ƒ  j ƒ  IJqnW| Jq(WqW| J| J| d IJ| d IJ| d IJ| J| d IJ| d IJ| d IJ| Jx|  j j j D]ñ } | d | IJxÖ |  j j j | j D]¾ } | d j ƒ  } | d I| I| d | d j ƒ  j ƒ  d | d j ƒ  j ƒ  d | d j ƒ  j ƒ  d | d j ƒ  j ƒ  d | d j ƒ  j ƒ  d | d j ƒ  j ƒ  d f IJq'W| JqüWd  S(   Ns   ------------------------s   Vertices and their edgess   Point group  s     is a maximal subgroup of :i    s     * Nones     *s   -------------------------s   Transforming point groupst   Froms     to s    using :s     * s   ----------------------s   Compatible spacegroupss4   Spacegroups compatible with a specified point group s6   **and** with the systematic absenses specified by the s$   input space group, are listed below.s(   Spacegroup candidates in point group %s:s$    %5.2f %5.2f %5.2f %5.2f %5.2f %5.2fi   i   i   i   i   (   R[   R\   R]   Rä   Rr   Ræ   RR   R“   Rl   R‡   Ri   R   R-   RÝ   R   R¢   RÙ   (   RC   R^   Rë   R†   t   next_pgR4   t	   trial_symR�   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyR`   j  s`    


% 


"$ 





"c         C   s¸   | d  k r t j } n  | d IJ| d IJx{ |  j j j D]j } xa |  j j j | D]L } | j d d ƒ } | j d d ƒ } | d I| Id I| Id IJqV Wq< W| d IJd  S(   Ns   digraph f { s
   rankdir=LRs   "s   ''s   " -> "s   " ;t   }(   R[   R\   R]   Rä   Rr   Ræ   R‡   t   replace(   RC   R^   Rë   Rî   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   graphviz_pg_graph¤  s    

*N(   Ra   Rb   RD   Rì   R[   R`   Rò   (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyRÞ   2  s   .	:c   
      c   s@  x9|  D]1} | j  ƒ  } | j ƒ  } | j ƒ  j ƒ  d k rC q n  | Vg  | j ƒ  j ƒ  D] } t j | ƒ ^ q[ } t | ƒ d k r² | \ } } | j | | | | f ƒ n  g  } xO | D]G }	 t	 j
 |	 | ƒ j ƒ  }	 |	 j ƒ  r¿ |	 | k r¿ | j |	 ƒ q¿ q¿ Wx+ | D]# }	 t	 j | |	 j t	 j ƒ ƒ VqWq Wd S(   s    Primitive setting assumed i   i   N(   R   t   orderR   RÌ   t   basis_of_invariantR   t   colRR   t   extendR   t   tr_vect	   mod_shortt   is_zeroR   t   rt_mxt   new_denominatort   sg_t_den(
   t   point_groupt   opR   Ró   t   ut
   invariantst   t1t   t2t   translationst   t(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   compatible_symmetries²  s"     .(   t
   __future__R    t   cctbx.array_familyR   t   cctbxR   t   cctbx.crystal.find_best_cellR   t   cctbx.sgtbxR   R   R   t   cctbx.sgtbx.lattice_symmetryt   cctbx.sgtbx.cosetst   scitbxR   t   scitbx.python_utilsR   t   libtbx.utilsR	   R\   R'   R5   R€   R6   Rc   Rp   R¡   R}   RÞ   R  (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/pointgroup_tools.pyt   <module>   s*   	>	ƒ(Ž”€