<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On May 11, 2010, at 1:29 AM, Miguel Ortiz Lombardia wrote:</div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Ooops, I made a blind reply and my message went to the wrong list.<div><div><br></div><div>Never mind, I found that this:</div><div><br></div><div><div>mybonds = [':2.C@CP3-CPG',':2.C@CPG-OPA']</div><div>bondlist = mol.bonds</div><div>mybondlist = []</div><div>for bond in bondlist:</div><div> if str(bond) in mybonds:</div><div> mybondlist.append(bond)</div><div><br></div><div>selects the bonds I want. Perhaps not the most efficient way but it works. Now I can go for the real stuff.</div></div></div></div></blockquote><div><br></div>Hi Miguel,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>I'm glad you found something that worked. Your first try didn't work for a couple of reasons: (1) Selections are collective containers like lists, and (2) OSLSelections don't contain bonds. Here's what I would have done:</div><div><br></div><div>a1, a2 = selection.OSLSelection(':2.C@C1,C2').atoms()</div><div>bond1 = (set(a1.bonds)|set(a2.bonds)).pop()</div><div><br></div><div>Basically, use OSLSelection to get the two atoms, then intersect their bond lists. It should be slightly more efficient than your loop (though it probably makes no real difference unless this is going to execute hundreds or thousands of times). The efficiency comes from OSLSelection first finding the residues that match, <i>then</i> finding the atoms in those that match.</div><div><br></div><div>--Eric</div><div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><div><br><div>Début du message réexpédié :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>De : </b></span><span style="font-family:'Helvetica'; font-size:medium;">Miguel Ortiz Lombardia <<a href="mailto:miguel.ortiz-lombardia@afmb.univ-mrs.fr">miguel.ortiz-lombardia@afmb.univ-mrs.fr</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>Date : </b></span><span style="font-family:'Helvetica'; font-size:medium;">11 mai 2010 03:39:47 HAEC<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>À : </b></span><span style="font-family:'Helvetica'; font-size:medium;"><a href="mailto:chimera-dev@cgl.ucsf.edu">chimera-dev@cgl.ucsf.edu</a><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>Objet : </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>Rép : [Chimera-users] Volume covered by a group of atoms</b><br></span></div><br><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Eric,<div><br></div><div>Thanks a lot for your explanations!</div><div>In fact, I want to do this not for an amino acid side-chain (that was an easy-to-see example) but for a group in a small molecule. so I will need the BondRotMgr module. </div><div><br></div><div>First, I need to figure out how to select the bonds explicitly in the script. I thought that something like</div><div><br></div><div>bond1 = selection.OSLSelection(':2.C@C1|:2.C@C2')</div><div><div>bond2 = selection.OSLSelection(':2.C@C5|:2.C@C7')</div><div>(...)</div><div><br></div></div><div>would work, but it doesn't.</div><div><br></div><div>So far I have fond in the examples how to go through all the bonds in a molecule (or a residue) but not how to make a explicit selection of the bond. Is that possible at all or should I go through the molecule (or residue) list of bonds and pick the one I want based on two atom selections?</div></div></blockquote></div></div></div></div></blockquote></div></body></html>