ó
±™xTc           @   s}   d  d l  m Z d  d l m Z d  d l Z d  d l Z d „  Z e j d „ Z	 d „  Z
 e d k ry e	 e j d ƒ n  d S(	   iÿÿÿÿ(   t   division(   t   SorryNc          C   s;   d d l  m }  |  d t d t d t d t d t d d	 ƒ S(
   Niÿÿÿÿ(   t    generate_master_phil_with_inputst   enable_twin_lawt   enable_experimental_phasest    enable_pdb_interpretation_paramst   enable_stop_for_unknownst   enable_full_geometry_paramst   phil_strings2  
selection = None
  .type = atom_selection
target_map = 2mFo-DFc
  .type = str
rsr_after_anneal = False
  .type = bool
resolution_factor = 0.25
  .type = float
reference_sigma = 0.5
  .type = float
  .help = Sigma for harmonic restraints for neighboring atoms not included     in the selection of interest.
output {
  file_name = annealed.pdb
    .type = path
  save_map_coeffs = False
    .type = path
  verbose = False
    .type = bool
  debug = False
    .type = bool
}
simulated_annealing {
  include scope mmtbx.dynamics.simulated_annealing.master_params
}
(   t   mmtbx.command_lineR   t   Truet   False(   R   (    (    sR   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/anneal_real_space.pyt   get_master_phil   s    c         C   s‹  d d  l  } d d  l } | j j d |  d t ƒ  d t d t d | d d ƒ } | j } | j } t | ƒ | j	 } | j
 j } | j | j ƒ } | j t ƒ d	 k s¬ t ‚ | j d
 | j d t ƒ }	 | j j rEt j j t j j | j j ƒ d	 ƒ }
 |
 d | j } |	 j d | j ƒ } | j ƒ  j | ƒ | d | IJn  |	 j d | j ƒ j ƒ  j ƒ  } | j ƒ  j  ƒ  j! ƒ  } | j" j# d | j$ d | d | d | d | j% ƒ  j& ƒ  d | j
 d d d | j d | j' d | j( d | d | j j) ƒ } | j ƒ  j* | ƒ | j+ | ƒ j, | j+ | ƒ ƒ } | d | IJt- | j j d ƒ } | j | j. d | j$ ƒ ƒ | j/ ƒ  | d | j j IJ| S(   Niÿÿÿÿt   argst   master_philt   process_pdb_filet   create_fmodelt   outt   usage_stringsÑ   mmtbx.anneal_real_space model.pdb data.mtz selection="resname ATP"

Perform simulatead annealing against a real-space (map) target for a selection
of atoms.  For development purposes and experimentation only.
i    t   map_typet   exclude_free_r_reflectionss   _%s.mtzt   column_root_labels   Wrote map coefficients to %st   resolution_factort   xray_structuret   pdb_hierarchyt	   selectiont
   target_mapt   d_mint   processed_pdb_filet   cif_objectst   paramst   rsr_after_annealt   debugs   RMSD (selected atoms) = %.3ft   wt   crystal_symmetrys   Wrote annealed model to %s(    (0   R	   t   mmtbx.buildingt   command_linet   load_model_and_dataR   R
   R   t   fmodelt   validate_paramsR   R   t   all_chain_proxiesR   t   countt   AssertionErrort   map_coefficientsR   t   outputt   save_map_coeffst   ost   patht   basenamet   splitextt	   file_namet   as_mtz_datasett
   mtz_objectt   writet   fft_mapR   t   apply_sigma_scalingt   real_map_unpaddedt   atomst   extract_xyzt	   deep_copyt   buildingt   run_real_space_annealingR   t   f_obsR   t   simulated_annealingR   R    t   set_xyzt   selectt   rms_differencet   opent   as_pdb_stringt   close(   R   R   t   mmtbxt   cmdlineR   R&   R   t   a_c_pR   t
   map_coeffst	   file_baset   map_filet   mtzt   mapt	   sites_reft   sites_updatedt   rmsdt   f(    (    sR   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/anneal_real_space.pyt   run+   sd    				
				(!					
c         C   s"   |  j  d  k r t d ƒ ‚ n  d  S(   Ns/   You must specificy an atom selection to anneal.(   R   t   NoneR   (   R   (    (    sR   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/anneal_real_space.pyR'   e   s    t   __main__i   (   t
   __future__R    t   libtbx.utilsR   t   os.pathR.   t   sysR   t   stdoutRR   R'   t   __name__t   argv(    (    (    sR   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/anneal_real_space.pyt   <module>   s   	$:	