<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    next nightly build of Phenix should have this available in the
    command line (It's up to Nat when (and if) it's going to be
    available in the GUI).<br>
    <br>
    <b>phenix.angle:</b><br>
    &nbsp; Given PDB file and two atom selections that allow to define two
    lines compute<br>
    &nbsp; the angle between these two lines. If atom selection defines two
    points then<br>
    &nbsp; the line is defined uniquely and passes through these points. If
    atom<br>
    &nbsp; selection defines more than two points then line coincides with
    the longest<br>
    &nbsp; axis of the cloud of points.<br>
    <br>
    <b>Example 1:</b> two pairs of points are given to define two axes:<br>
    <br>
    phenix.angle model.pdb "chain A and (resseq 1 and name CA or resseq
    2 and name CA)" "chain B and (resseq 1 and name CA or resseq 2 and
    name CA)"<br>
    <br>
    Above, selection "chain A and (resseq 1 and name CA or resseq 2 and
    name CA)" selects two C-alpha atoms in residues 1 and 2 in chain A.
    <br>
    Analogously, "chain B and (resseq 1 and name CA or resseq 2 and name
    CA)" selects two C-alpha atoms in residues 1 and 2 in chain B.<br>
    Both atom selections define two lines, and the angle between these
    lines is output.<br>
    <br>
    <b>Example 2:</b> <br>
    &nbsp;<br>
    phenix.angle model.pdb "chain A" "chain B"<br>
    <br>
    Here "chain A" selects all atoms in chain A, similarly second
    selection does for chain B.<br>
    <br>
    <b>More Phenix atom selection syntax and examples:</b><br>
    <a class="moz-txt-link-freetext" href="http://www.phenix-online.org/documentation/refinement.htm#anch370">http://www.phenix-online.org/documentation/refinement.htm#anch370</a><br>
    <br>
    <b>Under the hood:</b><br>
    <br>
    If provided atom selections specify four points - two for each axis,
    then the angle is computed trivially.<br>
    <br>
    If provided atom selections specify more than two points to define
    axis, then the following is done:<br>
    <br>
    1) Select atoms corresponding to two selections;<br>
    <br>
    2) Assign selected atoms occupancy=1 and B=20, and move atoms into
    an orthorhombic box;<br>
    <br>
    3) Compute two Fourier maps of 4A resolution (perhaps 6A is even
    better!) corresponding to two sets of selected atoms;<br>
    <br>
    4) Sigma-scale each synthesis, and truncate {m=0, if m&lt;1, else
    m=m};<br>
    <br>
    5) For each of the two maps compute symmetric 3x3 matrix like this:
    <br>
    <br>
    <font face="Courier New, Courier, monospace">sum(xn-xc)**2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      sum(xn-xc)*(yn-xc)&nbsp;&nbsp; sum(xn-xc)*(zn-zc)
      <br>
      sum(xn-xc)*(yn-xc)&nbsp;&nbsp;&nbsp;&nbsp; sum(yn-yc)**2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sum(yn-yc)*(yz-zc)
      <br>
      sum(xn-xc)*(zn-zc)&nbsp;&nbsp;&nbsp;&nbsp; sum(yn-yc)*(yz-zc)&nbsp;&nbsp; sum(zn-zc)**2
      <br>
    </font><br>
    where (xn,yn,zn) is the coordinate of nth grid point, the sum is
    taken over all grid points in within the radius that is equal to the
    half of max length of the selected set of atoms, and (xc,yc,zc) is
    the coordinate of the center of mass.
    Each some above is weighted by map value.<br>
    <br>
    6) For each of the two matrices I would find its eigen-values and
    eigen-vectors, and select eigen-vectors corresponding to largest
    eigenvalues.
    <br>
    <br>
    7) The desired angle is the angle between the two eigen-vectors
    found in step 6.<br>
    <br>
    This may seem a bit convoluted but actual calculations take a
    fraction of a second, and the underlying code is just about 130
    lines (including i/o and documentation page).<br>
    <br>
    For those liking to dig in the code, the tests that exercise
    phenix.angle can be found here:<br>
    cctbx_project/mmtbx/regression/tst_phenix_angle.py<br>
    which basically define the scope of problems that I used so far to
    exercise the tool.<br>
    <br>
    I notices that a minimal fraction of a helix need to contain at
    least 5-6 residues: this typically provides 5% accuracy (of
    calculated angle using the above procedure compared to the known
    answer).<br>
    <br>
    Please let me know of any problems, bugs, feature requests and
    suggestions etc <b>off-list</b>.<br>
    <br>
    Pavel<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 1/20/14, 5:48 AM, &#26446;&#32724; wrote:<br>
    </div>
    <blockquote
cite="mid:CAE5L1v9jZM8Hfxt0KJww4+75AvKz9qEE_aA+b3CWpXAe8ZU6-Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>I have a DNA model which is composed of two DNA duplexes. I
          want to measure the angle between the two duplexes and if
          there a way to do it in PHENIX or in other software?</div>
        <div><br>
        </div>
        <div>Thanks you very much for your help!</div>
        <div><br>
        </div>
        <div>Sincerely,</div>
        <div>Xiang<br clear="all">
          <div><br>
          </div>
          -- <br>
          Li Xiang <br>
          Department of chemistry,<br>
          Purdue University<br>
          Email&#65306;<a moz-do-not-send="true"
            href="mailto:lixiang1642@gmail.com">lixiang1642@gmail.com</a><br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>