ó
‚™xTc           @   s   d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z e j d „ Z e	 d k r{ d  d l Z e e j
 d ƒ n  d S(   iÿÿÿÿ(   t   divisionNc         C   s{  xt|  D]l} y)t  j j | ƒ s( t ‚ | d | IJt j j d | ƒ } | j ƒ  } | j ƒ  } | j	 ƒ  | j
 ƒ  j ƒ  } | j d ƒ s° | j d ƒ } t d | ƒ ‚ n  t j j j ƒ  } t  j j t  j j | ƒ ƒ d }	 | j d | j ƒ  ƒ | |	 <t |	 d d ƒ }
 |
 | IJ| d	 |	 IJ|
 j ƒ  Wq t k
 rr} | d
 | IJ| d It | ƒ IJq q Xq Wd  S(   Ns   Converting %s to mmCIF format.t	   file_namet    s$   Missing element symbol for %d atoms.i    t   crystal_symmetrys   .cift   wbs     wrote %s.cifs$   Error converting %s to mmCIF format:t    (   t   ost   patht   existst   AssertionErrort   iotbxt   pdbt	   pdb_inputt   construct_hierarchyt   atomst(   set_chemical_element_simple_if_necessaryt   extract_elementt   stript   all_net   countt   RuntimeErrort   cift   modelt   splitextt   basenamet   as_cif_blockR   t   opent   closet	   Exceptiont   str(   t   argst   outR   R   t	   hierarchyt	   pdb_atomst   elementst	   n_missingt
   cif_objectR   t   ft   e(    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb_as_cif.pyt   run	   s0    
"	
t   __main__i   (   t
   __future__R    t   iotbx.cif.modelR
   t	   iotbx.pdbR   t   syst   stdoutR'   t   __name__t   argv(    (    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/pdb_as_cif.pyt   <module>   s   