Crystallography‎ > ‎Molecular graphics‎ > ‎Pymol‎ > ‎

Script to get distances

This script gives all pairwise distances of the atoms in residue 30 of chain A of 1hpv.
Make script as file.cmd, and run from pymol using @file.cmd.

import pymol
from pymol import stored
fetch 1hpv, async=0
remove not (i. 30 and c. A)
stored.ids = []
iterate_state 1, 1hpv, stored.ids.append(ID)
for x in stored.ids:
for y in stored.ids:
print "Dist from atom ID %d to %d = %f" % (x,y,cmd.get_distance( "ID %s" % x, "ID %s" % y))
python end