[Chimera-users] Volume covered by a group of atoms

Eric Pettersen pett at cgl.ucsf.edu
Mon May 10 14:33:12 PDT 2010

On May 9, 2010, at 10:14 PM, Miguel Ortiz Lombardia wrote:

> Dear all,
> I would like to represent as a volume the space that would be  
> covered by a set of atoms that are bound by "torsionable" bonds when  
> one systematically modifies those torsion angles. An example would  
> be the side-chain of an amino acid; imagine I would like to have a  
> glimpse of what part of the space could be occupied by that side- 
> chain. As a first approximation I wouldn't care about clashes.
> I would appreciate if someone can point me to an existing way of  
> obtaining such representation or to an algorithm that could be  
> implemented within chimera (which I would be happy to share with  
> other interested people; if I manage to code it, that's it!)

Hi Miguel,
	This problem has two parts:  adjusting the torsions and visualizing  
the result.

Adjusting the Torsions

	If you're adjusting the chi angles of an amino acid, then this is  
easy in Chimera.  Each such residue has chi1/chi2/chi3 attributes that  
you can set, e.g.:

for chi1 in range(0, 360, 10):
	r.chi1 = chi1
	for chi2 in range(0, 360, 10):
		r.chi2 = chi2
		for chi3 in range(0, 360, 10):
			r.chi3 = chi3
			do something

You'd probably actually want to write the code as a recursive routine,  
since otherwise it is awkward to handle the fact that some residues  
have different numbers of chi angles than others.  You might also want  
to change your angle increment based on the recursion depth.
	If you're changing torsions that aren't the well-known amino acid chi  
angles, then you'll have to resort to Chimera's more generic torsion- 
adjustment facilities, the core of which are in the BondRotMgr  
module.  Specifically, if 'b' is the bond you want to adjust, then:

from BondRotMgr import bondRotMgr
torsion = bondRotMgr.rotationForBond(b)

and then torsion.increment(amount) will increment the torsion angle by  
'amount' degrees (from its current position).  If you want to set the  
dihedral to a certain value (rather than just increment from the  
current position) then you will have to measure the dihedral you care  
about with:
chimera.dihedral(a1.xformCoord(), a2.xformCoord(), a3.xformCoord(),  
and then use the appropriate increment value, or use  
chimera.phipsi._setAngle(bond, newAngle, curAngle) [in the latter case  
you don't have to call rotationForBond yourself].

Visualizing the Result

	There are a bunch of possibilities of course.  I'll touch on two: a  
bunch of spheres, and an actual volume.

1) As you change the torsion, you can use each atom's .coord() method  
to get Point instances which can be used to place helium atoms at  
those positions with BuildStructure.placeHelium().  You could put the  
heliums in the same model or in a new model (by providing a model name  
to your first call of placeHelium()).

2) Computing a volume is not too hard conceptually.  Basically you  
decide on a grid spacing and then make a dictionary that maps xyz grid  
addresses to occupancy counts (omitting counts of zero).  Then you  
find the lower and upper bounds for each axis, create a 3D array with  
corresponding dimensions, and populate that array with your counts.   
Then you can open that in Volume Viewer and use all the Volume Viewer  
facilities to look at the occupancy.

There is code that does just this in Movie.gui, it's MovieDialog's  
computeVolume method.  The line:

gridData = {}

initializes the occupancy-count dictionary and the loop that  
immediately follows that populates the dictionary.  Most of the loop  
isn't relevant for you (getting the right coordinate set and adjusting  
for "hold selection steady") but the very end of the loop is, the part  
that maps coordinates into xyz grid addresses and adjusts the  
corresponding count.  Then after that the loop the "generate volume"  
and "show volume" sections are largely relevant.


                         Eric Pettersen
                         UCSF Computer Graphics Lab

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20100510/01a5af49/attachment.html>

More information about the Chimera-users mailing list