ó
ąxTc           @   s   d  d l  m Z d  d l m Z d  d l m Z d  d l Z d Z e j d d  Z
 d   Z e d k r} e
 e j d	  n  d S(
   i˙˙˙˙(   t   division(   t   Sorry(   t   sqrtNs  
element = None
  .type = str
  .help = Anomalously scattering atom type
n_sites = None
  .type = int
fdp = None
  .type = float
wavelength = None
  .type = float
  .help = Data collection wavelength (in Angstroms)
energy = None
  .type = float
  .help = Data collection energy (in eV)
n_res = None
  .type = int
  .help = Number of residues in ASU
mw = None
  .type = float
  .help = Molecular weight of ASU
c   
         sń  d d  l   d d l m   m } d  j j f    f d     Y} | d  k r | d |  d t d d d	 d
 d d  } | j j	   } n  t
 |  | j } | d  k r"| j d  k	 rî | j | j  j | j  j   } d | j } q"| j | j  j | j  j   } d | j } n  | j d  k	 rE| j d d } n | j d } t d | j |  | d }	 | d | j IJ| d | j IJ| d | IJ| j d  k rÍ| d | j | | f IJn | d | IJ| d |	 d IJ|	 S(   Ni˙˙˙˙(   t   chemical_elementst   sasakit   interpreterc              s   e  Z    f d    Z RS(   c            sE   t  |  d k rA | j     j   k rA  j j d |  Sn  d  S(   Ni   s
   element=%s(   t   lent   uppert   proper_upper_listt   philt   parse(   t   selft   arg(   R   t   iotbx(    sW   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/estimate_bijvoet_ratio.pyt   process_other"   s    (   t   __name__t
   __module__R   (    (   R   R   (    sW   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/estimate_bijvoet_ratio.pyR   !   s   t   argst   master_phil_stringt   integer_deft   n_sitest	   float_deft   fdpt   usage_strings×   mmtbx.estimate_bijvoet_ratios Se 20 n_res=1000 wavelength=0.9792

Estimate the Bijvoet ratio for a macromolecular X-ray diffraction experiment
given an anomalous scatterer type and expected asymmetric unit contents.s   %s As   %s eVin   i   i   gÍĚĚĚĚĚ@s   Heavy atom type: %ss   Number of sites: %ds   Approx. # of non-H/D atoms: %ds   f'' of %s at %s : %6.3fs   f'' (experimental) : %6.3fs    Expected Bijvoet ratio : %4.1f%%id   (   t
   iotbx.philt   cctbx.eltbxR   R   R	   t   process_command_line_with_filest   Nonet   master_phil_strt   workt   extractt   validate_paramsR   t
   wavelengtht   tablet   elementt   at_angstromt   at_evt   energyt   n_rest   mwR   R   (
   R   t   outt   paramsR   R   t   cmdlineR   t   captiont   n_atomst   bijvoet_ratio_acentric(    (   R   R   sW   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/estimate_bijvoet_ratio.pyt   run   s@    %	
	$$c         C   s  d d l  m } | j   } |  j d  k r: t d   n+ |  j j   | k re t d |  j   n  |  j d  k r t d   n  |  j |  j	 |  j
 g j d   d k rÔ |  j |  j	 |  j
 g GHt d d   n  |  j |  j g j d   d	 k rt d
 d   n  t S(   Ni˙˙˙˙(   R   s   Element symbol not specified.s#   Element symbol '%s' not recognized.s   Number of sites not specified.i   s4   Please specify either an X-ray wavelength or energy s$   (but not both), or the expected f''.i   s4   Please specify either the number of residues or the s,   approximate molecular weight (but not both).(   R   R   R   R"   R   R   R   R   R   R%   R    t   countR&   R'   t   True(   R)   R   t	   all_elems(    (    sW   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/estimate_bijvoet_ratio.pyR   K   s     '!t   __main__i   (   t
   __future__R    t   libtbx.utilsR   t   mathR   t   sysR   t   stdoutR   R.   R   R   t   argv(    (    (    sW   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/command_line/estimate_bijvoet_ratio.pyt   <module>   s   -	