Re: [PyMOL] create bonds between selections within cutoff radius
Hi Carsten, the Category pages are auto generated, for example every page which contains a [[Category:Commands]] link is listed on the Category:Commands page. Since cmd.find_pairs() is not a command (it's an API-only function) it doesn't have a Category:Commands link. It's listed on http://pymolwiki.org/index.php/Category:Scripting together with some other API-only functions. Cheers, Thomas On 01 Jun 2015, at 16:10, Schubert, Carsten [JRDUS] wrote: > Shamelessly hijacking this thread... > > ...but the index page for the Wiki > http://www.pymolwiki.org/index.php/Category:Commands has not been updated for > the last 10 year, according to the footer. In other words the "find_pairs" > function is not on the index. Makes me wonder, what else is missing?! > > What is the current status with regards to updates on the Wiki? Is there > anyone from the community with time and capability willing to take this up > and maintain this resource or are we just letting this wither away? > > Cheers, > > Carsten > > -Original Message- > From: Thomas Holder [mailto:thomas.hol...@schrodinger.com] > Sent: Thursday, May 28, 2015 9:17 AM > To: Osvaldo Martin > Cc: Tobias Martin; pymol-users@lists.sourceforge.net > Subject: Re: [PyMOL] create bonds between selections within cutoff radius > > Hi Osvaldo, > > your solution can be simplified if you use cmd.find_pairs: > > http://pymolwiki.org/index.php/find_pairs > > Cheers, > Thomas -- Thomas Holder PyMOL Principal Developer Schrödinger, Inc. -- ___ 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
Re: [PyMOL] create bonds between selections within cutoff radius
Shamelessly hijacking this thread... ...but the index page for the Wiki http://www.pymolwiki.org/index.php/Category:Commands has not been updated for the last 10 year, according to the footer. In other words the "find_pairs" function is not on the index. Makes me wonder, what else is missing?! What is the current status with regards to updates on the Wiki? Is there anyone from the community with time and capability willing to take this up and maintain this resource or are we just letting this wither away? Cheers, Carsten -Original Message- From: Thomas Holder [mailto:thomas.hol...@schrodinger.com] Sent: Thursday, May 28, 2015 9:17 AM To: Osvaldo Martin Cc: Tobias Martin; pymol-users@lists.sourceforge.net Subject: Re: [PyMOL] create bonds between selections within cutoff radius Hi Osvaldo, your solution can be simplified if you use cmd.find_pairs: http://pymolwiki.org/index.php/find_pairs Cheers, Thomas On 28 May 2015, at 09:06, Osvaldo Martin wrote: > Hi Tobias, > > One possible solution will be to run the following code. > > import pymol > from pymol import cmd, stored > > stored.pd = [] > stored.pairs = [] > > cmd.iterate('name pd', 'stored.pd.append(index)') > > for i in stored.pd: > cmd.iterate('name si within 2.5 of index %s' % i, > 'stored.pairs.append((%s, index))' % i) > > print stored.pairs > > > If you run the above code you will obtain a list of tuples, each tuple > contains the indexes of the pairs Pd-Si atoms (fulfilling the "within 2.5 A" > criteria). Then you should iterate over "stored.pairs" to create the bonds > between the atoms in each pair. Something like this: > > for pair in stored.pairs: > cmd.bond('index %s' % pair[0], 'index %s' % pair[1]) > > > Cheers, > Osvaldo. > > On Thu, May 28, 2015 at 7:37 AM, Tobias Martin > wrote: > I want to create bonds between e.g. all Pd atoms and all Si atoms, but > only within a specified cutoff radius. > > bond (n. pd), (n. si) within 2.5 of (n. pd) > > creates all possible bonds between all Pd atoms and all Si atoms near > enough to any Pd atom. This yields a weired structure with very long, > unwanted bonds. > I tried to iterate over the first selection, to draw only bonds > between an Pd atom and Si atoms which are within range to that Pd atom > like > >iterate (n. pd), bond id ID, (n. si) within 2.5 of (id > ID) > > but get an syntax error. Is it possible to create bonds within an > iteration? > > Best regards, > tmartin -- Thomas Holder PyMOL Principal Developer Schrödinger, Inc. -- ___ 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 -- ___ 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
Re: [PyMOL] create bonds between selections within cutoff radius
Hi Thomas, You're absolutely right. I had completely forgotten the find_pairs function! Thanks for the clarification. Cheers, Osvaldo. On Thu, May 28, 2015 at 10:17 AM, Thomas Holder < thomas.hol...@schrodinger.com> wrote: > Hi Osvaldo, > > your solution can be simplified if you use cmd.find_pairs: > > http://pymolwiki.org/index.php/find_pairs > > Cheers, > Thomas > > On 28 May 2015, at 09:06, Osvaldo Martin wrote: > > > Hi Tobias, > > > > One possible solution will be to run the following code. > > > > import pymol > > from pymol import cmd, stored > > > > stored.pd = [] > > stored.pairs = [] > > > > cmd.iterate('name pd', 'stored.pd.append(index)') > > > > for i in stored.pd: > > cmd.iterate('name si within 2.5 of index %s' % i, > 'stored.pairs.append((%s, index))' % i) > > > > print stored.pairs > > > > > > If you run the above code you will obtain a list of tuples, each tuple > contains the indexes of the pairs Pd-Si atoms (fulfilling the "within 2.5 > A" criteria). Then you should iterate over "stored.pairs" to create the > bonds between the atoms in each pair. Something like this: > > > > for pair in stored.pairs: > > cmd.bond('index %s' % pair[0], 'index %s' % pair[1]) > > > > > > Cheers, > > Osvaldo. > > > > On Thu, May 28, 2015 at 7:37 AM, Tobias Martin > wrote: > > I want to create bonds between e.g. all Pd atoms and all > > Si atoms, but only within a specified cutoff radius. > > > > bond (n. pd), (n. si) within 2.5 of (n. pd) > > > > creates all possible bonds between all Pd atoms and all Si > > atoms near enough to any Pd atom. This yields a weired > > structure with very long, unwanted bonds. > > I tried to iterate over the first selection, to draw only > > bonds between an Pd atom and Si atoms which are within > > range to that Pd atom like > > > >iterate (n. pd), bond id ID, (n. si) within 2.5 of (id > > ID) > > > > but get an syntax error. Is it possible to create bonds > > within an iteration? > > > > Best regards, > > tmartin > > -- > Thomas Holder > PyMOL Principal Developer > Schrödinger, Inc. > > -- ___ 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
Re: [PyMOL] create bonds between selections within cutoff radius
Hi Osvaldo, your solution can be simplified if you use cmd.find_pairs: http://pymolwiki.org/index.php/find_pairs Cheers, Thomas On 28 May 2015, at 09:06, Osvaldo Martin wrote: > Hi Tobias, > > One possible solution will be to run the following code. > > import pymol > from pymol import cmd, stored > > stored.pd = [] > stored.pairs = [] > > cmd.iterate('name pd', 'stored.pd.append(index)') > > for i in stored.pd: > cmd.iterate('name si within 2.5 of index %s' % i, > 'stored.pairs.append((%s, index))' % i) > > print stored.pairs > > > If you run the above code you will obtain a list of tuples, each tuple > contains the indexes of the pairs Pd-Si atoms (fulfilling the "within 2.5 A" > criteria). Then you should iterate over "stored.pairs" to create the bonds > between the atoms in each pair. Something like this: > > for pair in stored.pairs: > cmd.bond('index %s' % pair[0], 'index %s' % pair[1]) > > > Cheers, > Osvaldo. > > On Thu, May 28, 2015 at 7:37 AM, Tobias Martin > wrote: > I want to create bonds between e.g. all Pd atoms and all > Si atoms, but only within a specified cutoff radius. > > bond (n. pd), (n. si) within 2.5 of (n. pd) > > creates all possible bonds between all Pd atoms and all Si > atoms near enough to any Pd atom. This yields a weired > structure with very long, unwanted bonds. > I tried to iterate over the first selection, to draw only > bonds between an Pd atom and Si atoms which are within > range to that Pd atom like > >iterate (n. pd), bond id ID, (n. si) within 2.5 of (id > ID) > > but get an syntax error. Is it possible to create bonds > within an iteration? > > Best regards, > tmartin -- Thomas Holder PyMOL Principal Developer Schrödinger, Inc. -- ___ 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
Re: [PyMOL] create bonds between selections within cutoff radius
Hi Tobias, One possible solution will be to run the following code. import pymol from pymol import cmd, stored stored.pd = [] stored.pairs = [] cmd.iterate('name pd', 'stored.pd.append(index)') for i in stored.pd: cmd.iterate('name si within 2.5 of index %s' % i, 'stored.pairs.append((%s, index))' % i) print stored.pairs If you run the above code you will obtain a list of tuples, each tuple contains the indexes of the pairs Pd-Si atoms (fulfilling the "within 2.5 A" criteria). Then you should iterate over "stored.pairs" to create the bonds between the atoms in each pair. Something like this: for pair in stored.pairs: cmd.bond('index %s' % pair[0], 'index %s' % pair[1]) Cheers, Osvaldo. On Thu, May 28, 2015 at 7:37 AM, Tobias Martin wrote: > I want to create bonds between e.g. all Pd atoms and all > Si atoms, but only within a specified cutoff radius. > > bond (n. pd), (n. si) within 2.5 of (n. pd) > > creates all possible bonds between all Pd atoms and all Si > atoms near enough to any Pd atom. This yields a weired > structure with very long, unwanted bonds. > I tried to iterate over the first selection, to draw only > bonds between an Pd atom and Si atoms which are within > range to that Pd atom like > >iterate (n. pd), bond id ID, (n. si) within 2.5 of (id > ID) > > but get an syntax error. Is it possible to create bonds > within an iteration? > > Best regards, > tmartin > > > -- > ___ > 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 > -- ___ 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
[PyMOL] create bonds between selections within cutoff radius
I want to create bonds between e.g. all Pd atoms and all Si atoms, but only within a specified cutoff radius. bond (n. pd), (n. si) within 2.5 of (n. pd) creates all possible bonds between all Pd atoms and all Si atoms near enough to any Pd atom. This yields a weired structure with very long, unwanted bonds. I tried to iterate over the first selection, to draw only bonds between an Pd atom and Si atoms which are within range to that Pd atom like iterate (n. pd), bond id ID, (n. si) within 2.5 of (id ID) but get an syntax error. Is it possible to create bonds within an iteration? Best regards, tmartin -- ___ 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