Hi Sean,

try the attached example script, hope you manage to modify it for your needs.

Cheers,
  Thomas

Sean Law wrote, On 02/08/12 19:34:
Takanori,

I've tried the following:

for a in range(1,8): cmd.mdo(a,"hide sphere; select test, input_object_name & c. b & i. 19 around 4 & resn HOH; show sphere, test")

where "HOH" is the residue name for water (so I want to know only the waters within a 4 Angstrom radius of residue number 19).

However, this command keeps selecting the same atoms for every frame and shows them as spheres even if they have moved beyond the 4 Angstroms. Am I using the wrong selection logic here? Again, I only want to see the water atoms within 4 Angstroms of residue 19 for any given frame.

Thanks in advance.

Sean

 > Date: Wed, 8 Feb 2012 11:06:21 +0900
 > From: t.nak...@mail.mfour.med.kyoto-u.ac.jp
 > To: magic...@hotmail.com
 > CC: pymol-users@lists.sourceforge.net
 > Subject: Re: [PyMOL] Update Selection From Frames
 >
 > Hi Sean,
 >
> > I was wondering if it were possible to have a selection update itself for every frame.
 >
 > You can use mdo command for that.
 >
 > http://www.pymolwiki.org/index.php/Mdo
 >
 > Best regards,
 >
 > Takanori Nakane

--
Thomas Holder
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen
'''
Show water atoms within some radius of a reference atom during a movie.
'''

from pymol import cmd

obj = 'myobj'
natoms = 50

# create water
for i in range(natoms):
	cmd.pseudoatom(obj, pos=[i*3,0,0], resn='HOH', name='O', elem='O', resi=i)

# create reference atom
cmd.pseudoatom(obj, pos=[0,3,0], resn='CL', name='CL', elem='CL', resi=1000)

# generate states
for state in range(2, 3*natoms):
	cmd.create(obj, obj, 1, state)
	cmd.alter_state(state, 'last ' + obj, 'x=state-1', space=locals())

# selections
cmd.select('ref', obj + ' and resi 1000')
cmd.select('test', 'none')
cmd.disable('test')

# function to call during movie
def callback(state):
	cmd.hide('spheres')
	cmd.select('test', 'ref around 10 and resn HOH', state=state)
	cmd.show('spheres', 'test')

# make movie
cmd.mset('1-%d' % cmd.count_states())
for state in range(1,cmd.count_states()+1):
	cmd.mdo(state, "callback(%d)" % (state))

# show and play
cmd.show_as('nonbonded')
cmd.orient()
cmd.mplay()
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
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

Reply via email to