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 <aloctavo...@gmail.com> 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 <mar...@chemie.uni-kl.de> > 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