This is a read-only mirror of pymolwiki.org

Difference between revisions of "Distance"

From PyMOL Wiki
Jump to navigation Jump to search
m
(replace deprecated syntax)
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
===DESCRIPTION===
+
'''distance''' creates a new distance object between two selections.  It will display all distances within the cutoff.  [[Distance]] is also used to make hydrogen bonds.
'''distance''' creates a new distance object between two selections.  It will display all distances within the cutoff.
 
  
<center>
+
For interactive use, the '''measurement''' [[wizard]] makes measuring distances easier than using the [[distance]] command.
<gallery>
+
 
 +
Calling [[distance]] without arguments will show distances between selections (pk1) and (pk1), which can be set in editing mode or using the PkAt mouse action (usually CTRL-middle-click).
 +
 
 +
<gallery align=right>
 
Image:Dist ex1.png|Example of distance.  See example #1.
 
Image:Dist ex1.png|Example of distance.  See example #1.
 
Image:Dist ex2.png|Example of distance.  See example #2.
 
Image:Dist ex2.png|Example of distance.  See example #2.
 
</gallery>
 
</gallery>
</center>
+
 
+
=Usage=
===USAGE===
 
 
<source lang="python">
 
<source lang="python">
distance (selection1), (selection2)
+
distance [ name [, selection1 [, selection2 [, cutoff [, mode ]]]]]
 
 
# example
 
dist i. 158 and n. CA, i. 160 and n. CA
 
 
</source>
 
</source>
 +
'''name'''
 +
::string: name of the distance object to create
 +
'''selection1'''
 +
::string: first atom selection
 +
'''selection2'''
 +
::string: second atom selection
 +
'''cutoff'''
 +
::float: longest distance to show   
 +
'''mode'''
 +
::0: all interatomic distances
 +
::1: only bond distances
 +
::2: only show polar contact distances
  
distance name = (selection1), (selection2) [,cutoff [,mode] ]
+
=PYMOL API=
 
* name = name of distance object
 
* selection1, selection2 = atom selections
 
* cutoff = maximum distance to display
 
* mode = 0 (default)
 
 
 
===PYMOL API===
 
 
<source lang="python">
 
<source lang="python">
 
cmd.distance( string name, string selection1, string selection2,
 
cmd.distance( string name, string selection1, string selection2,
Line 30: Line 33:
 
   # returns the average distance between all atoms/frames
 
   # returns the average distance between all atoms/frames
 
</source>
 
</source>
 
===NOTES===
 
The distance wizard makes measuring distances easier than using the "dist" command for real-time operations.
 
 
"dist" alone will show distances between selections (pk1) and (pk1), which can be set using the PkAt mouse action (usually CTRL-middle-click).
 
  
 
===EXAMPLES===
 
===EXAMPLES===
Line 53: Line 51:
 
* This neat example shows how to create distance measurements from an atom in a molecule to all other atoms in the molecule (since PyMol supports wildcards).
 
* This neat example shows how to create distance measurements from an atom in a molecule to all other atoms in the molecule (since PyMol supports wildcards).
 
<source lang="python">
 
<source lang="python">
  cmd.dist("(/mol1///1/C)","(/mol1///2/C*)")
+
  cmd.distance("(/mol1///1/C)","(/mol1///2/C*)")
 
</source>
 
</source>
 
or written without the PyMolScript code,
 
or written without the PyMolScript code,
Line 61: Line 59:
 
for at1 in cmd.index("resi 10"): \
 
for at1 in cmd.index("resi 10"): \
 
   for at2 in cmd.index("resi 11"): \
 
   for at2 in cmd.index("resi 11"): \
       cmd.dist(None, "%s`%d"%at1, "%s`%d"%at2)
+
       cmd.distance(None, "%s`%d"%at1, "%s`%d"%at2)
 +
</source>
 +
 
 +
<source lang="python">
 +
distance (selection1), (selection2)
 +
 
 +
# example
 +
dist i. 158 and n. CA, i. 160 and n. CA
 +
 
 +
distance mydist, 14/CA, 29/CA
 +
distance hbonds, all, all, 3.2, mode=2
 
</source>
 
</source>
  
===SEE ALSO===
+
=See Also=
 
[[Measure_Distance]]<br>
 
[[Measure_Distance]]<br>
 
[[Lines]]
 
[[Lines]]
  
 
[[Category:Commands|Distance]]
 
[[Category:Commands|Distance]]

Revision as of 16:40, 24 January 2012

distance creates a new distance object between two selections. It will display all distances within the cutoff. Distance is also used to make hydrogen bonds.

For interactive use, the measurement wizard makes measuring distances easier than using the distance command.

Calling distance without arguments will show distances between selections (pk1) and (pk1), which can be set in editing mode or using the PkAt mouse action (usually CTRL-middle-click).

Usage

distance [ name [, selection1 [, selection2 [, cutoff [, mode ]]]]]

name

string: name of the distance object to create

selection1

string: first atom selection

selection2

string: second atom selection

cutoff

float: longest distance to show

mode

0: all interatomic distances
1: only bond distances
2: only show polar contact distances

PYMOL API

cmd.distance( string name, string selection1, string selection2,
              string cutoff, string mode )
   # returns the average distance between all atoms/frames

EXAMPLES

  • Get and show the distance from residue 10's alpha carbon to residue 40's alpha carbon in 1ESR:
# make the first residue 0.
zero_residues 1esr, 0
distance i. 10 and n . CA, i. 40 and n. CA
  • Get and show the distance from residue 10's alpha carbon to residue 35-42's alpha carbon in 1ESR:
# make the first residue 0.
zero_residues 1esr, 0
distance i. 10 and n . CA, i. 35-42 and n. CA
  • This neat example shows how to create distance measurements from an atom in a molecule to all other atoms in the molecule (since PyMol supports wildcards).
 cmd.distance("(/mol1///1/C)","(/mol1///2/C*)")

or written without the PyMolScript code,

dist /mol1///1/C, /mol1///2/C*
  • Create multiple distance objects
for at1 in cmd.index("resi 10"): \
   for at2 in cmd.index("resi 11"): \
       cmd.distance(None, "%s`%d"%at1, "%s`%d"%at2)
distance (selection1), (selection2)

# example
dist i. 158 and n. CA, i. 160 and n. CA 

distance mydist, 14/CA, 29/CA
distance hbonds, all, all, 3.2, mode=2

See Also

Measure_Distance
Lines