Hi George,

You might want to use cmd.get_model() to make your life  easier. It turns a selection into a chempy model, which has an attribute .atom, containing all the corresponding atoms with names, identifiers, coordinates, etc.
Check scripts on the pymolwiki that do comparable things.

Hope it helps,

Tsjerk

On Oct 15, 2011 12:03 AM, "George Kvaratskhelia" <kvaratskhelia9@gmail.com> wrote:

I'm writing a function script in Python for PyMOL and I need to convert an atoms number to its location, or somehow gain a list of atom locations form a group location.
When the script is ran and the function is used the atom locations are entered : 
GKDistance("////GLY`730/*","////LYS`115/N*")

If I could somehow turn those two group locations into two lists or atom names in those groups then I could finish writing this program. But I am having no luck of converting the group location or the atom number to the atom locations in that group. 

I do also understand the cmd.distance command is being used with atom numbers instead of locations, I just left it that way but I do understand that the command does no work this way. Everything else in my program outputs the way I want it to too. 

Here is a copy of my script:

def GKDistance(group1, group2 ):
from pymol import stored
f=open('DistanceResults.txt','w')
group_distance=cmd.distance(group1,group2)
f.write("Distance of group 1 to group 2 is:")
f.write("\n")
group_average="%f" %group_distance
f.write(group_average)
f.write("\n")
list1=cmd.index(group1)
list2=cmd.index(group2)
for i in range(0,len(list1)):
location=list1[i]
header="Group1 atom %s distance to:" %(location[1]) 
f.write(header)
f.write("\n")
for j in range(0,len(list2)):
statement=list2[j]
distance=cmd.distance('%d','%d') %(location[1],statement[1])
fullstatement="atom %s is %d \n" %(statement[1], 50)
f.write(fullstatement)

from pymol import cmd, stored
 
cmd.extend( "GKDistance", GKDistance );

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net