<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=Translate_And_Measure</id>
	<title>Translate And Measure - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=Translate_And_Measure"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Translate_And_Measure&amp;action=history"/>
	<updated>2026-05-17T21:43:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Translate_And_Measure&amp;diff=9061&amp;oldid=prev</id>
		<title>Bell: 4 revisions</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Translate_And_Measure&amp;diff=9061&amp;oldid=prev"/>
		<updated>2014-03-28T03:36:21Z</updated>

		<summary type="html">&lt;p&gt;4 revisions&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;To use, you would call it like :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print translateAndMeasure(&amp;quot;molA&amp;quot;, &amp;quot;molB&amp;quot;, [1,0,0], 4)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
which would print &amp;quot;overlap&amp;quot; if any of the atoms in molA or molB were within&lt;br /&gt;
4 Angstrom after translating by 1 along X.&lt;br /&gt;
&lt;br /&gt;
Of course, this could be improved to report exactly ''which'' atoms were&lt;br /&gt;
overlapping, or to make distance objects (using cmd.distance) to show them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
def translateAndMeasure(selection, other, translationVector, cutoff):&lt;br /&gt;
    cmd.translate(translationVector, selection)&lt;br /&gt;
    return checkDistances(selection, other, cutoff)&lt;br /&gt;
&lt;br /&gt;
def checkDistances(moleculeA, moleculeB, cutoff):&lt;br /&gt;
    ids_A = getIds(moleculeA)&lt;br /&gt;
    ids_B = getIds(moleculeB)&lt;br /&gt;
    for idA in ids_A:&lt;br /&gt;
        for idB in idsB:&lt;br /&gt;
            d = distance(moleculeA, idA, moleculeB, idB)&lt;br /&gt;
            if d &amp;gt; cutoff: return &amp;quot;overlap&amp;quot;&lt;br /&gt;
    return &amp;quot;no overlap&amp;quot;&lt;br /&gt;
&lt;br /&gt;
def distance(a, idA, b, idB):&lt;br /&gt;
    atomA = &amp;quot;%s and id %s&amp;quot; % (a, idA)&lt;br /&gt;
    atomB = &amp;quot;%s and id %s&amp;quot; % (b, idB)&lt;br /&gt;
    return cmd.get_distance(atomA, atomB)&lt;br /&gt;
&lt;br /&gt;
def getIds(selection):&lt;br /&gt;
    my_dict = { 'my_list' : [] }&lt;br /&gt;
    cmd.iterate(selection, &amp;quot;my_list.append(ID)&amp;quot;, space=my_dict)&lt;br /&gt;
    return my_dict['my_list']&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:Script_Library|Translate and Measure]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>Bell</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Translate_And_Measure&amp;diff=9058&amp;oldid=prev</id>
		<title>Gilleain: removed the '3D' after all '=3D' - not sure why they were there!</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Translate_And_Measure&amp;diff=9058&amp;oldid=prev"/>
		<updated>2005-10-08T12:06:50Z</updated>

		<summary type="html">&lt;p&gt;removed the &amp;#039;3D&amp;#039; after all &amp;#039;=3D&amp;#039; - not sure why they were there!&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;To use, you would call it like :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print translateAndMeasure(&amp;quot;molA&amp;quot;, &amp;quot;molB&amp;quot;, [1,0,0], 4)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
which would print &amp;quot;overlap&amp;quot; if any of the atoms in molA or molB were within&lt;br /&gt;
4 Angstrom after translating by 1 along X.&lt;br /&gt;
&lt;br /&gt;
Of course, this could be improved to report exactly ''which'' atoms were&lt;br /&gt;
overlapping, or to make distance objects (using cmd.distance) to show them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
def translateAndMeasure(selection, other, translationVector, cutoff):&lt;br /&gt;
    cmd.translate(translationVector, selection)&lt;br /&gt;
    return checkDistances(selection, other, cutoff)&lt;br /&gt;
&lt;br /&gt;
def checkDistances(moleculeA, moleculeB, cutoff):&lt;br /&gt;
    ids_A = getIds(moleculeA)&lt;br /&gt;
    ids_B = getIds(moleculeB)&lt;br /&gt;
    for idA in ids_A:&lt;br /&gt;
        for idB in idsB:&lt;br /&gt;
            d = distance(moleculeA, idA, moleculeB, idB)&lt;br /&gt;
            if d &amp;gt; cutoff: return &amp;quot;overlap&amp;quot;&lt;br /&gt;
    return &amp;quot;no overlap&amp;quot;&lt;br /&gt;
&lt;br /&gt;
def distance(a, idA, b, idB):&lt;br /&gt;
    atomA = &amp;quot;%s and id %s&amp;quot; % (a, idA)&lt;br /&gt;
    atomB = &amp;quot;%s and id %s&amp;quot; % (b, idB)&lt;br /&gt;
    return cmd.get_distance(atomA, atomB)&lt;br /&gt;
&lt;br /&gt;
def getIds(selection):&lt;br /&gt;
    my_dict = { 'my_list' : [] }&lt;br /&gt;
    cmd.iterate(selection, &amp;quot;my_list.append(ID)&amp;quot;, space=my_dict)&lt;br /&gt;
    return my_dict['my_list']&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gilleain</name></author>
	</entry>
</feed>