ó
-xTc           @   sZ   d  d l  m Z d  d l m Z d  d l m Z d  d l m Z d e f d     YZ d S(   i’’’’(   t   division(   t   manager(   t   gradients_direct(   t   gradients_fftt	   gradientsc           B   s   e  Z d  Z d d  Z RS(   s;    Factory class for structure factor derivatives evaluation c   
      C   s  | d k s t  | d
 k r» | j   j   } | j   j   } |  j   s d | |  j   j   | |  j   j	   k  rø d } qø q» |  j
 | |  |  j | |  k r» d } q» n  | d k rŠ t }	 n t }	 |	 d |  d | d | d | d | d	 |  S(   s  
    Evaluate structure factors derivatives and return the result

    :Parameters:

      xray_structure : `cctbx.xray.structure`
        the structure to differentiate the structure factors of
      u_iso_refinable_params
        TODO
      miller_set : `cctbx.miller.set`
        the set of miller indices to evaluate the structure factors at
      d_target_d_f_calc : `scitbx.array_family.flex.complex_double`
        the derivative of the target wrt f_calc for each miller index
      n_parameters
        TODO
      algorithm : string
        the name of the evaluation method, either "direct", "fft", or None

      :return:
        an instance of
        `cctbx.xray.structure_factors.gradients_direct` or
        `cctbx.xray.structure_factors.gradients_fft`
        when C{algorithm} is respectively equal to "direct" or "fft",
        or the best suited of the two of them when C{algorithm} is None
      :rtype:
        a type s.t. an instance e provides the evaluated structure factors
        gradients as C{e.packed()}

    t   directt   ffti   R   t   xray_structuret   u_iso_refinable_paramst
   miller_sett   d_target_d_f_calct   n_parametersN(   R   R   N(   t   Nonet   AssertionErrort
   scattererst   sizet   indicest   have_good_timing_estimatest   space_groupt   order_pt   crystal_griddingt   n_grid_pointst   estimate_time_directt   estimate_time_fftR   R   (
   t   selfR   R   R	   R
   R   t	   algorithmt   n_scattererst   n_miller_indicest   f(    (    sT   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/xray/structure_factors/gradients.pyt   __call__   s*    # 	N(   t   __name__t
   __module__t   __doc__R   R   (    (    (    sT   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/xray/structure_factors/gradients.pyR      s   N(	   t
   __future__R    t$   cctbx.xray.structure_factors.managerR   t-   cctbx.xray.structure_factors.gradients_directR   t*   cctbx.xray.structure_factors.gradients_fftR   R   (    (    (    sT   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/xray/structure_factors/gradients.pyt   <module>   s   