ó
ąxTc           @   s   d  d l  m Z d  d l m 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 e j d	  n  d S(
   i˙˙˙˙(   t   division(   t   make_header(   t	   multi_outNc          C   s   d d l  m }  |  d d  S(   Ni˙˙˙˙(   t    generate_master_phil_with_inputst   phil_strings  
selection = None
  .type = atom_selection
nproc = Auto
  .type = int
output {
  file_name = alternates.pdb
    .type = path
  verbose = False
    .type = bool
  debug = False
    .type = bool
}
include scope mmtbx.building.alternate_conformations.single_residue.master_phil_str
(   t   mmtbx.command_lineR   (   R   (    (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/build_alt_confs.pyt   master_phil   s    c         C   sľ  | d  k r t j } n  d d l m } d d  l } | j j d |  d t   d t	 d t	 d |  } | j
 } t |  t   } | j d |  t j j | j j  d	 d
 } t | d  } | j d |  | j d | j d | j d | j d | d | j d | j d | j d | j j d | j j d |  
\ }	 }
 t | j j d  } | j |	 j d | j j   | j    t! d d | | d IJ| d | j j IJ| d IJd  S(   Ni˙˙˙˙(   t   single_residuet   argsR   t   process_pdb_filet   create_fmodelt   outt   stdouti    s   .logt   wt   logfilet   pdb_hierarchyt   fmodelt   geometry_restraints_managert   paramst   cif_objectst	   selectiont   nproct   verboset   debugt   crystal_symmetrys   Building completet    s   Wrote %ss+   You MUST refine this model before using it!("   t   Nonet   sysR   t&   mmtbx.building.alternate_conformationsR   R   t   command_linet   load_model_and_dataR   t   TrueR   t   validate_paramsR   t   registert   ost   patht   splitextt   outputt	   file_namet   opent   build_cycleR   R   t   geometryR   R   R   R   R   t   writet   as_pdb_stringt   xray_structuret   closeR   (   R   R   R   t   mmtbxt   cmdlineR   t   logt   log_file_nameR   R   t   n_alternatest   f(    (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/build_alt_confs.pyt   run   sH     			
	 							

c         C   s%   |  j  j d  k r! t d   n  t S(   Ns#   Please specify an output file name.(   R%   R&   R   t   SorryR   (   R   (    (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/build_alt_confs.pyR    A   s    t   __main__i   (   t
   __future__R    t   libtbx.str_utilsR   t   libtbx.utilsR   t   os.pathR"   R   R   R   R4   R    t   __name__t   argv(    (    (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/build_alt_confs.pyt   <module>   s   	&	