ó
Ñ%�Tc           @   s`   d  Z  d d l m Z y d d l m Z Wn e k
 r= n Xd Z e d „ Z e d „ Z d S(   sH   Add minimization restraint using Phenix pucker-specific restraint valuesiÿÿÿÿ(   t   add_extra_bond_restraint(   t   add_extra_angle_restraintg      ð?c         C   s�  g  } g  } | d. k	 rr| d k r^ | j | d d d d d g | d d d d d g g ƒ nF | d	 k r¤ | j | d d d d
 d g | d d d d d g g ƒ n  | j | d | d | d d d g | d | d | d d d g | d | d | d d d g | d | d | d d d g g ƒ | d. k	 rr| j | d | d | d d d g | d | d | d d d g g ƒ qrn  | d k rŸ| j | | d d d d g | | d d d d g | d d d d d g | d d d d d g | d d d d d g | d d d d d g | d d d d d g | d d d d d g | d d d d d g | d d d d d g | d d d d d g | d d d d  d g | d d d d! d g g ƒ n-| d	 k rÌ| j | | d d d" d g | | d d d# d g | d d d d$ d g | d d d d% d g | d d d d
 d g | d d d d d g | d d d d& d g | d d d d' d g | d d d d( d g | d d d d) d g | d d d d* d g | d d d d+ d g | d d d d, d g g ƒ n  | d. k	 r¹| j | d | d | d d d g | d | d | d d d g | d | d | d d d g | d | d | d d d g g ƒ |
 r¹|	 d k r…| j | d d d d d g ƒ q¶|	 d	 k r¶| j | d d d d* d g ƒ q¶q¹n  xc | D][ } | \ } } } } } } t |  | | d- | d- | | d- | d- | | d- | d- | t ƒ qÀWxi | D]a } | \ } } } } } } } } t |  | | d- | d- | | d- | d- | | d- | d- | t ƒ q&Wd. S(/   s  Set angle restraints on the specified nucleotides to match the Phenix pucker-specific restraints
    
    ARGUMENTS:
        molNum              - the molecule number
        chain               - the chain
        prevPrevResNum      - the residue number of residue i-2
        prevResNum          - the residue number of the previous residue (using Coot numbering)
        curResNum           - the residue number of the current residue (using Coot numbering)
        nextResNum          - the residue number of the next residue (using Coot numbering)
        glycosidicBaseAtom  - the name of the base nitrogen atom (N1 or N9) for the current residue
        prevPucker          - the pucker of the previous residue (as an int: 2 or 3)
        curPucker           - the pucker of the current residue (as an int: 2 or 3)
        nextPucker          - the pucker of the previous residue (as an int: 2 or 3)
    OPTIONAL ARGUMENTS:
        restrainNextRes     - whether we should add restraints for atoms of the next residue (other than the phosphate, which is always restrained)
                              Defaults to False
    RETURNS:
        None
    NOTES:
        Note that restraints that are the same for C2'-endo and C3'-endo nucleotides are added in calcCoords.__setTorsionRestraints
    i   s    C2's    C3's    O3'g     `[@g      ð?s    C4'gš™™™™Y[@i   gÍÌÌÌÌl\@g     @\@s    P  s    O5'g“VåY@s    OP1g      [@s    OP2gÍÌÌÌÌ^@s    C1's    O4'gÍÌÌÌÌ[@g     €\@g33333sZ@g     `Y@s    C5'gÍÌÌÌÌÌ\@gfffff†Z@gfffffF[@gÍÌÌÌÌl[@gÍÌÌÌÌì[@s    O2'g33333ó[@gfffff¦\@g      [@g      \@gfffffæZ@g33333SY@g      ]@g      Z@g33333s[@gš™™™™y[@g     à[@gš™™™™[@gÍÌÌÌÌ¬[@t    N(   t   Nonet   extendt   appendR   t   PHENIX_ANGLE_SD(   t   molNumt   chaint   prevPrevResNumt
   prevResNumt	   curResNumt
   nextResNumt   glycosidicBaseAtomt
   prevPuckert	   curPuckert
   nextPuckert   restrainNextRest   restraintListt   linkRestraintListt   curRestraintt   resNumt   atom1t   atom2t   atom3t   meant   sdt   resNum1t   resNum2t   resNum3(    (    s^   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/rcrane/phenixRestraints.pyt   setAngleRestraints$   s„    !"!(!""(c
         C   sl  g  }
 g  } | d" k	 r� | d k rC |
 j | d d d d g ƒ n+ | d k rn |
 j | d d d d g ƒ n  | j | d | d d	 d g ƒ n  | d k r`|
 j | d
 d d d g | d d d d g | d d d d g | d d d d g | d d d d g | d d d d g | d d
 d d g | d d d d g | d d d d g | | d
 d d g g
 ƒ nÐ | d k r0|
 j | d
 d d d g | d d d d g | d d d d g | d d d d g | d d d d g | d d d d g | d d
 d d g | d d d d g | d d d d g | | d
 d  d g g
 ƒ n  | d" k	 r½| j | d | d d	 d g ƒ |	 r½| d k rŒ|
 j | d d d d g ƒ qº| d k rº|
 j | d d d d g ƒ qºq½n  xQ |
 D]I } | \ } } } } } t |  | | d! | d! | | d! | d! | | ƒ qÄWxT | D]L } | \ } } } } } } t |  | | d! | d! | | d! | d! | | ƒ qWd" S(#   sF  Set angle restraints on the specified nucleotides to match the Phenix pucker-specific restraints
    
    ARGUMENTS:
        molNum              - the molecule number
        chain               - the chain
        prevResNum          - the residue number of the previous residue (using Coot numbering)
        curResNum           - the residue number of the current residue (using Coot numbering)
        nextResNum          - the residue number of the next residue (using Coot numbering)
        glycosidicBaseAtom  - the name of the base nitrogen atom (N1 or N9) for the current residue
        prevPucker          - the pucker of the previous residue (as an int: 2 or 3)
        curPucker           - the pucker of the current residue (as an int: 2 or 3)
        nextPucker          - the pucker of the previous residue (as an int: 2 or 3)
    OPTIONAL ARGUMENTS:
        restrainNextRes     - whether we should add restraints for atoms of the next residue (other than the phosphate, which is always restrained)
                              Defaults to False
    RETURNS:
        None
    i   s    C3's    O3'g¢E¶óýÔö?g¸…ëQ¸Ž?i   gyé&1¬ö?s    P  gƒÀÊ¡E¶ù?s    C1's    C2'gÑ"Ûù~jø?gffffffø?s    C4'g;ßO�—nø?s    C5'g¾Ÿ/Ý$ø?s    O4'gÝ$�•C÷?g¤p=
×£ö?s    O5'gbX9´Èö?s    O2'gd;ßO�—ö?gq=
×£p÷?gX9´Èvø?g‘í|?5^ø?g¼t“Vø?gTã¥›Ä ø?gžï§ÆK7÷?g¸…ëQ¸ö?gš™™™™™÷?R   N(   R   R   R   R    (   R   R   R
   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    s^   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/rcrane/phenixRestraints.pyt   setBondRestraints�   s^    "%N(	   t   __doc__t   cootR    R   t   ImportErrorR   t   FalseR   R   (    (    (    s^   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/rcrane/phenixRestraints.pyt   <module>   s   
l