<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On May 4, 2010, at 7:44 AM, Elisabeth Ortega wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Dear all,<br><br>We are trying to place a fragment in an exact position. We created a<br>fragment with tetrahedral symmetry and we are trying to link an atom of<br>other molecule at 2.00 A of the central atom of the new fragment and<br>making a certain angle (120 degrees for example) with one of the<br>substituents to get the correct orientation of the new fragment.<br><br>Has anybody an idea that how can we do that?</div></blockquote><br></div><div>Hi Elisabeth,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>I think you'll find that you've under-defined the positioning -- I think you'll need another angle and a dihedral at least to uniquely position the fragment, but nonetheless I can provide some code to get you pointed in the right direction. First, of course, you would use placeFragment() to get your fragment to some (arbitrary) initial position. The function will return a Residue that contains your fragment's atoms. From this you can find the central atom, etc. So let's say you've found the relevant atoms for positioning and you have these variables:</div><div><br></div><div>fca = central fragment atom</div><div>fsa = fragment substituent atom (for angle positioning)</div><div>oa = atom from other atom (for distance)</div><div>r = fragment residue</div><div><br></div><div>--- start code ---</div><div># make fca-oa distance 2.0 [assumes fragment in same model as other molecule]</div><div>dv = fca.coord() - oa.coord()</div><div>dv.length = 2.0 - dv.length</div><div>for a in r.atoms:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>a.setCoord(a.coord() + dv)</div><div><br></div><div># make fsa-fca-oa angle 120</div><div>from chimera import cross, angle, Point, Xform</div><div>fscrd, fccrd, ocrd = [a.coord() for a in (fsa, fca, oa)]</div><div>axis = cross(fscrd-fccrd, fccrd-ocrd) # axis the rotation will be around</div><div>delta = 120.0 - angle(fscrd, fccrd, ocrd)</div><div>v = fccrd - Point(0.0, 0.0, 0.0) # rotation is about origin, so move center atom there</div><div>trans1 = Xform.translation(v) # translation to origin</div><div>v.negate()</div><div>trans2 = Xform.translation(v) # translation back from origin</div><div>trans1.multiply(Xform.rotation(axis, delta))</div><div>trans1.multiply(trans2)</div><div>for a in r.atoms:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>a.setCoord(trans1.apply(a.coord()))</div><div>--- end code ---</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>If your initial positioning of the fragment places the center atom in the proper direction from the other molecule atom you may be able to get away with only one angle (may still need a dihedral though).</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>I am working on a function for bonding molecules together that would have been helpful here but it isn't done yet (the partially-completed function is bind() which you can look at in BuildStructure/__init__.py). Also, I cc'ed chimera-dev on this and redirected replies there since this is pretty programming intensive. Good luck and don't hesitate to ask more questions.</div><div><br></div><div>--Eric</div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 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; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> <span class="Apple-converted-space"> </span></span>Eric Pettersen</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> <span class="Apple-converted-space"> </span></span>UCSF Computer Graphics Lab</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> </span><a href="http://www.cgl.ucsf.edu">http://www.cgl.ucsf.edu</a></font></p><br class="Apple-interchange-newline"></div></span> </div><br></body></html>