ó
}™xTc           @   sì   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 m Z d  d	 l Z d  d
 l m Z d  d	 l Z d  d	 l Z d „  Z d d „ Z d „  Z e d k rè e ƒ  n  d	 S(   iÿÿÿÿ(   t   division(   t   strudat(   t   tst_direct_space_asu(   t   crystal(   t   uctbx(   t   flex(   t   Exception_expected(   t   format_cpu_timesN(   t   StringIOc          C   s'  t  d ƒ }  t j |  ƒ } x› d d f d	 d f d d f d d f d d f d d  f d d! f d d" f d d# f d d$ f f
 D]9 \ } } | j | ƒ j ƒ  j t j | ƒ ƒ s| t ‚ q| W| j d ƒ j d j	 d  k sÞ t ‚ | j d ƒ j d j	 d k st ‚ | j d ƒ j ƒ  d d  g k s*t ‚ | j d ƒ j ƒ  d d  d  g k sTt ‚ y | j d ƒ j d t ƒ Wn+ t k
 rž} t | ƒ d k s¥t ‚ n Xt ‚ y | j d ƒ j d t ƒ Wn+ t k
 rï} t | ƒ d k söt ‚ n Xt ‚ | j d ƒ j ƒ  j ƒ  j ƒ  d k s#t ‚ d  S(%   Nsg  
*tric
Title
Reference
P 1
 11 12 13 100 110 120
Si 0.1 0.2 0.3
---------------------------------
*mono_b
Title
Reference
P 1 2 1
 11 12 13 100
Si 0.1 0.2 0.3
---------------------------------
*mono_c
Title
Reference
P 1 1 2
 11 12 13 100
Si 0.1 0.2 0.3
---------------------------------
*mono_a
Title
Reference
P 2 1 1
 11 12 13 100
Si 0.1 0.2 0.3
---------------------------------
*orth
Title
Reference
P 2 2 2
 11 12 13
Si 0.1 0.2 0.3 # remark
---------------------------------
*tetr
Title
Reference
P 4
 11 13
Si 0.1 0.2 0.3 4
---------------------------------
*trig
Title
Reference
R 3
 11 13
Si 0.1 0.2 0.3
---------------------------------
*rhom
Title
Reference
R 3 R
 11 100
Si 0.1 0.2 0.3
---------------------------------
*hexa
Title
Reference
P 6
 11 13
Si 0.1 0.2 0.3
---------------------------------
*cubi
Title
Reference
P 2 3
 11
Si 0.1 0.2 0.3
O  0.0 0.0 0.0
---------------------------------
*mixcon1
Title
Reference
P 2 3
 11
Si 0.1 0.2 0.3 4
O  0.0 0.0 0.0
---------------------------------
*mixcon2
Title
Reference
P 2 3
 11
Si 0.1 0.2 0.3 4
O  0.0 0.0 0.0
O  0.0 0.0 0.0
---------------------------------
t   trici   i   i   id   in   ix   t   mono_biZ   t   mono_ct   mono_at   ortht   tetrt   trigt   rhomt   hexat   cubii    i   t   mixcon1t   mixcon2t   all_or_nothings.   Tag mixcon1: 1 atom is missing the bond count.s0   Tag mixcon2: 2 atoms are missing the bond count.i   (   i   i   i   id   in   ix   (   i   i   i   iZ   id   iZ   (   i   i   i   iZ   iZ   id   (   i   i   i   id   iZ   iZ   (   i   i   i   iZ   iZ   iZ   (   i   i   i   iZ   iZ   iZ   (   i   i   i   iZ   iZ   ix   (   i   i   i   id   id   id   (   i   i   i   iZ   iZ   ix   (   i   i   i   iZ   iZ   iZ   (   R   R   t   read_all_entriest   gett	   unit_cellt   is_similar_toR   t   AssertionErrort   atomst   connectivityt   Nonet   connectivitiest   Truet   strR   t   as_xray_structuret
   scattererst   size(   t	   test_filet   all_entriest   tagt   cellt   e(    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/kriber/tst_strudat.pyt   exercise_basic   s<    Y									%%'*g      @c         C   s¢  t  j j d d d t j j ƒ } | d  k r6 d GHd  St j t	 | ƒ ƒ } xPt
 | j ƒ D]?\ } } | j ƒ  } d t j d k s– | d d k r¼ t j d	 | d
 d t j d k ƒ n  | j d |  ƒ } t j d | d |  ƒ } t j | j ƒ  j ƒ  d ƒ } xF | D]> }	 | |	 j c d 7<|	 j d k r| |	 j c d 7<qqWxJ t | j | ƒ D]6 \ }
 } |
 j d  k	 s�t ‚ |
 j | k s`t ‚ q`Wq[ Wd  S(   Nt   relative_paths,   phenix_regression/misc/strudat_zeolite_atlast   tests;   Skipping exercise_zeolite_atlas(): input file not availables   --fulli   i   i    t	   structuret   verboses	   --Verboset   buffer_thicknesst   asu_mappingst   distance_cutoff(   t   libtbxt   envt   find_in_repositoriest   ost   patht   isfileR   R   R   t   opent	   enumeratet   entriesR!   t   syst   argvR   t"   exercise_neighbors_pair_generatorsR/   R   t   neighbors_fast_pair_generatorR   t   size_tR"   R#   t   i_seqt   j_symt   j_seqt   zipR   R   R   (   R0   t
   atlas_fileR%   t   it   entryR,   R/   t   pair_generatort   bond_countst   pairt   atomt
   bond_count(    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/kriber/tst_strudat.pyt   exercise_zeolite_atlas‡   s2    #			c           C   s   t  ƒ  t ƒ  t ƒ  GHd  S(   N(   R)   RK   R   (    (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/kriber/tst_strudat.pyt   run¢   s    t   __main__(   t
   __future__R    t   iotbx.kriberR   t   cctbx.regressionR   t   cctbxR   R   t   cctbx.array_familyR   t   libtbx.test_utilsR   t   libtbx.utilsR   t   libtbx.load_envR1   t	   cStringIOR   R:   R4   R)   RK   RL   t   __name__(    (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/kriber/tst_strudat.pyt   <module>   s   	z	