https://pymolwiki.org/index.php?title=Quick_dist&feed=atom&action=historyQuick dist - Revision history2024-03-29T14:03:51ZRevision history for this page on the wikiMediaWiki 1.35.7https://pymolwiki.org/index.php?title=Quick_dist&diff=8896&oldid=prevInchoate: Created page with "'''quick_dist''' will quickly find and write out the pairwise distances between two selections in PyMOL. On my machine this will write about 80,000 distance measures/second. <..."2011-02-07T15:29:25Z<p>Created page with "'''quick_dist''' will quickly find and write out the pairwise distances between two selections in PyMOL. On my machine this will write about 80,000 distance measures/second. <..."</p>
<p><b>New page</b></p><div>'''quick_dist''' will quickly find and write out the pairwise distances between two selections in PyMOL. On my machine this will write about 80,000 distance measures/second.<br />
<br />
<br />
<source lang="python"><br />
#<br />
# quick_dist.py<br />
#<br />
def quick_dist(s1, s2, inFile=None):<br />
import math<br />
m1 = cmd.get_model(s1)<br />
m2 = cmd.get_model(s2)<br />
<br />
if inFile!=None:<br />
f = open(inFile, 'w')<br />
f.write("ATOM1\tATOM2\tDIST\n")<br />
<br />
s=""<br />
<br />
for c1 in range(len(m1.atom)):<br />
for c2 in range(len(m2.atom)):<br />
s+="%s/%d\t%s/%d\t%3.2f\n" % (m1.atom[c1].name, m1.atom[c1].index,\<br />
m2.atom[c2].name, m2.atom[c2].index,\<br />
math.sqrt(sum(map(lambda f: (f[0]-f[1])**2, zip(a1.coord,a2.coord)))))<br />
<br />
if inFile!=None:<br />
f.write(s)<br />
f.close()<br />
else:<br />
print s<br />
<br />
<br />
cmd.extend("quick_dist", quick_dist)<br />
</source><br />
<br />
[[Category:Script_Library]]</div>Inchoate