ó
T™xTc           @   së   d  d l  m Z d  d l m Z d  d l Z e j j d ƒ Z d  d l	 Td  d l
 Z d  d l Z d  d l Z e d ƒ Z e d ƒ Z d e j d Z e d Z d	 d
 d „ Z d d	 d „ Z d „  Z d „  Z d d d „ Z d „  Z d S(   iÿÿÿÿ(   t   division(   t   flexNt   cctbx_adptbx_ext(   t   *i   iþÿÿÿi   i    ih  c         C   sM   t  j j g  t d ƒ D] } t j | | ƒ ^ q d t ƒj } t | |  ƒ S(   Ni   t   deg(	   t   scitbxt   matht   euler_angles_as_matrixt   xranget   randomt   uniformt   Truet   elemst   c_u_c_transpose(   t   u_cartt   r_mint   r_maxt   it   c(    (    s:   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/adptbx.pyt   random_rotate_ellipsoid   s    	7c         C   sA   t  d g  t d ƒ D] } t j ƒ  |  | ^ q d d d g ƒ S(   NR   i   i    (   R   R   R	   (   t   u_scalet   u_minR   (    (    s:   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/adptbx.pyt   random_u_cart   s    	c         C   s'   t  j t d |  ƒ ƒ t t |  | ƒ S(   Nt   h(   R   t   doublet0   debye_waller_factor_u_star_gradient_coefficientst   mtpst   debye_waller_factor_u_star(   R   t   u_star(    (    s:   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/adptbx.pyt$   debye_waller_factor_u_star_gradients   s    c         C   s   t  d |  ƒ t t |  | ƒ S(   NR   (   t1   debye_waller_factor_u_star_curvature_coefficientst   mtpssR   (   R   R   (    (    s:   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/adptbx.pyt%   debye_waller_factor_u_star_curvatures   s    gš™™™™™¹?c         C   s  d d l  m } |  j ƒ  j ƒ  j ƒ  } | j d | ƒ j ƒ  j ƒ  } | j d | d t	 ƒ } t
 |  j ƒ  t d | d | ƒ ƒ } | j d | ƒ } | j d	 | ƒ } t t |  j ƒ  | ƒ ƒ }	 |	 d
 |	 d |	 d d }
 |	 d
 |
 |	 d |
 |	 d |
 |	 d |	 d |	 d g }	 |	 S(   Niÿÿÿÿ(   t   sgtbxt   symbolt   space_groupt   reciprocal_spaceR   R   t
   all_paramst   independent_paramsi    i   i   i   i   i   (   t   cctbxR!   R#   t   typet   lookup_symbolt   space_group_infot   groupt   build_derived_point_groupt   tensor_rank_2_constraintsR   t   u_cart_as_u_start	   unit_cellR   R&   R%   t   u_as_bt   u_star_as_u_cart(   t   crystal_symmetryR   R   R!   R"   t   point_groupt   adp_constraintsR   t   u_indept   b_cartt   tr(    (    s:   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/adptbx.pyt,   random_traceless_symmetry_constrained_b_cart#   s     			!c   
      C   sÚ   d d l  m } | | k r# t j St |  t ƒ rD t | |  ƒ }  n  t | t ƒ re t | | ƒ } n  | | j d | ƒ ƒ } | | j d | ƒ ƒ } t | | ƒ } t	 d |  d | d | d | d | ƒ j
 ƒ  }	 |	 | S(	   s­   
  Calculate the intersection of two scatterers, given coordinates and atomic
  displacements.  If the scatterers do not actually intersect the result will
  be negative.
  iÿÿÿÿ(   t   colt	   site_fract   ustar1t   ustar2t   site1t   site2R/   (   t   scitbx.matrixR9   t   syst   maxintt
   isinstancet   floatt   u_iso_as_u_start   orthogonalizet   abst   projection_sumt   delta_z(
   t   u_1t   u_2t   site_1t   site_2R/   R9   t   site_cart_1t   site_cart_2t   dxyzt   proj_sum(    (    s:   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/adptbx.pyt   intersection6   s"    (   t
   __future__R    t   cctbx.array_familyR   t   boost.pythont   boostt   pythont
   import_extt   extR   t   scitbx.mathR   R	   R   R0   t   u_as_b_factort   b_as_ut   b_as_u_factort   piR   R   R   R   R   R    R8   RQ   (    (    (    s:   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/adptbx.pyt   <module>   s$   

		