ó
©%�Tc           @   s   d  „  Z  d S(   c            sL  d d  l  ‰  d d  l ‰ ‡ f d †  } ‡ f d †  } ‡ f d †  } ‡ f d †  } ‡  ‡ f d †  } t |  ƒ } t | ƒ }	 | d }
 |	 d } | | ƒ } d G| GHd	 G|	 GHd
 G| GH| | ƒ } d } d G| GHt d d | d |
 g d ˆ j | ƒ d | g | d ƒ | |
 ƒ } d G| GH| | ƒ } | s<d GHnd G| GH| d } |	 d } | d } d } d } d } ˆ  j j | ƒ r—ˆ  j | ƒ n  ˆ  j j | ƒ r¹ˆ  j | ƒ n  t d g  d |  d ˆ j | ƒ | d d d  d! d" d# d$ d% d& d' d( | g | d ƒ t d g  d | d ˆ j | ƒ | d d d  d! d" d# d$ d% d) d* d( | g | d ƒ t d+ d, | d- | d. | g d/ d0 d g | d ƒ ˆ  j j | ƒ r´ˆ  j | ƒ n  ˆ  j j | ƒ rÖˆ  j | ƒ n  t | ƒ t	 | d& d' d1 d d d d2 d3 d4 d d d d5 d5 ƒ t	 | d) d6 d1 d d7 d d2 d3 d4 d d d d5 d5 ƒ d  S(8   Niÿÿÿÿc            s   ˆ  j  |  ƒ } | S(   N(   t   rstrip(   t   st   f(   t   string(    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/cns2coot.pyt   trim_trailing_spaces   s    c            s¥   g  } t  } y t |  d ƒ } Wn t k
 r; d G|  GHn X| r˜ | j ƒ  } xP | D]< } d | k rU ˆ  j | ƒ } | d d !} | j ƒ  PqU qU Wn	 d G|  GH| S(   Nt   rs   BL WARNING:: Cannot read t   CRYST1i   i   s   BL WARNING:: IOError in (   t   Falset   opent   IOErrort	   readlinest   splitt   close(   t   pdb_fileR   t   fint   linest   line(   R   (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/cns2coot.pyt   get_cell_from_pdb!   s     
	c            s´   d } t  } y t |  d ƒ } Wn t k
 r; d G|  GHn X| r§ | j ƒ  } x_ | D]K } d | k rU ˆ  j | ƒ } | d } ˆ  j | d ƒ } | j ƒ  PqU qU Wn	 d G|  GH| S(   Nt    R   s   BL WARNING:: Cannot read R   i   s   BL WARNING:: IOError in (   R   R   R	   R
   R   t   joinR   (   R   R   R   R   R   (   R   (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/cns2coot.pyt   get_symm_from_pdb_file<   s"    

	c            s±   d } t  } y t |  d ƒ } Wn t k
 r; d G|  GHn X| r¤ | j ƒ  } x\ | D]H } d | k rU ˆ  j | ƒ } | d } ˆ  j | ƒ } | j ƒ  PqU qU Wn	 d G|  GH| S(   NR   R   s   BL WARNING:: Cannot read R   i   s   BL WARNING:: IOError in (   R   R   R	   R
   R   R   R   (   R   R   R   R   R   (   R   (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/cns2coot.pyt   get_symm_from_pdb_file_2Q   s"    

	c            sÚ   y ˆ  j  d } Wn d GHt SX| rÑ t } ˆ  j j | d d d ƒ } t } y t | d ƒ } Wn d G| GHn X| rÍ | j ƒ  } x7 | D]/ } |  | k r� ˆ j | ƒ } | d } Pq� q� W| j ƒ  n  | Sd	 GHd  S(
   Nt   CCP4s   CCP4 not set up.t   libt   datas	   symop.libR   s   Problems opening i   s   Problems with CCP4 set up(   t   environR   t   pathR   R   R
   R   R   (   t   symm2t   eR   R   R   R   t   t(   t   osR   (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/cns2coot.pyt   get_symm_from_symop_libi   s.    
s   _tmp.pdbs   map1_prefix: s   map2_prefix: s   cell: s   cns2coot-pdbset-tmp.logs   symm1: t   pdbsett   XYZINt   XYZOUTs   CELL s   SPACEGROUP i    s   symm2: s!   Failed to find symm in symop.lib!s   INFO:: SYMM is s   .mtzs	   -coot.mtzs   cns2coot-cad-tmp.logs   cns2coot-sftools-1-tmp.logs   cns2coot-sftools-2-tmp.logt   sftoolss   read t   cnst   ENDt   Wt   Pt   Rs
   SET LABELSt   FOMt   PHICt   SCALEt   FWTt   PHWTs   WRITE t   DELFWTt   PHDELWTt   cadt   HKLIN1t   HKLIN2t   HKLOUTs1   LABIN FILE_NUMBER 1 E1=FOM E2=PHIC E3=FWT E4=PHWTs(   LABIN FILE_NUMBER 2 E1=DELFWT E2=PHDELWTR   s   Fobs:None-specifieds   SigF:None-specifieds   RFree:None-specifiedg      ð¿t   DELPHWTi   (
   R   R   t   strip_extensiont   popen_commandR   R   t   isfilet   removet   read_pdbt.   make_and_draw_map_with_reso_with_refmac_params(   t   twofofc_coeffst   fofc_coeffst	   model_pdbR   R   R   R   R   t   map1_prefixt   map2_prefixt   map1_tmpt   map2_tmpt   cellt   symm1t
   pdbset_logR   t   symmt   map1_mtzt   map2_mtzt   map_coot_mtzt   cad_logt   sftools_1_logt   sftools_2_log(    (   R   R   sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/cns2coot.pyt   cns2coot   sX    

				9		


TT1
4N(   RL   (    (    (    sO   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/cns2coot.pyt   <module>   s    