ó
E™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 m	 Z	 d  d l
 m Z d  d l m Z d  d l Z d d	 d
 „ Z d „  Z e d k r¬ e ƒ  n  d S(   iÿÿÿÿ(   t   division(   t   flexN(   t   maptbx(   t   adptbxt   sgtbx(   t   approx_equal(   t   format_valuei   gš™™™™™¹?c   
      C   sÛ   d d l  m } |  j ƒ  j ƒ  j ƒ  } | j d | ƒ j ƒ  j ƒ  } | j d | d t	 ƒ } t
 j |  j ƒ  t
 j d | d | ƒ ƒ } | j d | ƒ } | j d	 | ƒ } t j ƒ  }	 |	 j t
 j |  j ƒ  | ƒ ƒ |	 S(
   Niÿÿÿÿ(   R   t   symbolt   space_groupt   reciprocal_spacet   u_scalet   u_mint
   all_paramst   independent_params(   t   cctbxR   R   t   typet   lookup_symbolt   space_group_infot   groupt   build_derived_point_groupt   tensor_rank_2_constraintst   TrueR   t   u_cart_as_u_start	   unit_cellt   random_u_cartR   R   R   t   sym_mat3_doublet   appendt   u_star_as_u_cart(
   t   crystal_symmetryR
   R   R   R   t   point_groupt   adp_constraintst   u_start   u_indept   r(    (    sM   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/regression/tst_sphericity.pyt   ru
   s    			c          C   sÆ  d }  d } d } d } d } d } d } d } d	 } d
 }	 d }
 d } d } x_t  |  | | | | | | | | |	 |
 | g ƒ D]-\ } } t j j d d  d | ƒ } | j ƒ  } | j ƒ  } | j d d | d | j ƒ  ƒ | j	 d d d d ƒ j
 ƒ  } | j d d ƒ } | j ƒ  | j ƒ  } t | j ƒ  j | j ƒ  ƒ ƒ d } t j ƒ  } t j d | d | j ƒ  d d d | j ƒ  ƒ } | j ƒ  d k rÀt | d d  d! ƒ s³t ‚ | d 7} n  t | | d d" ƒ sÜt ‚ t j ƒ  } t j d# | d$ | j ƒ  d d | j ƒ  d d ƒ } | j ƒ  j ƒ  } t j | ƒ t j | ƒ } t j ƒ  } | | } d  } | d k rƒ| | | } n  d% | d | | d | t  d& | ƒ f GHq W| d k sÂt ‚ d  S('   NsÞ   
CRYST1   10.000   10.000   10.000  90.00  90.00  90.00 P 1
HETATM    1  C    C      1       5.000   5.000   5.000  1.00  0.00           C
ANISOU    1  C    C      1     1000  10000   5000      0      0      0       C
END
sÞ   
CRYST1   10.000   15.000   17.000  70.00 110.00 120.00 P 1
HETATM    1  C    C      1       5.000   7.000  -9.000  1.00  0.00           C
ANISOU    1  C    C      1    10000  10000   5000      0      0      0       C
END
sÞ   
CRYST1   10.000   15.000   17.000  70.00 110.00 120.00 P 1
HETATM    1  C    C      1       5.000   7.000  -9.000  1.00  0.00           C
ANISOU    1  C    C      1    10000  10000  10000      0      0      0       C
END
sÞ   
CRYST1   10.000   15.000   17.000  70.00 110.00 120.00 P 1
HETATM    1  C    C      1       5.000   7.000  -9.000  1.00  0.00           C
ANISOU    1  C    C      1        0      0      0      0      0      0       C
END
s�   
CRYST1   10.000   15.000   17.000  70.00 110.00 120.00 P 1
HETATM    1  C    C      1       5.000   7.000  -9.000  1.00 20.00           C
END
sÞ   
CRYST1   10.000   15.000   17.000  70.00 110.00 120.00 P 1
HETATM    1  C    C      1       5.000   7.000   8.000  1.00  0.00           C
ANISOU    1  C    C      1    10000  10000   5000      0      0      0       C
END
sÞ   
CRYST1   10.000   15.000   17.000  70.00 110.00 120.00 P 1
HETATM    1  C    C      1       0.000   0.000   0.000  1.00  0.00           C
ANISOU    1  C    C      1    10000  10000   5000      0      0      0       C
END
sÞ   
CRYST1   10.000   10.000   10.000  90.00  90.00  90.00 P 1
HETATM    1  C    C      1       0.000   0.000   0.000  1.00  0.00           C
ANISOU    1  C    C      1     1000  10000   5000      0      0      0       C
END
sÞ   
CRYST1   10.000   10.000   10.000  90.00  90.00  90.00 P 1
HETATM    1  C    C      1      -9.000   0.000  50.000  1.00  0.00           C
ANISOU    1  C    C      1     1000  10000   5000      0      0      0       C
END
sÞ   
CRYST1   10.000   15.000   17.000  70.00 110.00 120.00 P 1
HETATM    1  C    C      1      -9.197  10.398  53.561  0.13  0.00           C
ANISOU    1  C    C      1     1000  10000   5000      0      0      0       C
END
s-  
CRYST1   10.000   10.000   10.000  90.00  90.00  90.00 P 1
HETATM    1  C    C      1       0.000   0.000   0.000  0.10  0.00           C
ANISOU    1  C    C      1     1000  10000   5000      0      0      0       C
HETATM    2  C    C      2       5.000   5.000   5.000  1.00  9.00           C
END
s�   
CRYST1   10.000   10.000   10.000  90.00  90.00  90.00 P 1
HETATM    1  C    C      1       5.000   5.000   5.000  1.00 20.00           C
END
i    t   source_infot   linest	   file_names   m%d.pdbR   t   d_ming      à?t	   algorithmt   directt   resolution_factorgš™™™™™É?t   map_dataR   t   radiusg      ø?t
   sites_fraci   i   g      ð?gü©ñÒMbP?gš™™™™™¹?t   real_mapt	   site_carts@   #%2d: answer: %5.3f sphericity: %5.3f other: %5.3f time_gain: %ss   %6.2f(!   t	   enumeratet   iotbxt   pdbt   inputt   Nonet   construct_hierarchyt   xray_structure_simplet   write_pdb_fileR   t   structure_factorst   f_calct   fft_mapt   apply_volume_scalingt   real_map_unpaddedt   listt
   scattererst
   anisotropyR   t   timeR   t
   sphericityR,   t   sizeR   t   AssertionErrort   principal_axes_of_inertiat
   sites_cartt   eigensystemt   valuesR   t   mint   maxR   (   t   pdb_str1t   pdb_str2t   pdb_str3t   pdb_str4t   pdb_str5t   pdb_str6t   pdb_str7t   pdb_str8t   pdb_str9t	   pdb_str10t	   pdb_str11t	   pdb_str12t	   found_twot   it   pdb_strt   pdb_inpt   pht   xrst   fcR9   R*   t   at   t0t   st   t1t   pat   vt   nt   t2t   t01t	   time_gain(    (    sM   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/regression/tst_sphericity.pyt   run   s\    
%%
*t   __main__(   t
   __future__R    t   scitbx.array_familyR   t	   iotbx.pdbR0   R   R   R   R   t   libtbx.test_utilsR   t   libtbx.str_utilsR   R?   R"   Rf   t   __name__(    (    (    sM   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/regression/tst_sphericity.pyt   <module>   s   	v