<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On May 5, 2014, at 1:34 AM, chang YG <<a href="mailto:changyg2008@gmail.com">changyg2008@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi,<div><br></div><div>Thanks for taking time to answer the questions. Could you advise me of how to save distances using a python script.</div><div><br></div><div>Here is what I have:</div><div><br></div><div>
<div>from chimera import runCommand as rc</div><div>rc("open 1t4y")</div><div>rc("distance :33@H :34@H")</div></div><div>#how to save distance.</div></div></blockquote><div><br></div>Hi Yonggang,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>There are a few possibilities, but here's what I would do:</div><div><br></div><div>rc("open 1t4y")</div><div>rc("sel :33@H :34@H")</div><div>from chimera.selection import currentAtoms</div><div>a1, a2 = currentAtoms()</div><div>dist = a1.coord().distance(a2.coord())</div><div>from OpenSave import osOpen</div><div>f = open("~/dists", "w")</div><div>print>>f, a1, a2, diet</div><div>f.close()</div><div><br></div><div>The above will write the distance into a file named "dists" in your home directory. Now you obviously probably want to do this for a lot of distances and/or files. You should look at the simple Chimera programming primer for looping through files:</div><div><br></div><div><a href="http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html">Very Basic Chimera Programming Primer</a></div><div><br><blockquote type="cite"><div dir="ltr"><div>Another related question: how to save "rmsd" of two structures using a python script?</div></div></blockquote><br></div><div>The basic answer is by calling Midas.rmsd(atoms1, atoms2) to get the RMSD and saving that. The issue is how to get the two sets of atoms to send to that command, and that would depend on whether the structures have identical sets of atoms (<i>i.e.</i> they're different conformers), or if you know which atoms to match against which, or whether you need to discover the set of corresponding atoms using MatchMaker. Instead of explaining each in detail (two of which you won't care about), why don't you say which you need and I'll explain that one…</div><div><br></div><div>--Eric</div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> <span class="Apple-converted-space"> </span></span>Eric Pettersen</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> <span class="Apple-converted-space"> </span></span>UCSF Computer Graphics Lab</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> </span><a href="http://www.cgl.ucsf.edu">http://www.cgl.ucsf.edu</a></font></p><br class="Apple-interchange-newline"></span>
</div>
<br></body></html>