ó
Ë™xTc           @   s¯   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 m Z d  d l	 Z
 d  d l m Z d  d l Z d  d l Z d „  Z e d k r« e ƒ  n  d S(	   iÿÿÿÿ(   t   division(   t   find_coordination_geometryN(   t   ions(   t   monomer_library(   t   OrderedDictc          C   s—  t  j j d ƒ s4 d j t j j t ƒ d ƒ GHd  St d d g d g g f d d g d	 g d
 g g f d d g d g g f d d g d g d g g f d d g g f d d g d g d g d g g f d d g d g d g g f d d g d g d g g f d d g d g g f d d g d g d g g f d d g g  g f d d g d g d g d g g f d d g d g d g d g d g d g d g d g g f d g  d g g f d d g d g d g d g d g d g d g d g g f d d g d g d g d g g f d  d g d g d g g f g ƒ }  xb|  j	 ƒ  D]T\ } } t  j j
 d! t j j d d" d# | d$ ƒ d% t j j ƒ } t j j ƒ  } t j j ƒ  } t j j d& | d' | d( | d) d  d* t d+ t  j j ƒ  ƒ } | j d, t ƒ } | j ƒ  } | j j }	 | j d- j ƒ  }
 t j j j  d. d  d/ |	 d0 | d1 |
 ƒ } t! t j" t j# ƒ } | j$ d2 g ƒ g  t% | j& ƒ D]3 \ } } | j' ƒ  j( j) ƒ  j* ƒ  | k rs| ^ qs} t+ | ƒ t+ | ƒ k sÊt, ‚ x½ t- t. t+ | ƒ ƒ | | ƒ D]� \ } } } | j/ | d3 t ƒ} t0 | d4 t ƒ} g  | D] } | d- ^ q&} | | k réd5 G| G| GH| j& | j1 ƒ  GHd6 G| GHd7 G| GHt2 j3 ƒ  qéqéWq6Wd8 GHd  S(9   Nt   phenix_regressions   Skipping {}i   t   2qngt   pentagonal_bipyramidt
   octahedront   3rvat   square_pyramid_bidentate_misst   trigonal_bipyramidt   square_planet   1mjht   4e1ht   2xuzt   trigonal_prismt   3zlit   tetrahedront   3e0ft   trigonal_pyramidt   square_pyramidt   3dkqt
   three_legst   2o8qt   1tggt   see_sawt   3zu8t   1ofst   square_pyramid_bidentatet   3ul2t   3snmt   3qlqt   2gdft   1q8ht   relative_patht   mmtbxR   s   .pdbt   testt   mon_lib_srvt   ener_libt	   file_namet   raw_recordst   force_symmetryt   logt   show_energiesi    t   fmodelt   pdb_hierarchyt   xray_structuret   connectivityt   CLt   filter_by_two_fofct   minimizer_methods   Problem detecting geometries ins   Found geometries:s
   Should be:t   OK(4   t   libtbxt   envt
   has_modulet   formatt   ost   patht   splitt   __file__R   t   itemst   find_in_repositoriest   joint   isfileR   t   serverR'   t   pdb_interpretationt   processt   Nonet   Truet   utilst   null_outt   geometry_restraints_managert   FalseR/   t   all_chain_proxiesR.   t   shell_sym_tablest   full_simple_connectivityR$   R   t   identifyt   managert   sett   DEFAULT_IONSt   TRANSITION_METALSt   difference_updatet	   enumeratet	   pdb_atomst   fetch_labelst   resnamet   stript   uppert   lent   AssertionErrort   zipt   xranget   find_nearby_atomsR   t   id_strt   syst   exit(   t   modelst   modelt
   geometriest   pdb_pathR&   R'   t   processed_pdb_filet   geometryR/   R.   R0   RN   t   elementst   i_seqt   atomt   metalst   indext   metalt   expected_geometryt   contactst   foundt   it   geometry_names(    (    sG   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/ions/tst_geometries.pyt   exercise   sÊ    																		-+		t   __main__(   t
   __future__R    t   mmtbx.ions.geometryR   t   mmtbx.ions.identifyR$   R   t(   mmtbx.monomer_library.pdb_interpretationR   t   libtbx.load_envR5   t   collectionsR   R9   R_   Rr   t   __name__(    (    (    sG   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/ions/tst_geometries.pyt   <module>   s   	u