<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pymol.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=GianlucaTomasello</id>
	<title>PyMOL Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=GianlucaTomasello"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php/Special:Contributions/GianlucaTomasello"/>
	<updated>2026-08-19T16:18:51Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10196</id>
		<title>ShowLigandWaters</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10196"/>
		<updated>2013-09-02T09:54:34Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script-repo&lt;br /&gt;
|type      = script&lt;br /&gt;
|download  = &lt;br /&gt;
|author    = [[User:GianlucaTomasello|Gianluca Tomasello]]&lt;br /&gt;
|license   = [http://creativecommons.org/licenses/by-nc-sa/3.0 CC BY-NC-SA]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&amp;lt;br&amp;gt;&lt;br /&gt;
Detected water molecules are shown as spheres.&amp;lt;br&amp;gt;&lt;br /&gt;
Distances between water molecules and O or N atoms of ligand (potential H-bonds) are shown by dotted lines.&amp;lt;br&amp;gt;&lt;br /&gt;
An output file containing a list of distance between waters and ligand atoms and the number of interactions is written in the main PyMol folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
waters [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* '''ligand name''' = the ligand residue name&lt;br /&gt;
* '''distance''' = max distance in Angstroms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
'''example #1 on PDB structure (1C0L)'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;waters FAD, 2.8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Output in GUI of PyMol:&lt;br /&gt;
&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
 &lt;br /&gt;
output file: waters.txt&lt;br /&gt;
&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O1P']  ---&amp;gt;  2.611289 A&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O5B']  ---&amp;gt;  3.592691 A&lt;br /&gt;
HOH residue 2008 -- and -- ['FAD', '1363', 'O1A']  ---&amp;gt;  2.678604 A&lt;br /&gt;
HOH residue 2009 -- and -- ['FAD', '1363', 'O2P']  ---&amp;gt;  2.643039 A&lt;br /&gt;
-------------------------------------------------------------&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
&lt;br /&gt;
[[File:Example 1 FAD 1C0L.png|450px|example #1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&lt;br /&gt;
Copy the following text and save it as waters.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# -*- coding: cp1252 -*-&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown.&lt;br /&gt;
&lt;br /&gt;
Author: Gianluca Tomasello, Gianluca Molla&lt;br /&gt;
University of Insubria, Varese, Italy&lt;br /&gt;
09/02/2013&lt;br /&gt;
gianluca.molla@uninsubria.it&lt;br /&gt;
&lt;br /&gt;
Usage&lt;br /&gt;
waters, [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
&lt;br /&gt;
ligand : the ligand residue name &lt;br /&gt;
&lt;br /&gt;
distance : a float number that specify the maximum distance from the ligand to consider the water molecule&lt;br /&gt;
           &lt;br /&gt;
Output&lt;br /&gt;
-A file is produced containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
-A graphic output show the water molecules interacting whith the ligand atoms by showing the distances between them&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd,stored&lt;br /&gt;
#define function: waters&lt;br /&gt;
def waters(ligand, distance):&lt;br /&gt;
    stored.HOH = [] &lt;br /&gt;
    cmd.set('label_color','white') &lt;br /&gt;
    cmd.delete (&amp;quot;sele&amp;quot;)&lt;br /&gt;
    cmd.hide (&amp;quot;everything&amp;quot;)&lt;br /&gt;
    cmd.show_as (&amp;quot;sticks&amp;quot;, &amp;quot;resn %s&amp;quot; % ligand)&lt;br /&gt;
    #iterate all water molecules nearby the ligand&lt;br /&gt;
    cmd.iterate('resn %s around %s and resn HOH' % (ligand,distance),'stored.HOH.append(resi)') &lt;br /&gt;
    f = open(&amp;quot;waters.txt&amp;quot;,&amp;quot;a&amp;quot;)&lt;br /&gt;
    count=0&lt;br /&gt;
    count_int=0&lt;br /&gt;
    &lt;br /&gt;
    for i in range(0,len(stored.HOH)):        &lt;br /&gt;
        cmd.distance('dist_HOH_FAD', 'resi ' + stored.HOH[i], '(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]))&lt;br /&gt;
        stored.name = []&lt;br /&gt;
        #iterate all ligand atoms within a predetermined distance from the water molecule&lt;br /&gt;
        cmd.iterate('(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]),'stored.name.append([resn,resi,name])') &lt;br /&gt;
&lt;br /&gt;
        if stored.name:           &lt;br /&gt;
            count = count+1&lt;br /&gt;
            count_int = count_int+len(stored.name)&lt;br /&gt;
&lt;br /&gt;
        for j in range(0,len(stored.name)):            &lt;br /&gt;
            cmd.select('base', 'resi ' + stored.HOH[i])&lt;br /&gt;
            cmd.select('var','resn '+ligand+ ' and n. ' + stored.name[j][2]) &lt;br /&gt;
            #calculate the distance between a specific atom and the water molecule&lt;br /&gt;
            dist = cmd.get_distance('base','var')            &lt;br /&gt;
            f.write('HOH residue %s -- and -- %s  ---&amp;gt;  %f A\n'%(stored.HOH[i],stored.name[j], dist))  &lt;br /&gt;
&lt;br /&gt;
    cmd.select (&amp;quot;waters&amp;quot;,&amp;quot;resn %s around %s and resn HOH&amp;quot; % (ligand,distance))&lt;br /&gt;
    cmd.show_as (&amp;quot;spheres&amp;quot;, &amp;quot;waters&amp;quot;)&lt;br /&gt;
    cmd.zoom (&amp;quot;visible&amp;quot;)&lt;br /&gt;
    num_atm = cmd.count_atoms (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    print (&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    print (&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % (count))&lt;br /&gt;
    print (&amp;quot;Number of interactions between water molecules and ligand: %d\n&amp;quot; % count_int)&lt;br /&gt;
    f.write('-------------------------------------------------------------\n')&lt;br /&gt;
    f.write(&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    f.write(&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % count)&lt;br /&gt;
    f.write(&amp;quot;Number of interactions between water molecules and ligand: %d\n\n\n\n&amp;quot; % count_int)&lt;br /&gt;
    f.close()&lt;br /&gt;
    cmd.delete (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
cmd.extend(&amp;quot;waters&amp;quot;,waters)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;br /&gt;
[[Category:Biochemical_Scripts]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10195</id>
		<title>ShowLigandWaters</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10195"/>
		<updated>2013-09-02T09:52:04Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script-repo&lt;br /&gt;
|type      = script&lt;br /&gt;
|download  = &lt;br /&gt;
|author    = [[User:GianlucaTomasello|Gianluca Tomasello]]&lt;br /&gt;
|license   = [http://creativecommons.org/licenses/by-nc-sa/3.0 CC BY-NC-SA]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&amp;lt;br&amp;gt;&lt;br /&gt;
Detected water molecules are shown as spheres.&amp;lt;br&amp;gt;&lt;br /&gt;
Distances between water molecules and O or N atoms of ligand (potential H-bonds) are shown by dotted lines.&amp;lt;br&amp;gt;&lt;br /&gt;
An output file containing a list of distance between waters and ligand atoms and the number of interactions is written in the main PyMol folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
waters [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* '''ligand name''' = the ligand residue name&lt;br /&gt;
* '''distance''' = max distance in Angstroms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
'''example #1 on PDB structure (1C0L)'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;waters FAD, 2.8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Output in GUI of PyMol:&lt;br /&gt;
&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
 &lt;br /&gt;
output file: waters.txt&lt;br /&gt;
&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O1P']  ---&amp;gt;  2.611289 A&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O5B']  ---&amp;gt;  3.592691 A&lt;br /&gt;
HOH residue 2008 -- and -- ['FAD', '1363', 'O1A']  ---&amp;gt;  2.678604 A&lt;br /&gt;
HOH residue 2009 -- and -- ['FAD', '1363', 'O2P']  ---&amp;gt;  2.643039 A&lt;br /&gt;
-------------------------------------------------------------&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
&lt;br /&gt;
[[File:Example 1 FAD 1C0L.png|450px|example #1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&lt;br /&gt;
Copy the following text and save it as waters.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# -*- coding: cp1252 -*-&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown.&lt;br /&gt;
&lt;br /&gt;
Usage&lt;br /&gt;
waters, [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
&lt;br /&gt;
ligand : the ligand residue name &lt;br /&gt;
&lt;br /&gt;
distance : a float number that specify the maximum distance from the ligand to consider the water molecule&lt;br /&gt;
           &lt;br /&gt;
Output&lt;br /&gt;
-A file is produced containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
-A graphic output show the water molecules interacting whith the ligand atoms by showing the distances between them&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd,stored&lt;br /&gt;
#define function: waters&lt;br /&gt;
def waters(ligand, distance):&lt;br /&gt;
    stored.HOH = [] &lt;br /&gt;
    cmd.set('label_color','white') &lt;br /&gt;
    cmd.delete (&amp;quot;sele&amp;quot;)&lt;br /&gt;
    cmd.hide (&amp;quot;everything&amp;quot;)&lt;br /&gt;
    cmd.show_as (&amp;quot;sticks&amp;quot;, &amp;quot;resn %s&amp;quot; % ligand)&lt;br /&gt;
    #iterate all water molecules nearby the ligand&lt;br /&gt;
    cmd.iterate('resn %s around %s and resn HOH' % (ligand,distance),'stored.HOH.append(resi)') &lt;br /&gt;
    f = open(&amp;quot;waters.txt&amp;quot;,&amp;quot;a&amp;quot;)&lt;br /&gt;
    count=0&lt;br /&gt;
    count_int=0&lt;br /&gt;
    &lt;br /&gt;
    for i in range(0,len(stored.HOH)):        &lt;br /&gt;
        cmd.distance('dist_HOH_FAD', 'resi ' + stored.HOH[i], '(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]))&lt;br /&gt;
        stored.name = []&lt;br /&gt;
        #iterate all ligand atoms within a predetermined distance from the water molecule&lt;br /&gt;
        cmd.iterate('(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]),'stored.name.append([resn,resi,name])') &lt;br /&gt;
&lt;br /&gt;
        if stored.name:           &lt;br /&gt;
            count = count+1&lt;br /&gt;
            count_int = count_int+len(stored.name)&lt;br /&gt;
&lt;br /&gt;
        for j in range(0,len(stored.name)):            &lt;br /&gt;
            cmd.select('base', 'resi ' + stored.HOH[i])&lt;br /&gt;
            cmd.select('var','resn '+ligand+ ' and n. ' + stored.name[j][2]) &lt;br /&gt;
            #calculate the distance between a specific atom and the water molecule&lt;br /&gt;
            dist = cmd.get_distance('base','var')            &lt;br /&gt;
            f.write('HOH residue %s -- and -- %s  ---&amp;gt;  %f A\n'%(stored.HOH[i],stored.name[j], dist))  &lt;br /&gt;
&lt;br /&gt;
    cmd.select (&amp;quot;waters&amp;quot;,&amp;quot;resn %s around %s and resn HOH&amp;quot; % (ligand,distance))&lt;br /&gt;
    cmd.show_as (&amp;quot;spheres&amp;quot;, &amp;quot;waters&amp;quot;)&lt;br /&gt;
    cmd.zoom (&amp;quot;visible&amp;quot;)&lt;br /&gt;
    num_atm = cmd.count_atoms (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    print (&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    print (&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % (count))&lt;br /&gt;
    print (&amp;quot;Number of interactions between water molecules and ligand: %d\n&amp;quot; % count_int)&lt;br /&gt;
    f.write('-------------------------------------------------------------\n')&lt;br /&gt;
    f.write(&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    f.write(&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % count)&lt;br /&gt;
    f.write(&amp;quot;Number of interactions between water molecules and ligand: %d\n\n\n\n&amp;quot; % count_int)&lt;br /&gt;
    f.close()&lt;br /&gt;
    cmd.delete (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
cmd.extend(&amp;quot;waters&amp;quot;,waters)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;br /&gt;
[[Category:Biochemical_Scripts]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10194</id>
		<title>ShowLigandWaters</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10194"/>
		<updated>2013-09-02T09:49:35Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script-repo&lt;br /&gt;
|type      = script&lt;br /&gt;
|download  = &lt;br /&gt;
|author    = [[User:GianlucaTomasello|Gianluca Tomasello]]&lt;br /&gt;
|license   = [http://creativecommons.org/licenses/by-nc-sa/3.0 CC BY-NC-SA]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&amp;lt;br&amp;gt;&lt;br /&gt;
Detected water molecules are shown as spheres.&amp;lt;br&amp;gt;&lt;br /&gt;
Distances between &amp;lt;b&amp;gt;water&amp;lt;\b&amp;gt; molecules and O or N atoms of ligand (potential H-bonds) are shown by dotted lines and is maked an output file containing a list of distance between waters and ligand atoms and the number of interactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
waters [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* '''ligand name''' = the ligand residue name&lt;br /&gt;
* '''distance''' = max distance in Angstroms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
'''example #1 on PDB structure (1C0L)'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;waters FAD, 2.8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Output in GUI of PyMol:&lt;br /&gt;
&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
 &lt;br /&gt;
output file: waters.txt&lt;br /&gt;
&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O1P']  ---&amp;gt;  2.611289 A&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O5B']  ---&amp;gt;  3.592691 A&lt;br /&gt;
HOH residue 2008 -- and -- ['FAD', '1363', 'O1A']  ---&amp;gt;  2.678604 A&lt;br /&gt;
HOH residue 2009 -- and -- ['FAD', '1363', 'O2P']  ---&amp;gt;  2.643039 A&lt;br /&gt;
-------------------------------------------------------------&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
&lt;br /&gt;
[[File:Example 1 FAD 1C0L.png|450px|example #1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&lt;br /&gt;
Copy the following text and save it as waters.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# -*- coding: cp1252 -*-&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown.&lt;br /&gt;
&lt;br /&gt;
Usage&lt;br /&gt;
waters, [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
&lt;br /&gt;
ligand : the ligand residue name &lt;br /&gt;
&lt;br /&gt;
distance : a float number that specify the maximum distance from the ligand to consider the water molecule&lt;br /&gt;
           &lt;br /&gt;
Output&lt;br /&gt;
-A file is produced containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
-A graphic output show the water molecules interacting whith the ligand atoms by showing the distances between them&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd,stored&lt;br /&gt;
#define function: waters&lt;br /&gt;
def waters(ligand, distance):&lt;br /&gt;
    stored.HOH = [] &lt;br /&gt;
    cmd.set('label_color','white') &lt;br /&gt;
    cmd.delete (&amp;quot;sele&amp;quot;)&lt;br /&gt;
    cmd.hide (&amp;quot;everything&amp;quot;)&lt;br /&gt;
    cmd.show_as (&amp;quot;sticks&amp;quot;, &amp;quot;resn %s&amp;quot; % ligand)&lt;br /&gt;
    #iterate all water molecules nearby the ligand&lt;br /&gt;
    cmd.iterate('resn %s around %s and resn HOH' % (ligand,distance),'stored.HOH.append(resi)') &lt;br /&gt;
    f = open(&amp;quot;waters.txt&amp;quot;,&amp;quot;a&amp;quot;)&lt;br /&gt;
    count=0&lt;br /&gt;
    count_int=0&lt;br /&gt;
    &lt;br /&gt;
    for i in range(0,len(stored.HOH)):        &lt;br /&gt;
        cmd.distance('dist_HOH_FAD', 'resi ' + stored.HOH[i], '(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]))&lt;br /&gt;
        stored.name = []&lt;br /&gt;
        #iterate all ligand atoms within a predetermined distance from the water molecule&lt;br /&gt;
        cmd.iterate('(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]),'stored.name.append([resn,resi,name])') &lt;br /&gt;
&lt;br /&gt;
        if stored.name:           &lt;br /&gt;
            count = count+1&lt;br /&gt;
            count_int = count_int+len(stored.name)&lt;br /&gt;
&lt;br /&gt;
        for j in range(0,len(stored.name)):            &lt;br /&gt;
            cmd.select('base', 'resi ' + stored.HOH[i])&lt;br /&gt;
            cmd.select('var','resn '+ligand+ ' and n. ' + stored.name[j][2]) &lt;br /&gt;
            #calculate the distance between a specific atom and the water molecule&lt;br /&gt;
            dist = cmd.get_distance('base','var')            &lt;br /&gt;
            f.write('HOH residue %s -- and -- %s  ---&amp;gt;  %f A\n'%(stored.HOH[i],stored.name[j], dist))  &lt;br /&gt;
&lt;br /&gt;
    cmd.select (&amp;quot;waters&amp;quot;,&amp;quot;resn %s around %s and resn HOH&amp;quot; % (ligand,distance))&lt;br /&gt;
    cmd.show_as (&amp;quot;spheres&amp;quot;, &amp;quot;waters&amp;quot;)&lt;br /&gt;
    cmd.zoom (&amp;quot;visible&amp;quot;)&lt;br /&gt;
    num_atm = cmd.count_atoms (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    print (&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    print (&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % (count))&lt;br /&gt;
    print (&amp;quot;Number of interactions between water molecules and ligand: %d\n&amp;quot; % count_int)&lt;br /&gt;
    f.write('-------------------------------------------------------------\n')&lt;br /&gt;
    f.write(&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    f.write(&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % count)&lt;br /&gt;
    f.write(&amp;quot;Number of interactions between water molecules and ligand: %d\n\n\n\n&amp;quot; % count_int)&lt;br /&gt;
    f.close()&lt;br /&gt;
    cmd.delete (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
cmd.extend(&amp;quot;waters&amp;quot;,waters)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;br /&gt;
[[Category:Biochemical_Scripts]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10193</id>
		<title>ShowLigandWaters</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10193"/>
		<updated>2013-09-02T09:42:21Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script-repo&lt;br /&gt;
|type      = script&lt;br /&gt;
|download  = &lt;br /&gt;
|author    = [[User:GianlucaTomasello|Gianluca Tomasello]]&lt;br /&gt;
|license   = [http://creativecommons.org/licenses/by-nc-sa/3.0 CC BY-NC-SA]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Detected water molecules are shown as spheres.&lt;br /&gt;
Distances between water molecules and O or N atoms of ligand (potential H-bonds) are shown by dotted lines and is maked an output file containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
waters [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* '''ligand name''' = the ligand residue name&lt;br /&gt;
* '''distance''' = max distance in Angstroms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
'''example #1 on PDB structure (1C0L)'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;waters FAD, 2.8&lt;br /&gt;
&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
 &lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
output file: waters.txt&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O1P']  ---&amp;gt;  2.611289 A&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O5B']  ---&amp;gt;  3.592691 A&lt;br /&gt;
HOH residue 2008 -- and -- ['FAD', '1363', 'O1A']  ---&amp;gt;  2.678604 A&lt;br /&gt;
HOH residue 2009 -- and -- ['FAD', '1363', 'O2P']  ---&amp;gt;  2.643039 A&lt;br /&gt;
-------------------------------------------------------------&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Example 1 FAD 1C0L.png|450px|example #1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&lt;br /&gt;
Copy the following text and save it as waters.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# -*- coding: cp1252 -*-&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown.&lt;br /&gt;
&lt;br /&gt;
Usage&lt;br /&gt;
waters, [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
&lt;br /&gt;
ligand : the ligand residue name &lt;br /&gt;
&lt;br /&gt;
distance : a float number that specify the maximum distance from the ligand to consider the water molecule&lt;br /&gt;
           &lt;br /&gt;
Output&lt;br /&gt;
-A file is produced containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
-A graphic output show the water molecules interacting whith the ligand atoms by showing the distances between them&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd,stored&lt;br /&gt;
#define function: waters&lt;br /&gt;
def waters(ligand, distance):&lt;br /&gt;
    stored.HOH = [] &lt;br /&gt;
    cmd.set('label_color','white') &lt;br /&gt;
    cmd.delete (&amp;quot;sele&amp;quot;)&lt;br /&gt;
    cmd.hide (&amp;quot;everything&amp;quot;)&lt;br /&gt;
    cmd.show_as (&amp;quot;sticks&amp;quot;, &amp;quot;resn %s&amp;quot; % ligand)&lt;br /&gt;
    #iterate all water molecules nearby the ligand&lt;br /&gt;
    cmd.iterate('resn %s around %s and resn HOH' % (ligand,distance),'stored.HOH.append(resi)') &lt;br /&gt;
    f = open(&amp;quot;waters.txt&amp;quot;,&amp;quot;a&amp;quot;)&lt;br /&gt;
    count=0&lt;br /&gt;
    count_int=0&lt;br /&gt;
    &lt;br /&gt;
    for i in range(0,len(stored.HOH)):        &lt;br /&gt;
        cmd.distance('dist_HOH_FAD', 'resi ' + stored.HOH[i], '(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]))&lt;br /&gt;
        stored.name = []&lt;br /&gt;
        #iterate all ligand atoms within a predetermined distance from the water molecule&lt;br /&gt;
        cmd.iterate('(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]),'stored.name.append([resn,resi,name])') &lt;br /&gt;
&lt;br /&gt;
        if stored.name:           &lt;br /&gt;
            count = count+1&lt;br /&gt;
            count_int = count_int+len(stored.name)&lt;br /&gt;
&lt;br /&gt;
        for j in range(0,len(stored.name)):            &lt;br /&gt;
            cmd.select('base', 'resi ' + stored.HOH[i])&lt;br /&gt;
            cmd.select('var','resn '+ligand+ ' and n. ' + stored.name[j][2]) &lt;br /&gt;
            #calculate the distance between a specific atom and the water molecule&lt;br /&gt;
            dist = cmd.get_distance('base','var')            &lt;br /&gt;
            f.write('HOH residue %s -- and -- %s  ---&amp;gt;  %f A\n'%(stored.HOH[i],stored.name[j], dist))  &lt;br /&gt;
&lt;br /&gt;
    cmd.select (&amp;quot;waters&amp;quot;,&amp;quot;resn %s around %s and resn HOH&amp;quot; % (ligand,distance))&lt;br /&gt;
    cmd.show_as (&amp;quot;spheres&amp;quot;, &amp;quot;waters&amp;quot;)&lt;br /&gt;
    cmd.zoom (&amp;quot;visible&amp;quot;)&lt;br /&gt;
    num_atm = cmd.count_atoms (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    print (&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    print (&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % (count))&lt;br /&gt;
    print (&amp;quot;Number of interactions between water molecules and ligand: %d\n&amp;quot; % count_int)&lt;br /&gt;
    f.write('-------------------------------------------------------------\n')&lt;br /&gt;
    f.write(&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    f.write(&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % count)&lt;br /&gt;
    f.write(&amp;quot;Number of interactions between water molecules and ligand: %d\n\n\n\n&amp;quot; % count_int)&lt;br /&gt;
    f.close()&lt;br /&gt;
    cmd.delete (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
cmd.extend(&amp;quot;waters&amp;quot;,waters)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;br /&gt;
[[Category:Biochemical_Scripts]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10192</id>
		<title>ShowLigandWaters</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10192"/>
		<updated>2013-09-02T09:28:23Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script-repo&lt;br /&gt;
|type      = script&lt;br /&gt;
|download  = &lt;br /&gt;
|author    = [[User:GianlucaTomasello|Gianluca Tomasello]]&lt;br /&gt;
|license   = [http://creativecommons.org/licenses/by-nc-sa/3.0 CC BY-NC-SA]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown and is maked an output file containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
waters [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* '''ligand name''' = the ligand residue name&lt;br /&gt;
* '''distance''' = max distance in Angstroms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
'''example #1 on PDB structure (1C0L)'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;waters FAD, 2.8&lt;br /&gt;
&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
 &lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
output file: waters.txt&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O1P']  ---&amp;gt;  2.611289 A&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O5B']  ---&amp;gt;  3.592691 A&lt;br /&gt;
HOH residue 2008 -- and -- ['FAD', '1363', 'O1A']  ---&amp;gt;  2.678604 A&lt;br /&gt;
HOH residue 2009 -- and -- ['FAD', '1363', 'O2P']  ---&amp;gt;  2.643039 A&lt;br /&gt;
-------------------------------------------------------------&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Example 1 FAD 1C0L.png|450px|example #1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&lt;br /&gt;
Copy the following text and save it as waters.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# -*- coding: cp1252 -*-&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown.&lt;br /&gt;
&lt;br /&gt;
Usage&lt;br /&gt;
waters, [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
&lt;br /&gt;
ligand : the ligand residue name &lt;br /&gt;
&lt;br /&gt;
distance : a float number that specify the maximum distance from the ligand to consider the water molecule&lt;br /&gt;
           &lt;br /&gt;
Output&lt;br /&gt;
-A file is produced containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
-A graphic output show the water molecules interacting whith the ligand atoms by showing the distances between them&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd,stored&lt;br /&gt;
#define function: waters&lt;br /&gt;
def waters(ligand, distance):&lt;br /&gt;
    stored.HOH = [] &lt;br /&gt;
    cmd.set('label_color','white') &lt;br /&gt;
    cmd.delete (&amp;quot;sele&amp;quot;)&lt;br /&gt;
    cmd.hide (&amp;quot;everything&amp;quot;)&lt;br /&gt;
    cmd.show_as (&amp;quot;sticks&amp;quot;, &amp;quot;resn %s&amp;quot; % ligand)&lt;br /&gt;
    #iterate all water molecules nearby the ligand&lt;br /&gt;
    cmd.iterate('resn %s around %s and resn HOH' % (ligand,distance),'stored.HOH.append(resi)') &lt;br /&gt;
    f = open(&amp;quot;waters.txt&amp;quot;,&amp;quot;a&amp;quot;)&lt;br /&gt;
    count=0&lt;br /&gt;
    count_int=0&lt;br /&gt;
    &lt;br /&gt;
    for i in range(0,len(stored.HOH)):        &lt;br /&gt;
        cmd.distance('dist_HOH_FAD', 'resi ' + stored.HOH[i], '(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]))&lt;br /&gt;
        stored.name = []&lt;br /&gt;
        #iterate all ligand atoms within a predetermined distance from the water molecule&lt;br /&gt;
        cmd.iterate('(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]),'stored.name.append([resn,resi,name])') &lt;br /&gt;
&lt;br /&gt;
        if stored.name:           &lt;br /&gt;
            count = count+1&lt;br /&gt;
            count_int = count_int+len(stored.name)&lt;br /&gt;
&lt;br /&gt;
        for j in range(0,len(stored.name)):            &lt;br /&gt;
            cmd.select('base', 'resi ' + stored.HOH[i])&lt;br /&gt;
            cmd.select('var','resn '+ligand+ ' and n. ' + stored.name[j][2]) &lt;br /&gt;
            #calculate the distance between a specific atom and the water molecule&lt;br /&gt;
            dist = cmd.get_distance('base','var')            &lt;br /&gt;
            f.write('HOH residue %s -- and -- %s  ---&amp;gt;  %f A\n'%(stored.HOH[i],stored.name[j], dist))  &lt;br /&gt;
&lt;br /&gt;
    cmd.select (&amp;quot;waters&amp;quot;,&amp;quot;resn %s around %s and resn HOH&amp;quot; % (ligand,distance))&lt;br /&gt;
    cmd.show_as (&amp;quot;spheres&amp;quot;, &amp;quot;waters&amp;quot;)&lt;br /&gt;
    cmd.zoom (&amp;quot;visible&amp;quot;)&lt;br /&gt;
    num_atm = cmd.count_atoms (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    print (&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    print (&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % (count))&lt;br /&gt;
    print (&amp;quot;Number of interactions between water molecules and ligand: %d\n&amp;quot; % count_int)&lt;br /&gt;
    f.write('-------------------------------------------------------------\n')&lt;br /&gt;
    f.write(&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    f.write(&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % count)&lt;br /&gt;
    f.write(&amp;quot;Number of interactions between water molecules and ligand: %d\n\n\n\n&amp;quot; % count_int)&lt;br /&gt;
    f.close()&lt;br /&gt;
    cmd.delete (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
cmd.extend(&amp;quot;waters&amp;quot;,waters)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;br /&gt;
[[Category:Biochemical_Scripts]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10191</id>
		<title>ShowLigandWaters</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10191"/>
		<updated>2013-09-02T09:17:23Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script-repo&lt;br /&gt;
|type      = script&lt;br /&gt;
|download  = &lt;br /&gt;
|author    = [[User:GianlucaTomasello|Gianluca Tomasello]]&lt;br /&gt;
|license   = [http://creativecommons.org/licenses/by-nc-sa/3.0 CC BY-NC-SA]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown and is maked an output file containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
waters [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* '''ligand name''' = the ligand residue name&lt;br /&gt;
* '''distance''' = max distance in Angstroms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
'''example #1 on PDB structure (1C0L)'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;waters FAD, 2.8&lt;br /&gt;
&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
 &lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
output file: waters.txt&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O1P']  ---&amp;gt;  2.611289 A&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O5B']  ---&amp;gt;  3.592691 A&lt;br /&gt;
HOH residue 2008 -- and -- ['FAD', '1363', 'O1A']  ---&amp;gt;  2.678604 A&lt;br /&gt;
HOH residue 2009 -- and -- ['FAD', '1363', 'O2P']  ---&amp;gt;  2.643039 A&lt;br /&gt;
-------------------------------------------------------------&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Example 1 FAD 1C0L.png|450px|example #1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&lt;br /&gt;
Copy the following text and save it as waters.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# -*- coding: cp1252 -*-&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown.&lt;br /&gt;
&lt;br /&gt;
Usage&lt;br /&gt;
waters, [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
&lt;br /&gt;
ligand : the ligand residue name &lt;br /&gt;
&lt;br /&gt;
distance : a float number that specify the maximum distance from the ligand to consider the water molecule&lt;br /&gt;
           &lt;br /&gt;
Output&lt;br /&gt;
-A file is produced containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
-A graphic output share the water molecules interacting whith the ligand atoms by showing the distances between them&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd,stored&lt;br /&gt;
#define function: waters&lt;br /&gt;
def waters(ligand, distance):&lt;br /&gt;
    stored.HOH = [] &lt;br /&gt;
    cmd.set('label_color','white') &lt;br /&gt;
    cmd.delete (&amp;quot;sele&amp;quot;)&lt;br /&gt;
    cmd.hide (&amp;quot;everything&amp;quot;)&lt;br /&gt;
    cmd.show_as (&amp;quot;sticks&amp;quot;, &amp;quot;resn %s&amp;quot; % ligand)&lt;br /&gt;
    #iterate all water molecules nearby the ligand&lt;br /&gt;
    cmd.iterate('resn %s around %s and resn HOH' % (ligand,distance),'stored.HOH.append(resi)') &lt;br /&gt;
    f = open(&amp;quot;waters.txt&amp;quot;,&amp;quot;a&amp;quot;)&lt;br /&gt;
    count=0&lt;br /&gt;
    count_int=0&lt;br /&gt;
    &lt;br /&gt;
    for i in range(0,len(stored.HOH)):        &lt;br /&gt;
        cmd.distance('dist_HOH_FAD', 'resi ' + stored.HOH[i], '(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]))&lt;br /&gt;
        stored.name = []&lt;br /&gt;
        #iterate all ligand atoms within a predetermined distance from the water molecule&lt;br /&gt;
        cmd.iterate('(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]),'stored.name.append([resn,resi,name])') &lt;br /&gt;
&lt;br /&gt;
        if stored.name:           &lt;br /&gt;
            count = count+1&lt;br /&gt;
            count_int = count_int+len(stored.name)&lt;br /&gt;
&lt;br /&gt;
        for j in range(0,len(stored.name)):            &lt;br /&gt;
            cmd.select('base', 'resi ' + stored.HOH[i])&lt;br /&gt;
            cmd.select('var','resn '+ligand+ ' and n. ' + stored.name[j][2]) &lt;br /&gt;
            #calculate the distance between a specific atom and the water molecule&lt;br /&gt;
            dist = cmd.get_distance('base','var')            &lt;br /&gt;
            f.write('HOH residue %s -- and -- %s  ---&amp;gt;  %f A\n'%(stored.HOH[i],stored.name[j], dist))  &lt;br /&gt;
&lt;br /&gt;
    cmd.select (&amp;quot;waters&amp;quot;,&amp;quot;resn %s around %s and resn HOH&amp;quot; % (ligand,distance))&lt;br /&gt;
    cmd.show_as (&amp;quot;spheres&amp;quot;, &amp;quot;waters&amp;quot;)&lt;br /&gt;
    cmd.zoom (&amp;quot;visible&amp;quot;)&lt;br /&gt;
    num_atm = cmd.count_atoms (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    print (&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    print (&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % (count))&lt;br /&gt;
    print (&amp;quot;Number of interactions between water molecules and ligand: %d\n&amp;quot; % count_int)&lt;br /&gt;
    f.write('-------------------------------------------------------------\n')&lt;br /&gt;
    f.write(&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    f.write(&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % count)&lt;br /&gt;
    f.write(&amp;quot;Number of interactions between water molecules and ligand: %d\n\n\n\n&amp;quot; % count_int)&lt;br /&gt;
    f.close()&lt;br /&gt;
    cmd.delete (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
cmd.extend(&amp;quot;waters&amp;quot;,waters)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;br /&gt;
[[Category:Biochemical_Scripts]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10190</id>
		<title>ShowLigandWaters</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10190"/>
		<updated>2013-09-02T09:16:58Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script-repo&lt;br /&gt;
|type      = script&lt;br /&gt;
|download  = &lt;br /&gt;
|author    = [[User:GianlucaTomasello|Gianluca Tomasello]]&lt;br /&gt;
|license   = [http://creativecommons.org/licenses/by-nc-sa/3.0 CC BY-NC-SA]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown and is maked an output file containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
waters [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* '''ligand name''' = the ligand residue name&lt;br /&gt;
* '''distance''' = max distance in Angstroms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
'''example #1 on PDB structure (1C0L)'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;waters FAD, 2.8&lt;br /&gt;
&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
 &lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
output file: waters.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O1P']  ---&amp;gt;  2.611289 A&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O5B']  ---&amp;gt;  3.592691 A&lt;br /&gt;
HOH residue 2008 -- and -- ['FAD', '1363', 'O1A']  ---&amp;gt;  2.678604 A&lt;br /&gt;
HOH residue 2009 -- and -- ['FAD', '1363', 'O2P']  ---&amp;gt;  2.643039 A&lt;br /&gt;
-------------------------------------------------------------&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Example 1 FAD 1C0L.png|450px|example #1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&lt;br /&gt;
Copy the following text and save it as waters.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# -*- coding: cp1252 -*-&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown.&lt;br /&gt;
&lt;br /&gt;
Usage&lt;br /&gt;
waters, [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
&lt;br /&gt;
ligand : the ligand residue name &lt;br /&gt;
&lt;br /&gt;
distance : a float number that specify the maximum distance from the ligand to consider the water molecule&lt;br /&gt;
           &lt;br /&gt;
Output&lt;br /&gt;
-A file is produced containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
-A graphic output share the water molecules interacting whith the ligand atoms by showing the distances between them&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd,stored&lt;br /&gt;
#define function: waters&lt;br /&gt;
def waters(ligand, distance):&lt;br /&gt;
    stored.HOH = [] &lt;br /&gt;
    cmd.set('label_color','white') &lt;br /&gt;
    cmd.delete (&amp;quot;sele&amp;quot;)&lt;br /&gt;
    cmd.hide (&amp;quot;everything&amp;quot;)&lt;br /&gt;
    cmd.show_as (&amp;quot;sticks&amp;quot;, &amp;quot;resn %s&amp;quot; % ligand)&lt;br /&gt;
    #iterate all water molecules nearby the ligand&lt;br /&gt;
    cmd.iterate('resn %s around %s and resn HOH' % (ligand,distance),'stored.HOH.append(resi)') &lt;br /&gt;
    f = open(&amp;quot;waters.txt&amp;quot;,&amp;quot;a&amp;quot;)&lt;br /&gt;
    count=0&lt;br /&gt;
    count_int=0&lt;br /&gt;
    &lt;br /&gt;
    for i in range(0,len(stored.HOH)):        &lt;br /&gt;
        cmd.distance('dist_HOH_FAD', 'resi ' + stored.HOH[i], '(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]))&lt;br /&gt;
        stored.name = []&lt;br /&gt;
        #iterate all ligand atoms within a predetermined distance from the water molecule&lt;br /&gt;
        cmd.iterate('(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]),'stored.name.append([resn,resi,name])') &lt;br /&gt;
&lt;br /&gt;
        if stored.name:           &lt;br /&gt;
            count = count+1&lt;br /&gt;
            count_int = count_int+len(stored.name)&lt;br /&gt;
&lt;br /&gt;
        for j in range(0,len(stored.name)):            &lt;br /&gt;
            cmd.select('base', 'resi ' + stored.HOH[i])&lt;br /&gt;
            cmd.select('var','resn '+ligand+ ' and n. ' + stored.name[j][2]) &lt;br /&gt;
            #calculate the distance between a specific atom and the water molecule&lt;br /&gt;
            dist = cmd.get_distance('base','var')            &lt;br /&gt;
            f.write('HOH residue %s -- and -- %s  ---&amp;gt;  %f A\n'%(stored.HOH[i],stored.name[j], dist))  &lt;br /&gt;
&lt;br /&gt;
    cmd.select (&amp;quot;waters&amp;quot;,&amp;quot;resn %s around %s and resn HOH&amp;quot; % (ligand,distance))&lt;br /&gt;
    cmd.show_as (&amp;quot;spheres&amp;quot;, &amp;quot;waters&amp;quot;)&lt;br /&gt;
    cmd.zoom (&amp;quot;visible&amp;quot;)&lt;br /&gt;
    num_atm = cmd.count_atoms (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    print (&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    print (&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % (count))&lt;br /&gt;
    print (&amp;quot;Number of interactions between water molecules and ligand: %d\n&amp;quot; % count_int)&lt;br /&gt;
    f.write('-------------------------------------------------------------\n')&lt;br /&gt;
    f.write(&amp;quot;Total number of water molecules at %s A from ligand %s: %s \n&amp;quot; % (distance,ligand,num_atm))&lt;br /&gt;
    f.write(&amp;quot;Number of water molecules that interact with ligand: %d\n&amp;quot; % count)&lt;br /&gt;
    f.write(&amp;quot;Number of interactions between water molecules and ligand: %d\n\n\n\n&amp;quot; % count_int)&lt;br /&gt;
    f.close()&lt;br /&gt;
    cmd.delete (&amp;quot;waters&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
cmd.extend(&amp;quot;waters&amp;quot;,waters)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;br /&gt;
[[Category:Biochemical_Scripts]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10189</id>
		<title>ShowLigandWaters</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10189"/>
		<updated>2013-09-02T09:14:39Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script-repo&lt;br /&gt;
|type      = script&lt;br /&gt;
|download  = &lt;br /&gt;
|author    = [[User:GianlucaTomasello|Gianluca Tomasello]]&lt;br /&gt;
|license   = [http://creativecommons.org/licenses/by-nc-sa/3.0 CC BY-NC-SA]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown and is maked an output file containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
waters [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* '''ligand name''' = the ligand residue name&lt;br /&gt;
* '''distance''' = max distance in Angstroms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
'''example #1 on PDB structure (1C0L)'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;waters FAD, 2.8&lt;br /&gt;
&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
 &lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
output file: waters.py&lt;br /&gt;
&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O1P']  ---&amp;gt;  2.611289 A&lt;br /&gt;
HOH residue 2002 -- and -- ['FAD', '1363', 'O5B']  ---&amp;gt;  3.592691 A&lt;br /&gt;
HOH residue 2008 -- and -- ['FAD', '1363', 'O1A']  ---&amp;gt;  2.678604 A&lt;br /&gt;
HOH residue 2009 -- and -- ['FAD', '1363', 'O2P']  ---&amp;gt;  2.643039 A&lt;br /&gt;
-------------------------------------------------------------&lt;br /&gt;
Total number of water molecules at 2.8 A from ligand FAD: 3 &lt;br /&gt;
Number of water molecules that interact with ligand: 3&lt;br /&gt;
Number of interactions between water molecules and ligand: 4&lt;br /&gt;
&lt;br /&gt;
[[File:Example 1 FAD 1C0L.png|450px|example #1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&lt;br /&gt;
Copy the following text and save it as pairwisedistances.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd, stored, math&lt;br /&gt;
&lt;br /&gt;
def pairwise_dist(sel1, sel2, max_dist, output=&amp;quot;N&amp;quot;, sidechain=&amp;quot;N&amp;quot;, show=&amp;quot;N&amp;quot;):&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
	usage: pairwise_dist sel1, sel2, max_dist, [output=S/P/N, [sidechain=N/Y, [show=Y/N]]]&lt;br /&gt;
	sel1 and sel2 can be any to pre-existing or newly defined selections&lt;br /&gt;
	max_dist: maximum distance in Angstrom between atoms in the two selections&lt;br /&gt;
	--optional settings:&lt;br /&gt;
	output: accepts Screen/Print/None (default N)&lt;br /&gt;
	sidechain: limits (Y) results to sidechain atoms (default N)&lt;br /&gt;
	show: shows (Y) individual distances in pymol menu (default=N)&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
	print &amp;quot;&amp;quot;&lt;br /&gt;
	cmd.delete (&amp;quot;dist*&amp;quot;)&lt;br /&gt;
	extra=&amp;quot;&amp;quot;&lt;br /&gt;
	if sidechain==&amp;quot;Y&amp;quot;: extra=&amp;quot; and not name c+o+n&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	#builds models&lt;br /&gt;
	m1=cmd.get_model(sel2+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel1+extra)&lt;br /&gt;
	m1o=cmd.get_object_list(sel1)&lt;br /&gt;
	m2=cmd.get_model(sel1+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel2+extra)&lt;br /&gt;
	m2o=cmd.get_object_list(sel2)&lt;br /&gt;
&lt;br /&gt;
	#defines selections&lt;br /&gt;
	cmd.select(&amp;quot;__tsel1a&amp;quot;, sel1+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel2+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel1&amp;quot;, &amp;quot;__tsel1a and &amp;quot;+sel2+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel2a&amp;quot;, sel2+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel1+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel2&amp;quot;, &amp;quot;__tsel2a and &amp;quot;+sel1+extra)&lt;br /&gt;
	cmd.select(&amp;quot;IntAtoms_&amp;quot;+max_dist, &amp;quot;__tsel1 or __tsel2&amp;quot;)&lt;br /&gt;
	cmd.select(&amp;quot;IntRes_&amp;quot;+max_dist, &amp;quot;byres IntAtoms_&amp;quot;+max_dist)&lt;br /&gt;
 &lt;br /&gt;
	#controlers-1&lt;br /&gt;
	if len(m1o)==0: &lt;br /&gt;
		print &amp;quot;warning, '&amp;quot;+sel1+extra+&amp;quot;' does not contain any atoms.&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	if len(m2o)==0: &lt;br /&gt;
		print &amp;quot;warning, '&amp;quot;+sel2+extra+&amp;quot;' does not contain any atoms.&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	&lt;br /&gt;
	#measures distances&lt;br /&gt;
	s=&amp;quot;&amp;quot;&lt;br /&gt;
	counter=0&lt;br /&gt;
	for c1 in range(len(m1.atom)):&lt;br /&gt;
		for c2 in range(len(m2.atom)):&lt;br /&gt;
			distance=math.sqrt(sum(map(lambda f: (f[0]-f[1])**2, zip(m1.atom[c1].coord,m2.atom[c2].coord))))&lt;br /&gt;
			if distance&amp;lt;float(max_dist):&lt;br /&gt;
				s+=&amp;quot;%s/%s/%s/%s/%s to %s/%s/%s/%s/%s: %.3f\n&amp;quot; % (m1o[0],m1.atom[c1].chain,m1.atom[c1].resn,m1.atom[c1].resi,m1.atom[c1].name,m2o[0],m2.atom[c2].chain,m2.atom[c2].resn,m2.atom[c2].resi,m2.atom[c2].name, distance)&lt;br /&gt;
				counter+=1&lt;br /&gt;
				if show==&amp;quot;Y&amp;quot;: cmd.distance (m1o[0]+&amp;quot; and &amp;quot;+m1.atom[c1].chain+&amp;quot;/&amp;quot;+m1.atom[c1].resi+&amp;quot;/&amp;quot;+m1.atom[c1].name, m2o[0]+&amp;quot; and &amp;quot;+m2.atom[c2].chain+&amp;quot;/&amp;quot;+m2.atom[c2].resi+&amp;quot;/&amp;quot;+m2.atom[c2].name)&lt;br /&gt;
&lt;br /&gt;
	#controler-2&lt;br /&gt;
	if counter==0: &lt;br /&gt;
		print &amp;quot;warning, no distances were measured! Check your selections/max_dist value&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	&lt;br /&gt;
	#outputs&lt;br /&gt;
	if output==&amp;quot;S&amp;quot;: print s&lt;br /&gt;
	if output==&amp;quot;P&amp;quot;:&lt;br /&gt;
		f=open('IntAtoms_'+max_dist+'.txt','w')&lt;br /&gt;
		f.write(&amp;quot;Number of distances calculated: %s\n&amp;quot; % (counter))&lt;br /&gt;
		f.write(s)&lt;br /&gt;
		f.close()&lt;br /&gt;
		print &amp;quot;Results saved in IntAtoms_%s.txt&amp;quot; % max_dist&lt;br /&gt;
	print &amp;quot;Number of distances calculated: %s&amp;quot; % (counter)&lt;br /&gt;
	cmd.hide(&amp;quot;lines&amp;quot;, &amp;quot;IntRes_*&amp;quot;)&lt;br /&gt;
	if show==&amp;quot;Y&amp;quot;: cmd.show(&amp;quot;lines&amp;quot;,&amp;quot;IntRes_&amp;quot;+max_dist)&lt;br /&gt;
	cmd.deselect()&lt;br /&gt;
  &lt;br /&gt;
cmd.extend(&amp;quot;pairwise_dist&amp;quot;, pairwise_dist)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;br /&gt;
[[Category:Biochemical_Scripts]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Example_1_FAD_1C0L.png&amp;diff=2045</id>
		<title>File:Example 1 FAD 1C0L.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Example_1_FAD_1C0L.png&amp;diff=2045"/>
		<updated>2013-09-02T09:12:10Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10188</id>
		<title>ShowLigandWaters</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10188"/>
		<updated>2013-09-02T09:07:04Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script-repo&lt;br /&gt;
|type      = script&lt;br /&gt;
|download  = &lt;br /&gt;
|author    = [[User:GianlucaTomasello|Gianluca Tomasello]]&lt;br /&gt;
|license   = [http://creativecommons.org/licenses/by-nc-sa/3.0 CC BY-NC-SA]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown and is maked an output file containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
waters [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* '''ligand name''' = the ligand residue name&lt;br /&gt;
* '''distance''' = max distance in Angstroms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
'''example #1'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;pairwise_dist 1efa and chain D, 1efa and chain B, 3, output=S, show=Y&lt;br /&gt;
 &lt;br /&gt;
1efa/D/DC/13/OP1 to 1efa/B/TYR/47/OH: 2.765&lt;br /&gt;
1efa/D/DC/13/OP2 to 1efa/B/LEU/6/N: 2.983&lt;br /&gt;
1efa/D/DC/13/OP2 to 1efa/B/LEU/6/CB: 2.928&lt;br /&gt;
1efa/D/DT/14/O4' to 1efa/B/ALA/57/CB: 2.827&lt;br /&gt;
1efa/D/DT/14/OP1 to 1efa/B/ASN/25/OD1: 2.858&lt;br /&gt;
1efa/D/DT/14/OP1 to 1efa/B/GLN/54/NE2: 2.996&lt;br /&gt;
1efa/D/DT/14/OP2 to 1efa/B/SER/21/OG: 2.517&lt;br /&gt;
1efa/D/DC/15/N4 to 1efa/B/GLN/18/NE2: 2.723&lt;br /&gt;
1efa/D/DA/16/N6 to 1efa/B/GLN/18/NE2: 2.931&lt;br /&gt;
 &lt;br /&gt;
Number of distances calculated: 9&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pairwise1.png|450px|example #1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&lt;br /&gt;
Copy the following text and save it as pairwisedistances.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd, stored, math&lt;br /&gt;
&lt;br /&gt;
def pairwise_dist(sel1, sel2, max_dist, output=&amp;quot;N&amp;quot;, sidechain=&amp;quot;N&amp;quot;, show=&amp;quot;N&amp;quot;):&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
	usage: pairwise_dist sel1, sel2, max_dist, [output=S/P/N, [sidechain=N/Y, [show=Y/N]]]&lt;br /&gt;
	sel1 and sel2 can be any to pre-existing or newly defined selections&lt;br /&gt;
	max_dist: maximum distance in Angstrom between atoms in the two selections&lt;br /&gt;
	--optional settings:&lt;br /&gt;
	output: accepts Screen/Print/None (default N)&lt;br /&gt;
	sidechain: limits (Y) results to sidechain atoms (default N)&lt;br /&gt;
	show: shows (Y) individual distances in pymol menu (default=N)&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
	print &amp;quot;&amp;quot;&lt;br /&gt;
	cmd.delete (&amp;quot;dist*&amp;quot;)&lt;br /&gt;
	extra=&amp;quot;&amp;quot;&lt;br /&gt;
	if sidechain==&amp;quot;Y&amp;quot;: extra=&amp;quot; and not name c+o+n&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	#builds models&lt;br /&gt;
	m1=cmd.get_model(sel2+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel1+extra)&lt;br /&gt;
	m1o=cmd.get_object_list(sel1)&lt;br /&gt;
	m2=cmd.get_model(sel1+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel2+extra)&lt;br /&gt;
	m2o=cmd.get_object_list(sel2)&lt;br /&gt;
&lt;br /&gt;
	#defines selections&lt;br /&gt;
	cmd.select(&amp;quot;__tsel1a&amp;quot;, sel1+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel2+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel1&amp;quot;, &amp;quot;__tsel1a and &amp;quot;+sel2+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel2a&amp;quot;, sel2+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel1+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel2&amp;quot;, &amp;quot;__tsel2a and &amp;quot;+sel1+extra)&lt;br /&gt;
	cmd.select(&amp;quot;IntAtoms_&amp;quot;+max_dist, &amp;quot;__tsel1 or __tsel2&amp;quot;)&lt;br /&gt;
	cmd.select(&amp;quot;IntRes_&amp;quot;+max_dist, &amp;quot;byres IntAtoms_&amp;quot;+max_dist)&lt;br /&gt;
 &lt;br /&gt;
	#controlers-1&lt;br /&gt;
	if len(m1o)==0: &lt;br /&gt;
		print &amp;quot;warning, '&amp;quot;+sel1+extra+&amp;quot;' does not contain any atoms.&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	if len(m2o)==0: &lt;br /&gt;
		print &amp;quot;warning, '&amp;quot;+sel2+extra+&amp;quot;' does not contain any atoms.&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	&lt;br /&gt;
	#measures distances&lt;br /&gt;
	s=&amp;quot;&amp;quot;&lt;br /&gt;
	counter=0&lt;br /&gt;
	for c1 in range(len(m1.atom)):&lt;br /&gt;
		for c2 in range(len(m2.atom)):&lt;br /&gt;
			distance=math.sqrt(sum(map(lambda f: (f[0]-f[1])**2, zip(m1.atom[c1].coord,m2.atom[c2].coord))))&lt;br /&gt;
			if distance&amp;lt;float(max_dist):&lt;br /&gt;
				s+=&amp;quot;%s/%s/%s/%s/%s to %s/%s/%s/%s/%s: %.3f\n&amp;quot; % (m1o[0],m1.atom[c1].chain,m1.atom[c1].resn,m1.atom[c1].resi,m1.atom[c1].name,m2o[0],m2.atom[c2].chain,m2.atom[c2].resn,m2.atom[c2].resi,m2.atom[c2].name, distance)&lt;br /&gt;
				counter+=1&lt;br /&gt;
				if show==&amp;quot;Y&amp;quot;: cmd.distance (m1o[0]+&amp;quot; and &amp;quot;+m1.atom[c1].chain+&amp;quot;/&amp;quot;+m1.atom[c1].resi+&amp;quot;/&amp;quot;+m1.atom[c1].name, m2o[0]+&amp;quot; and &amp;quot;+m2.atom[c2].chain+&amp;quot;/&amp;quot;+m2.atom[c2].resi+&amp;quot;/&amp;quot;+m2.atom[c2].name)&lt;br /&gt;
&lt;br /&gt;
	#controler-2&lt;br /&gt;
	if counter==0: &lt;br /&gt;
		print &amp;quot;warning, no distances were measured! Check your selections/max_dist value&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	&lt;br /&gt;
	#outputs&lt;br /&gt;
	if output==&amp;quot;S&amp;quot;: print s&lt;br /&gt;
	if output==&amp;quot;P&amp;quot;:&lt;br /&gt;
		f=open('IntAtoms_'+max_dist+'.txt','w')&lt;br /&gt;
		f.write(&amp;quot;Number of distances calculated: %s\n&amp;quot; % (counter))&lt;br /&gt;
		f.write(s)&lt;br /&gt;
		f.close()&lt;br /&gt;
		print &amp;quot;Results saved in IntAtoms_%s.txt&amp;quot; % max_dist&lt;br /&gt;
	print &amp;quot;Number of distances calculated: %s&amp;quot; % (counter)&lt;br /&gt;
	cmd.hide(&amp;quot;lines&amp;quot;, &amp;quot;IntRes_*&amp;quot;)&lt;br /&gt;
	if show==&amp;quot;Y&amp;quot;: cmd.show(&amp;quot;lines&amp;quot;,&amp;quot;IntRes_&amp;quot;+max_dist)&lt;br /&gt;
	cmd.deselect()&lt;br /&gt;
  &lt;br /&gt;
cmd.extend(&amp;quot;pairwise_dist&amp;quot;, pairwise_dist)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;br /&gt;
[[Category:Biochemical_Scripts]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10187</id>
		<title>ShowLigandWaters</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10187"/>
		<updated>2013-09-02T08:56:21Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script-repo&lt;br /&gt;
|type      = script&lt;br /&gt;
|download  = &lt;br /&gt;
|author    = [[User:GianlucaTomasello|Gianluca Tomasello]]&lt;br /&gt;
|license   = [http://creativecommons.org/licenses/by-nc-sa/3.0 CC BY-NC-SA]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is a test page########&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown and is maked an output file containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
waters [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* '''ligand name''' = the ligand residue name&lt;br /&gt;
* '''distance''' = max distance in Angstroms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
'''example #1'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;pairwise_dist 1efa and chain D, 1efa and chain B, 3, output=S, show=Y&lt;br /&gt;
 &lt;br /&gt;
1efa/D/DC/13/OP1 to 1efa/B/TYR/47/OH: 2.765&lt;br /&gt;
1efa/D/DC/13/OP2 to 1efa/B/LEU/6/N: 2.983&lt;br /&gt;
1efa/D/DC/13/OP2 to 1efa/B/LEU/6/CB: 2.928&lt;br /&gt;
1efa/D/DT/14/O4' to 1efa/B/ALA/57/CB: 2.827&lt;br /&gt;
1efa/D/DT/14/OP1 to 1efa/B/ASN/25/OD1: 2.858&lt;br /&gt;
1efa/D/DT/14/OP1 to 1efa/B/GLN/54/NE2: 2.996&lt;br /&gt;
1efa/D/DT/14/OP2 to 1efa/B/SER/21/OG: 2.517&lt;br /&gt;
1efa/D/DC/15/N4 to 1efa/B/GLN/18/NE2: 2.723&lt;br /&gt;
1efa/D/DA/16/N6 to 1efa/B/GLN/18/NE2: 2.931&lt;br /&gt;
 &lt;br /&gt;
Number of distances calculated: 9&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pairwise1.png|450px|example #1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&lt;br /&gt;
Copy the following text and save it as pairwisedistances.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd, stored, math&lt;br /&gt;
&lt;br /&gt;
def pairwise_dist(sel1, sel2, max_dist, output=&amp;quot;N&amp;quot;, sidechain=&amp;quot;N&amp;quot;, show=&amp;quot;N&amp;quot;):&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
	usage: pairwise_dist sel1, sel2, max_dist, [output=S/P/N, [sidechain=N/Y, [show=Y/N]]]&lt;br /&gt;
	sel1 and sel2 can be any to pre-existing or newly defined selections&lt;br /&gt;
	max_dist: maximum distance in Angstrom between atoms in the two selections&lt;br /&gt;
	--optional settings:&lt;br /&gt;
	output: accepts Screen/Print/None (default N)&lt;br /&gt;
	sidechain: limits (Y) results to sidechain atoms (default N)&lt;br /&gt;
	show: shows (Y) individual distances in pymol menu (default=N)&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
	print &amp;quot;&amp;quot;&lt;br /&gt;
	cmd.delete (&amp;quot;dist*&amp;quot;)&lt;br /&gt;
	extra=&amp;quot;&amp;quot;&lt;br /&gt;
	if sidechain==&amp;quot;Y&amp;quot;: extra=&amp;quot; and not name c+o+n&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	#builds models&lt;br /&gt;
	m1=cmd.get_model(sel2+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel1+extra)&lt;br /&gt;
	m1o=cmd.get_object_list(sel1)&lt;br /&gt;
	m2=cmd.get_model(sel1+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel2+extra)&lt;br /&gt;
	m2o=cmd.get_object_list(sel2)&lt;br /&gt;
&lt;br /&gt;
	#defines selections&lt;br /&gt;
	cmd.select(&amp;quot;__tsel1a&amp;quot;, sel1+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel2+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel1&amp;quot;, &amp;quot;__tsel1a and &amp;quot;+sel2+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel2a&amp;quot;, sel2+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel1+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel2&amp;quot;, &amp;quot;__tsel2a and &amp;quot;+sel1+extra)&lt;br /&gt;
	cmd.select(&amp;quot;IntAtoms_&amp;quot;+max_dist, &amp;quot;__tsel1 or __tsel2&amp;quot;)&lt;br /&gt;
	cmd.select(&amp;quot;IntRes_&amp;quot;+max_dist, &amp;quot;byres IntAtoms_&amp;quot;+max_dist)&lt;br /&gt;
 &lt;br /&gt;
	#controlers-1&lt;br /&gt;
	if len(m1o)==0: &lt;br /&gt;
		print &amp;quot;warning, '&amp;quot;+sel1+extra+&amp;quot;' does not contain any atoms.&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	if len(m2o)==0: &lt;br /&gt;
		print &amp;quot;warning, '&amp;quot;+sel2+extra+&amp;quot;' does not contain any atoms.&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	&lt;br /&gt;
	#measures distances&lt;br /&gt;
	s=&amp;quot;&amp;quot;&lt;br /&gt;
	counter=0&lt;br /&gt;
	for c1 in range(len(m1.atom)):&lt;br /&gt;
		for c2 in range(len(m2.atom)):&lt;br /&gt;
			distance=math.sqrt(sum(map(lambda f: (f[0]-f[1])**2, zip(m1.atom[c1].coord,m2.atom[c2].coord))))&lt;br /&gt;
			if distance&amp;lt;float(max_dist):&lt;br /&gt;
				s+=&amp;quot;%s/%s/%s/%s/%s to %s/%s/%s/%s/%s: %.3f\n&amp;quot; % (m1o[0],m1.atom[c1].chain,m1.atom[c1].resn,m1.atom[c1].resi,m1.atom[c1].name,m2o[0],m2.atom[c2].chain,m2.atom[c2].resn,m2.atom[c2].resi,m2.atom[c2].name, distance)&lt;br /&gt;
				counter+=1&lt;br /&gt;
				if show==&amp;quot;Y&amp;quot;: cmd.distance (m1o[0]+&amp;quot; and &amp;quot;+m1.atom[c1].chain+&amp;quot;/&amp;quot;+m1.atom[c1].resi+&amp;quot;/&amp;quot;+m1.atom[c1].name, m2o[0]+&amp;quot; and &amp;quot;+m2.atom[c2].chain+&amp;quot;/&amp;quot;+m2.atom[c2].resi+&amp;quot;/&amp;quot;+m2.atom[c2].name)&lt;br /&gt;
&lt;br /&gt;
	#controler-2&lt;br /&gt;
	if counter==0: &lt;br /&gt;
		print &amp;quot;warning, no distances were measured! Check your selections/max_dist value&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	&lt;br /&gt;
	#outputs&lt;br /&gt;
	if output==&amp;quot;S&amp;quot;: print s&lt;br /&gt;
	if output==&amp;quot;P&amp;quot;:&lt;br /&gt;
		f=open('IntAtoms_'+max_dist+'.txt','w')&lt;br /&gt;
		f.write(&amp;quot;Number of distances calculated: %s\n&amp;quot; % (counter))&lt;br /&gt;
		f.write(s)&lt;br /&gt;
		f.close()&lt;br /&gt;
		print &amp;quot;Results saved in IntAtoms_%s.txt&amp;quot; % max_dist&lt;br /&gt;
	print &amp;quot;Number of distances calculated: %s&amp;quot; % (counter)&lt;br /&gt;
	cmd.hide(&amp;quot;lines&amp;quot;, &amp;quot;IntRes_*&amp;quot;)&lt;br /&gt;
	if show==&amp;quot;Y&amp;quot;: cmd.show(&amp;quot;lines&amp;quot;,&amp;quot;IntRes_&amp;quot;+max_dist)&lt;br /&gt;
	cmd.deselect()&lt;br /&gt;
  &lt;br /&gt;
cmd.extend(&amp;quot;pairwise_dist&amp;quot;, pairwise_dist)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;br /&gt;
[[Category:Biochemical_Scripts]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10186</id>
		<title>ShowLigandWaters</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10186"/>
		<updated>2013-09-02T08:52:21Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script-repo&lt;br /&gt;
|type      = script&lt;br /&gt;
|download  = &lt;br /&gt;
|author    = [[User:GianlucaTomasello|Gianluca Tomasello]]&lt;br /&gt;
|license   = [http://creativecommons.org/licenses/by-nc-sa/3.0 CC BY-NC-SA]#############&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is a test page########&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This script detects waters molecules within a specified distance from the ligand.&lt;br /&gt;
Water molecules are shown.&lt;br /&gt;
Distance between water molecules and O or N atoms of ligand are shown and is maked an output file containing a list of distance between waters and ligand atoms and the number of interactions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
waters, [ligand name, distance]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* '''ligand name''' = the ligand residue name&lt;br /&gt;
* '''distance''' = max distance in Angstroms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
'''example #1'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;pairwise_dist 1efa and chain D, 1efa and chain B, 3, output=S, show=Y&lt;br /&gt;
 &lt;br /&gt;
1efa/D/DC/13/OP1 to 1efa/B/TYR/47/OH: 2.765&lt;br /&gt;
1efa/D/DC/13/OP2 to 1efa/B/LEU/6/N: 2.983&lt;br /&gt;
1efa/D/DC/13/OP2 to 1efa/B/LEU/6/CB: 2.928&lt;br /&gt;
1efa/D/DT/14/O4' to 1efa/B/ALA/57/CB: 2.827&lt;br /&gt;
1efa/D/DT/14/OP1 to 1efa/B/ASN/25/OD1: 2.858&lt;br /&gt;
1efa/D/DT/14/OP1 to 1efa/B/GLN/54/NE2: 2.996&lt;br /&gt;
1efa/D/DT/14/OP2 to 1efa/B/SER/21/OG: 2.517&lt;br /&gt;
1efa/D/DC/15/N4 to 1efa/B/GLN/18/NE2: 2.723&lt;br /&gt;
1efa/D/DA/16/N6 to 1efa/B/GLN/18/NE2: 2.931&lt;br /&gt;
 &lt;br /&gt;
Number of distances calculated: 9&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pairwise1.png|450px|example #1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&lt;br /&gt;
Copy the following text and save it as pairwisedistances.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd, stored, math&lt;br /&gt;
&lt;br /&gt;
def pairwise_dist(sel1, sel2, max_dist, output=&amp;quot;N&amp;quot;, sidechain=&amp;quot;N&amp;quot;, show=&amp;quot;N&amp;quot;):&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
	usage: pairwise_dist sel1, sel2, max_dist, [output=S/P/N, [sidechain=N/Y, [show=Y/N]]]&lt;br /&gt;
	sel1 and sel2 can be any to pre-existing or newly defined selections&lt;br /&gt;
	max_dist: maximum distance in Angstrom between atoms in the two selections&lt;br /&gt;
	--optional settings:&lt;br /&gt;
	output: accepts Screen/Print/None (default N)&lt;br /&gt;
	sidechain: limits (Y) results to sidechain atoms (default N)&lt;br /&gt;
	show: shows (Y) individual distances in pymol menu (default=N)&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
	print &amp;quot;&amp;quot;&lt;br /&gt;
	cmd.delete (&amp;quot;dist*&amp;quot;)&lt;br /&gt;
	extra=&amp;quot;&amp;quot;&lt;br /&gt;
	if sidechain==&amp;quot;Y&amp;quot;: extra=&amp;quot; and not name c+o+n&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	#builds models&lt;br /&gt;
	m1=cmd.get_model(sel2+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel1+extra)&lt;br /&gt;
	m1o=cmd.get_object_list(sel1)&lt;br /&gt;
	m2=cmd.get_model(sel1+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel2+extra)&lt;br /&gt;
	m2o=cmd.get_object_list(sel2)&lt;br /&gt;
&lt;br /&gt;
	#defines selections&lt;br /&gt;
	cmd.select(&amp;quot;__tsel1a&amp;quot;, sel1+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel2+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel1&amp;quot;, &amp;quot;__tsel1a and &amp;quot;+sel2+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel2a&amp;quot;, sel2+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel1+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel2&amp;quot;, &amp;quot;__tsel2a and &amp;quot;+sel1+extra)&lt;br /&gt;
	cmd.select(&amp;quot;IntAtoms_&amp;quot;+max_dist, &amp;quot;__tsel1 or __tsel2&amp;quot;)&lt;br /&gt;
	cmd.select(&amp;quot;IntRes_&amp;quot;+max_dist, &amp;quot;byres IntAtoms_&amp;quot;+max_dist)&lt;br /&gt;
 &lt;br /&gt;
	#controlers-1&lt;br /&gt;
	if len(m1o)==0: &lt;br /&gt;
		print &amp;quot;warning, '&amp;quot;+sel1+extra+&amp;quot;' does not contain any atoms.&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	if len(m2o)==0: &lt;br /&gt;
		print &amp;quot;warning, '&amp;quot;+sel2+extra+&amp;quot;' does not contain any atoms.&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	&lt;br /&gt;
	#measures distances&lt;br /&gt;
	s=&amp;quot;&amp;quot;&lt;br /&gt;
	counter=0&lt;br /&gt;
	for c1 in range(len(m1.atom)):&lt;br /&gt;
		for c2 in range(len(m2.atom)):&lt;br /&gt;
			distance=math.sqrt(sum(map(lambda f: (f[0]-f[1])**2, zip(m1.atom[c1].coord,m2.atom[c2].coord))))&lt;br /&gt;
			if distance&amp;lt;float(max_dist):&lt;br /&gt;
				s+=&amp;quot;%s/%s/%s/%s/%s to %s/%s/%s/%s/%s: %.3f\n&amp;quot; % (m1o[0],m1.atom[c1].chain,m1.atom[c1].resn,m1.atom[c1].resi,m1.atom[c1].name,m2o[0],m2.atom[c2].chain,m2.atom[c2].resn,m2.atom[c2].resi,m2.atom[c2].name, distance)&lt;br /&gt;
				counter+=1&lt;br /&gt;
				if show==&amp;quot;Y&amp;quot;: cmd.distance (m1o[0]+&amp;quot; and &amp;quot;+m1.atom[c1].chain+&amp;quot;/&amp;quot;+m1.atom[c1].resi+&amp;quot;/&amp;quot;+m1.atom[c1].name, m2o[0]+&amp;quot; and &amp;quot;+m2.atom[c2].chain+&amp;quot;/&amp;quot;+m2.atom[c2].resi+&amp;quot;/&amp;quot;+m2.atom[c2].name)&lt;br /&gt;
&lt;br /&gt;
	#controler-2&lt;br /&gt;
	if counter==0: &lt;br /&gt;
		print &amp;quot;warning, no distances were measured! Check your selections/max_dist value&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	&lt;br /&gt;
	#outputs&lt;br /&gt;
	if output==&amp;quot;S&amp;quot;: print s&lt;br /&gt;
	if output==&amp;quot;P&amp;quot;:&lt;br /&gt;
		f=open('IntAtoms_'+max_dist+'.txt','w')&lt;br /&gt;
		f.write(&amp;quot;Number of distances calculated: %s\n&amp;quot; % (counter))&lt;br /&gt;
		f.write(s)&lt;br /&gt;
		f.close()&lt;br /&gt;
		print &amp;quot;Results saved in IntAtoms_%s.txt&amp;quot; % max_dist&lt;br /&gt;
	print &amp;quot;Number of distances calculated: %s&amp;quot; % (counter)&lt;br /&gt;
	cmd.hide(&amp;quot;lines&amp;quot;, &amp;quot;IntRes_*&amp;quot;)&lt;br /&gt;
	if show==&amp;quot;Y&amp;quot;: cmd.show(&amp;quot;lines&amp;quot;,&amp;quot;IntRes_&amp;quot;+max_dist)&lt;br /&gt;
	cmd.deselect()&lt;br /&gt;
  &lt;br /&gt;
cmd.extend(&amp;quot;pairwise_dist&amp;quot;, pairwise_dist)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;br /&gt;
[[Category:Biochemical_Scripts]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10185</id>
		<title>ShowLigandWaters</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10185"/>
		<updated>2013-09-02T08:51:03Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script-repo&lt;br /&gt;
|type      = script&lt;br /&gt;
|download  = &lt;br /&gt;
|author    = [[User:PietroGattiLafranconi|Pietro Gatti-Lafranconi]]&lt;br /&gt;
|license   = [http://creativecommons.org/licenses/by-nc-sa/3.0 CC BY-NC-SA]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is a test page##&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Given any two selections, this script calculates and returns the pairwise distances between all atoms that fall within a defined distance.&lt;br /&gt;
&lt;br /&gt;
Can be used to measure distances within the same chain, between different chains or different objects.&lt;br /&gt;
&lt;br /&gt;
Distances can be restricted to sidechain atoms only and the outputs either displayed on screen or printed on file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
 pairwise_dist sel1, sel2, max_dist, [output=S/P/N, [sidechain=N/Y, [show=Y/N]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* '''sel1''' = first selection&lt;br /&gt;
* '''sel2''' = second selection&lt;br /&gt;
* '''max_dist''' = max distance in Angstroms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Optional Arguments ==&lt;br /&gt;
* '''output''' = accepts Screen/Print/None (default N)&lt;br /&gt;
* '''sidechain''' = limits (Y) results to sidechain atoms (default N)&lt;br /&gt;
* '''show''' = shows (Y) individual distances in pymol menu (default=N)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
'''example #1'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;pairwise_dist 1efa and chain D, 1efa and chain B, 3, output=S, show=Y&lt;br /&gt;
 &lt;br /&gt;
1efa/D/DC/13/OP1 to 1efa/B/TYR/47/OH: 2.765&lt;br /&gt;
1efa/D/DC/13/OP2 to 1efa/B/LEU/6/N: 2.983&lt;br /&gt;
1efa/D/DC/13/OP2 to 1efa/B/LEU/6/CB: 2.928&lt;br /&gt;
1efa/D/DT/14/O4' to 1efa/B/ALA/57/CB: 2.827&lt;br /&gt;
1efa/D/DT/14/OP1 to 1efa/B/ASN/25/OD1: 2.858&lt;br /&gt;
1efa/D/DT/14/OP1 to 1efa/B/GLN/54/NE2: 2.996&lt;br /&gt;
1efa/D/DT/14/OP2 to 1efa/B/SER/21/OG: 2.517&lt;br /&gt;
1efa/D/DC/15/N4 to 1efa/B/GLN/18/NE2: 2.723&lt;br /&gt;
1efa/D/DA/16/N6 to 1efa/B/GLN/18/NE2: 2.931&lt;br /&gt;
 &lt;br /&gt;
Number of distances calculated: 9&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pairwise1.png|450px|example #1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''example #2'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;pairwise_dist 2w8s and chain a, 2W8s and chain b, 3, sidechain=Y, output=S, show=Y&lt;br /&gt;
 &lt;br /&gt;
2W8S/A/GLN/432/OE1 to 2W8S/B/ARG/503/NH2: 2.758&lt;br /&gt;
2W8S/A/ASP/434/OD1 to 2W8S/B/SER/493/OG: 2.444&lt;br /&gt;
2W8S/A/TYR/447/OH to 2W8S/B/GLN/485/NE2: 2.878&lt;br /&gt;
2W8S/A/HIS/449/NE2 to 2W8S/B/SER/489/OG: 2.686&lt;br /&gt;
2W8S/A/GLN/485/OE1 to 2W8S/B/TYR/447/OH: 2.971&lt;br /&gt;
2W8S/A/SER/489/OG to 2W8S/B/HIS/449/NE2: 2.913&lt;br /&gt;
2W8S/A/SER/493/OG to 2W8S/B/ASP/434/OD1: 2.491&lt;br /&gt;
2W8S/A/ARG/503/NH2 to 2W8S/B/GLN/432/OE1: 2.653&lt;br /&gt;
 &lt;br /&gt;
Number of distances calculated: 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pairwise2.png|450px|example #2]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''example #3'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;pairwise_dist 1FOS and chain H and resi 290:300, 1FOS and chain G, 4, sidechain=Y, show=Y, output=P&lt;br /&gt;
 &lt;br /&gt;
Results saved in IntAtoms_4.txt&lt;br /&gt;
Number of distances calculated: 24&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pairwise3.png|450px|example #3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&lt;br /&gt;
Copy the following text and save it as pairwisedistances.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd, stored, math&lt;br /&gt;
&lt;br /&gt;
def pairwise_dist(sel1, sel2, max_dist, output=&amp;quot;N&amp;quot;, sidechain=&amp;quot;N&amp;quot;, show=&amp;quot;N&amp;quot;):&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
	usage: pairwise_dist sel1, sel2, max_dist, [output=S/P/N, [sidechain=N/Y, [show=Y/N]]]&lt;br /&gt;
	sel1 and sel2 can be any to pre-existing or newly defined selections&lt;br /&gt;
	max_dist: maximum distance in Angstrom between atoms in the two selections&lt;br /&gt;
	--optional settings:&lt;br /&gt;
	output: accepts Screen/Print/None (default N)&lt;br /&gt;
	sidechain: limits (Y) results to sidechain atoms (default N)&lt;br /&gt;
	show: shows (Y) individual distances in pymol menu (default=N)&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
	print &amp;quot;&amp;quot;&lt;br /&gt;
	cmd.delete (&amp;quot;dist*&amp;quot;)&lt;br /&gt;
	extra=&amp;quot;&amp;quot;&lt;br /&gt;
	if sidechain==&amp;quot;Y&amp;quot;: extra=&amp;quot; and not name c+o+n&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	#builds models&lt;br /&gt;
	m1=cmd.get_model(sel2+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel1+extra)&lt;br /&gt;
	m1o=cmd.get_object_list(sel1)&lt;br /&gt;
	m2=cmd.get_model(sel1+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel2+extra)&lt;br /&gt;
	m2o=cmd.get_object_list(sel2)&lt;br /&gt;
&lt;br /&gt;
	#defines selections&lt;br /&gt;
	cmd.select(&amp;quot;__tsel1a&amp;quot;, sel1+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel2+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel1&amp;quot;, &amp;quot;__tsel1a and &amp;quot;+sel2+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel2a&amp;quot;, sel2+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel1+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel2&amp;quot;, &amp;quot;__tsel2a and &amp;quot;+sel1+extra)&lt;br /&gt;
	cmd.select(&amp;quot;IntAtoms_&amp;quot;+max_dist, &amp;quot;__tsel1 or __tsel2&amp;quot;)&lt;br /&gt;
	cmd.select(&amp;quot;IntRes_&amp;quot;+max_dist, &amp;quot;byres IntAtoms_&amp;quot;+max_dist)&lt;br /&gt;
 &lt;br /&gt;
	#controlers-1&lt;br /&gt;
	if len(m1o)==0: &lt;br /&gt;
		print &amp;quot;warning, '&amp;quot;+sel1+extra+&amp;quot;' does not contain any atoms.&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	if len(m2o)==0: &lt;br /&gt;
		print &amp;quot;warning, '&amp;quot;+sel2+extra+&amp;quot;' does not contain any atoms.&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	&lt;br /&gt;
	#measures distances&lt;br /&gt;
	s=&amp;quot;&amp;quot;&lt;br /&gt;
	counter=0&lt;br /&gt;
	for c1 in range(len(m1.atom)):&lt;br /&gt;
		for c2 in range(len(m2.atom)):&lt;br /&gt;
			distance=math.sqrt(sum(map(lambda f: (f[0]-f[1])**2, zip(m1.atom[c1].coord,m2.atom[c2].coord))))&lt;br /&gt;
			if distance&amp;lt;float(max_dist):&lt;br /&gt;
				s+=&amp;quot;%s/%s/%s/%s/%s to %s/%s/%s/%s/%s: %.3f\n&amp;quot; % (m1o[0],m1.atom[c1].chain,m1.atom[c1].resn,m1.atom[c1].resi,m1.atom[c1].name,m2o[0],m2.atom[c2].chain,m2.atom[c2].resn,m2.atom[c2].resi,m2.atom[c2].name, distance)&lt;br /&gt;
				counter+=1&lt;br /&gt;
				if show==&amp;quot;Y&amp;quot;: cmd.distance (m1o[0]+&amp;quot; and &amp;quot;+m1.atom[c1].chain+&amp;quot;/&amp;quot;+m1.atom[c1].resi+&amp;quot;/&amp;quot;+m1.atom[c1].name, m2o[0]+&amp;quot; and &amp;quot;+m2.atom[c2].chain+&amp;quot;/&amp;quot;+m2.atom[c2].resi+&amp;quot;/&amp;quot;+m2.atom[c2].name)&lt;br /&gt;
&lt;br /&gt;
	#controler-2&lt;br /&gt;
	if counter==0: &lt;br /&gt;
		print &amp;quot;warning, no distances were measured! Check your selections/max_dist value&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	&lt;br /&gt;
	#outputs&lt;br /&gt;
	if output==&amp;quot;S&amp;quot;: print s&lt;br /&gt;
	if output==&amp;quot;P&amp;quot;:&lt;br /&gt;
		f=open('IntAtoms_'+max_dist+'.txt','w')&lt;br /&gt;
		f.write(&amp;quot;Number of distances calculated: %s\n&amp;quot; % (counter))&lt;br /&gt;
		f.write(s)&lt;br /&gt;
		f.close()&lt;br /&gt;
		print &amp;quot;Results saved in IntAtoms_%s.txt&amp;quot; % max_dist&lt;br /&gt;
	print &amp;quot;Number of distances calculated: %s&amp;quot; % (counter)&lt;br /&gt;
	cmd.hide(&amp;quot;lines&amp;quot;, &amp;quot;IntRes_*&amp;quot;)&lt;br /&gt;
	if show==&amp;quot;Y&amp;quot;: cmd.show(&amp;quot;lines&amp;quot;,&amp;quot;IntRes_&amp;quot;+max_dist)&lt;br /&gt;
	cmd.deselect()&lt;br /&gt;
  &lt;br /&gt;
cmd.extend(&amp;quot;pairwise_dist&amp;quot;, pairwise_dist)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;br /&gt;
[[Category:Biochemical_Scripts]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10184</id>
		<title>ShowLigandWaters</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=ShowLigandWaters&amp;diff=10184"/>
		<updated>2013-09-02T08:02:05Z</updated>

		<summary type="html">&lt;p&gt;GianlucaTomasello: Created page with &amp;quot;{{Infobox script-repo |type      = script |download  =  |author    = Pietro Gatti-Lafranconi |license   = [http://creativecommons.org/licenses/by-n...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script-repo&lt;br /&gt;
|type      = script&lt;br /&gt;
|download  = &lt;br /&gt;
|author    = [[User:PietroGattiLafranconi|Pietro Gatti-Lafranconi]]&lt;br /&gt;
|license   = [http://creativecommons.org/licenses/by-nc-sa/3.0 CC BY-NC-SA]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is a test page&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Given any two selections, this script calculates and returns the pairwise distances between all atoms that fall within a defined distance.&lt;br /&gt;
&lt;br /&gt;
Can be used to measure distances within the same chain, between different chains or different objects.&lt;br /&gt;
&lt;br /&gt;
Distances can be restricted to sidechain atoms only and the outputs either displayed on screen or printed on file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
 pairwise_dist sel1, sel2, max_dist, [output=S/P/N, [sidechain=N/Y, [show=Y/N]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* '''sel1''' = first selection&lt;br /&gt;
* '''sel2''' = second selection&lt;br /&gt;
* '''max_dist''' = max distance in Angstroms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Optional Arguments ==&lt;br /&gt;
* '''output''' = accepts Screen/Print/None (default N)&lt;br /&gt;
* '''sidechain''' = limits (Y) results to sidechain atoms (default N)&lt;br /&gt;
* '''show''' = shows (Y) individual distances in pymol menu (default=N)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
'''example #1'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;pairwise_dist 1efa and chain D, 1efa and chain B, 3, output=S, show=Y&lt;br /&gt;
 &lt;br /&gt;
1efa/D/DC/13/OP1 to 1efa/B/TYR/47/OH: 2.765&lt;br /&gt;
1efa/D/DC/13/OP2 to 1efa/B/LEU/6/N: 2.983&lt;br /&gt;
1efa/D/DC/13/OP2 to 1efa/B/LEU/6/CB: 2.928&lt;br /&gt;
1efa/D/DT/14/O4' to 1efa/B/ALA/57/CB: 2.827&lt;br /&gt;
1efa/D/DT/14/OP1 to 1efa/B/ASN/25/OD1: 2.858&lt;br /&gt;
1efa/D/DT/14/OP1 to 1efa/B/GLN/54/NE2: 2.996&lt;br /&gt;
1efa/D/DT/14/OP2 to 1efa/B/SER/21/OG: 2.517&lt;br /&gt;
1efa/D/DC/15/N4 to 1efa/B/GLN/18/NE2: 2.723&lt;br /&gt;
1efa/D/DA/16/N6 to 1efa/B/GLN/18/NE2: 2.931&lt;br /&gt;
 &lt;br /&gt;
Number of distances calculated: 9&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pairwise1.png|450px|example #1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''example #2'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;pairwise_dist 2w8s and chain a, 2W8s and chain b, 3, sidechain=Y, output=S, show=Y&lt;br /&gt;
 &lt;br /&gt;
2W8S/A/GLN/432/OE1 to 2W8S/B/ARG/503/NH2: 2.758&lt;br /&gt;
2W8S/A/ASP/434/OD1 to 2W8S/B/SER/493/OG: 2.444&lt;br /&gt;
2W8S/A/TYR/447/OH to 2W8S/B/GLN/485/NE2: 2.878&lt;br /&gt;
2W8S/A/HIS/449/NE2 to 2W8S/B/SER/489/OG: 2.686&lt;br /&gt;
2W8S/A/GLN/485/OE1 to 2W8S/B/TYR/447/OH: 2.971&lt;br /&gt;
2W8S/A/SER/489/OG to 2W8S/B/HIS/449/NE2: 2.913&lt;br /&gt;
2W8S/A/SER/493/OG to 2W8S/B/ASP/434/OD1: 2.491&lt;br /&gt;
2W8S/A/ARG/503/NH2 to 2W8S/B/GLN/432/OE1: 2.653&lt;br /&gt;
 &lt;br /&gt;
Number of distances calculated: 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pairwise2.png|450px|example #2]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''example #3'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;pairwise_dist 1FOS and chain H and resi 290:300, 1FOS and chain G, 4, sidechain=Y, show=Y, output=P&lt;br /&gt;
 &lt;br /&gt;
Results saved in IntAtoms_4.txt&lt;br /&gt;
Number of distances calculated: 24&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:pairwise3.png|450px|example #3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&lt;br /&gt;
Copy the following text and save it as pairwisedistances.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd, stored, math&lt;br /&gt;
&lt;br /&gt;
def pairwise_dist(sel1, sel2, max_dist, output=&amp;quot;N&amp;quot;, sidechain=&amp;quot;N&amp;quot;, show=&amp;quot;N&amp;quot;):&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
	usage: pairwise_dist sel1, sel2, max_dist, [output=S/P/N, [sidechain=N/Y, [show=Y/N]]]&lt;br /&gt;
	sel1 and sel2 can be any to pre-existing or newly defined selections&lt;br /&gt;
	max_dist: maximum distance in Angstrom between atoms in the two selections&lt;br /&gt;
	--optional settings:&lt;br /&gt;
	output: accepts Screen/Print/None (default N)&lt;br /&gt;
	sidechain: limits (Y) results to sidechain atoms (default N)&lt;br /&gt;
	show: shows (Y) individual distances in pymol menu (default=N)&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
	print &amp;quot;&amp;quot;&lt;br /&gt;
	cmd.delete (&amp;quot;dist*&amp;quot;)&lt;br /&gt;
	extra=&amp;quot;&amp;quot;&lt;br /&gt;
	if sidechain==&amp;quot;Y&amp;quot;: extra=&amp;quot; and not name c+o+n&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	#builds models&lt;br /&gt;
	m1=cmd.get_model(sel2+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel1+extra)&lt;br /&gt;
	m1o=cmd.get_object_list(sel1)&lt;br /&gt;
	m2=cmd.get_model(sel1+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel2+extra)&lt;br /&gt;
	m2o=cmd.get_object_list(sel2)&lt;br /&gt;
&lt;br /&gt;
	#defines selections&lt;br /&gt;
	cmd.select(&amp;quot;__tsel1a&amp;quot;, sel1+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel2+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel1&amp;quot;, &amp;quot;__tsel1a and &amp;quot;+sel2+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel2a&amp;quot;, sel2+&amp;quot; around &amp;quot;+str(max_dist)+&amp;quot; and &amp;quot;+sel1+extra)&lt;br /&gt;
	cmd.select(&amp;quot;__tsel2&amp;quot;, &amp;quot;__tsel2a and &amp;quot;+sel1+extra)&lt;br /&gt;
	cmd.select(&amp;quot;IntAtoms_&amp;quot;+max_dist, &amp;quot;__tsel1 or __tsel2&amp;quot;)&lt;br /&gt;
	cmd.select(&amp;quot;IntRes_&amp;quot;+max_dist, &amp;quot;byres IntAtoms_&amp;quot;+max_dist)&lt;br /&gt;
 &lt;br /&gt;
	#controlers-1&lt;br /&gt;
	if len(m1o)==0: &lt;br /&gt;
		print &amp;quot;warning, '&amp;quot;+sel1+extra+&amp;quot;' does not contain any atoms.&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	if len(m2o)==0: &lt;br /&gt;
		print &amp;quot;warning, '&amp;quot;+sel2+extra+&amp;quot;' does not contain any atoms.&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	&lt;br /&gt;
	#measures distances&lt;br /&gt;
	s=&amp;quot;&amp;quot;&lt;br /&gt;
	counter=0&lt;br /&gt;
	for c1 in range(len(m1.atom)):&lt;br /&gt;
		for c2 in range(len(m2.atom)):&lt;br /&gt;
			distance=math.sqrt(sum(map(lambda f: (f[0]-f[1])**2, zip(m1.atom[c1].coord,m2.atom[c2].coord))))&lt;br /&gt;
			if distance&amp;lt;float(max_dist):&lt;br /&gt;
				s+=&amp;quot;%s/%s/%s/%s/%s to %s/%s/%s/%s/%s: %.3f\n&amp;quot; % (m1o[0],m1.atom[c1].chain,m1.atom[c1].resn,m1.atom[c1].resi,m1.atom[c1].name,m2o[0],m2.atom[c2].chain,m2.atom[c2].resn,m2.atom[c2].resi,m2.atom[c2].name, distance)&lt;br /&gt;
				counter+=1&lt;br /&gt;
				if show==&amp;quot;Y&amp;quot;: cmd.distance (m1o[0]+&amp;quot; and &amp;quot;+m1.atom[c1].chain+&amp;quot;/&amp;quot;+m1.atom[c1].resi+&amp;quot;/&amp;quot;+m1.atom[c1].name, m2o[0]+&amp;quot; and &amp;quot;+m2.atom[c2].chain+&amp;quot;/&amp;quot;+m2.atom[c2].resi+&amp;quot;/&amp;quot;+m2.atom[c2].name)&lt;br /&gt;
&lt;br /&gt;
	#controler-2&lt;br /&gt;
	if counter==0: &lt;br /&gt;
		print &amp;quot;warning, no distances were measured! Check your selections/max_dist value&amp;quot;&lt;br /&gt;
		return&lt;br /&gt;
	&lt;br /&gt;
	#outputs&lt;br /&gt;
	if output==&amp;quot;S&amp;quot;: print s&lt;br /&gt;
	if output==&amp;quot;P&amp;quot;:&lt;br /&gt;
		f=open('IntAtoms_'+max_dist+'.txt','w')&lt;br /&gt;
		f.write(&amp;quot;Number of distances calculated: %s\n&amp;quot; % (counter))&lt;br /&gt;
		f.write(s)&lt;br /&gt;
		f.close()&lt;br /&gt;
		print &amp;quot;Results saved in IntAtoms_%s.txt&amp;quot; % max_dist&lt;br /&gt;
	print &amp;quot;Number of distances calculated: %s&amp;quot; % (counter)&lt;br /&gt;
	cmd.hide(&amp;quot;lines&amp;quot;, &amp;quot;IntRes_*&amp;quot;)&lt;br /&gt;
	if show==&amp;quot;Y&amp;quot;: cmd.show(&amp;quot;lines&amp;quot;,&amp;quot;IntRes_&amp;quot;+max_dist)&lt;br /&gt;
	cmd.deselect()&lt;br /&gt;
  &lt;br /&gt;
cmd.extend(&amp;quot;pairwise_dist&amp;quot;, pairwise_dist)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;br /&gt;
[[Category:Biochemical_Scripts]]&lt;br /&gt;
[[Category:Structural_Biology_Scripts]]&lt;/div&gt;</summary>
		<author><name>GianlucaTomasello</name></author>
	</entry>
</feed>