[chimera-dev] [Chimera-users] place fragment (again)

Eric Pettersen pett at cgl.ucsf.edu
Tue May 4 11:58:48 PDT 2010

On May 4, 2010, at 7:44 AM, Elisabeth Ortega wrote:

> Dear all,
> We are trying to place a fragment in an exact position. We created a
> fragment with tetrahedral symmetry and we are trying to link an atom  
> of
> other molecule at 2.00 A of the central atom of the new fragment and
> making a certain angle (120 degrees for example) with one of the
> substituents to get the correct orientation of the new fragment.
> Has anybody an idea that how can we do that?

Hi Elisabeth,
	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:

fca = central fragment atom
fsa = fragment substituent atom (for angle positioning)
oa = atom from other atom (for distance)
r = fragment residue

--- start code ---
# make fca-oa distance 2.0 [assumes fragment in same model as other  
dv = fca.coord() - oa.coord()
dv.length = 2.0 - dv.length
for a in r.atoms:
	a.setCoord(a.coord() + dv)

# make fsa-fca-oa angle 120
from chimera import cross, angle, Point, Xform
fscrd, fccrd, ocrd = [a.coord() for a in (fsa, fca, oa)]
axis = cross(fscrd-fccrd, fccrd-ocrd) # axis the rotation will be around
delta = 120.0 - angle(fscrd, fccrd, ocrd)
v = fccrd - Point(0.0, 0.0, 0.0) # rotation is about origin, so move  
center atom there
trans1 = Xform.translation(v) # translation to origin
trans2 = Xform.translation(v) # translation back from origin
trans1.multiply(Xform.rotation(axis, delta))
for a in r.atoms:
--- end code ---

	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).
	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.


                         Eric Pettersen
                         UCSF Computer Graphics Lab

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20100504/3012f60b/attachment.html>

More information about the Chimera-dev mailing list