Difference between revisions of "Measure Distance"

From PyMOLWiki
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
# out to the file "dist.txt"
 
# out to the file "dist.txt"
 
# Simply change your selections to see different distances.
 
# Simply change your selections to see different distances.
 +
 +
# import PyMOL's command namespace
 
from pymol import cmd
 
from pymol import cmd
 +
 +
# open dist.txt for writing
 
f=open('dist.txt','w')
 
f=open('dist.txt','w')
 +
 +
# calculate the distance and store it in dst
 
dst=cmd.distance('tmp','mol1///25/ha','mol1///26/ha')
 
dst=cmd.distance('tmp','mol1///25/ha','mol1///26/ha')
 +
 +
# write the formatted value of the distance (dst)
 +
# to the output file
 
f.write("%8.3f\n"%dst)
 
f.write("%8.3f\n"%dst)
 +
 +
# close the output file.
 
f.close()
 
f.close()
 
</source>
 
</source>
  
 
== See Also ==
 
== See Also ==
[[Dist]]
+
[[Distance]]
  
 
[[Category:Script_Library|Measure Distance]]
 
[[Category:Script_Library|Measure Distance]]
 +
[[Category:Structural_Biology_Scripts]]

Latest revision as of 08:43, 30 April 2009

# This script writes the distance from 
# atom mol1///25/ha to atom mol1///26/ha
# out to the file "dist.txt"
# Simply change your selections to see different distances.

# import PyMOL's command namespace
from pymol import cmd

# open dist.txt for writing
f=open('dist.txt','w')

# calculate the distance and store it in dst
dst=cmd.distance('tmp','mol1///25/ha','mol1///26/ha')

# write the formatted value of the distance (dst)
# to the output file
f.write("%8.3f\n"%dst)

# close the output file.
f.close()

See Also

Distance