There are a number of different ways to do this, but the easiest is:

obj_name = cmd.identify('pk1',1)[0][0]

To be safe, your code should probably make sure that the selection pk1
exists and contains at least one atom:

obj_name = None

if 'pk1' in cmd.get_names('selections'):
   if cmd.count_atoms('pk1',1):
        obj_name = cmd.identify('pk1',1)[0][0]

if obj_name:
   # do something here...

Cheers,
Warren


--
mailto:war...@sunesis.com
Warren L. DeLano, Ph.D.
Informatics Scientist
Sunesis Pharmaceuticals, Inc.
341 Oyster Point Blvd.
S. San Francisco, CA 94080
(650)-266-3606 fax: (650)-266-3501



> -----Original Message-----
> From: Ezequiel Panepucci [mailto:z...@slac.stanford.edu]
> Sent: Wednesday, November 14, 2001 4:30 PM
> To: PyMOL-users@lists.sourceforge.net
> Subject: [PyMOL] molecule name from PK* selections
> 
> 
> Hello,
> Is there a way to get the corresponding molecule (or model)
> name for a given PK1 selection?
> Thanks,
>       Zac
> 
> 
> 
> _______________________________________________
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pymol-users
> 

Reply via email to