On Tue, 8 Mar 2005, Robert Campbell wrote:

Hi,

Daniel Farrell [Monday, March 07, 2005 1:23 PM] wrote:

I want to create a lot of distance objects (in the hundreds)
between particular atomic pairs.  Obviously I can make a
script like the following, inserting the exact atomic
selections that I want:

distance distobj12 = (atom1), (atom2)
distance distobj34 = (atom3), (atom4)
... etc.


But in fact one *can* still turn them on and off, with the "enable" or
"disable" command on the command line:

 enable _dist1
 disable _dist1

And it would be straightforward to put those commands within a loop:

 # turn them all off:
 for i in range(100):
   cmd.disable("_dist1%s" % i)

 # turn them all on:
 for i in range(100):
   cmd.enable("_dist1%s" % i)

Change "100" to whatever is appropriate.

I was just about to write something like this. In fact, I have tons of files called something like x.py sprinkled around that do things like

-----------------------------------------
from pymol import cmd
num_dist = 100

def show_dist():
  """ show all of my distance objects """
  for i in range(num_dist):
    cmd.enable('_dist%s'%i)

def hide_dist():
  """ hide all of my distance objects """
  for i in range(num_dist):
    cmd.disable('_dist%s'%i)

cmd.extend('sd',show_dist)
cmd.extend('hd',hide_dist)
-----------------------------------------

You could also try something cute like

def show_dist():
  dists = [name for name in cmd.get_names() if cmd.get_type(name) == 
'object:distance']
  for name in dists: cmd.enable(name)

etc.

if you don't want to have to keep track of how many there are.

-michael

--
www.umich.edu/~mlerner |                        _  |Michael Lerner
This isn't a democracy;| ASCII ribbon campaign ( ) |   Michigan
 it's a cheer-ocracy.  |  - against HTML email  X  |  Biophysics
-Torrence,  Bring It On|                       / \ | mler...@umich

Cheers,
Rob
--
Robert L. Campbell, Ph.D.                         <r...@post.queensu.ca>
Senior Research Associate                            phone: 613-533-6821
Dept. of Biochemistry, Queen's University,             fax: 613-533-2497
Kingston, ON K7L 3N6  Canada       http://adelie.biochem.queensu.ca/~rlc
   PGP Fingerprint: 9B49 3D3F A489 05DC B35C  8E33 F238 A8F5 F635 C0E2


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
PyMOL-users mailing list
PyMOL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pymol-users




Reply via email to