<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jan 13, 2010, at 8:01 AM, Jean Didier Pie Marechal wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi everyone,<br><br>I have obtained cavities for a given atom selection using surfnet and I want to put an atom at the centroid of the main blob. I know how to do this for a selected set of atom but I am struggling with the surfaces. <br><br>At this point, I splitted it (accelator Sc) and then I can select the blob I am interested in. But how could I create a particular object for this blob? From there, how could I add an atom (i.e. helium) and the centroid of the blob? </div></blockquote><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>So, how accurate do you want to be? You could iterate through the coordinates of the surface vertices to compute a centroid. You would probably want to look at the code of the ESP extension for that since it gets the coordinates of surface vertices so it can compute the electrostatic potential for them.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>My preferred (lazier) approach is to place the atom at the center of the bounding sphere, which is where the focus/window commands place the center of the view. Cribbed and modifying code from those commands...</div><div><br></div><div>from Midas import boundingSphere</div><div>from chimera import selection</div><div>sph = boundingSphere(selection.copyCurrent())</div><div>if sph is None:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>raise ValueError("Nothing selected")</div><div>from BuildStructure import placeHelium</div><div>a = placeHelium("CTR", position=sph.center)</div><div><br></div><div>--Eric</div><div><br></div><div><div><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="5" style="font: normal normal normal 16px/normal Helvetica; "> Eric Pettersen</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="5" style="font: normal normal normal 16px/normal Helvetica; "> UCSF Computer Graphics Lab</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="5" style="font: normal normal normal 16px/normal Helvetica; "> <a href="http://www.cgl.ucsf.edu">http://www.cgl.ucsf.edu</a></font></div><br class="Apple-interchange-newline"></div></span></div><br><div></div></div><br></body></html>