Re: [chimera-dev] Volume covered by a group of atoms

Hi Miguel, For finding clashes you would use the detectClash() method in the DetectClash module. It has a pretty long doc string so I think it will be clear how to call/use it.
Also, just a question: is there a way to access bonds as part of a tree? I would like to select the atoms implicitly from the list of bonds to be rotated.
I'm reading this as: for a given torsion, what are the atoms that will be rotated? There is a function of Molecule (m.traverseAtoms()) that returns atoms in traversal order. Furthermore, that function can ignore (i.e. cross) "break points" (active torsions) or not cross them. That is the function you would use, but you would need to restructure your code so that you only have one torsion active at a time rather than all of them. Here's a loose outline: # activate torsion br = bondRotMgr.rotationForBond(b) # which atom is opposite the "anchor" side of the torsion (anchor == unmoving side) ma = b.otherAtom(br.anchorSide) # what is the "root" for graph-traversal purposes on that side root = ma.molecule.rootForAtom(ma, False) # the "False" means don't ignore active torsions # list of atoms on that side myatomlist = ma.molecule.traverseAtoms(root) ...do the stuff that drives the torsion... # deactivate torsion br.destroy() --Eric On May 13, 2010, at 4:13 AM, Miguel Ortiz Lombardia wrote:
Hi Eric and Tom,
Thank you! Yes, I would like to improve the script so, it would be great if you can give me pointers about clashes and filling the VDW space!
Also, just a question: is there a way to access bonds as part of a tree? I would like to select the atoms implicitly from the list of bonds to be rotated.
Best regards,
Miguel
Le 13 mai 2010 à 02:15, Eric Pettersen a écrit :
Hi Miguel, The script still is pretty useful! I've added it to the "Python Scripts" page on our wiki (Scripts – Chimera). You are right that improvements could be made, but it's a nice starting point. If you ever decide to refine the script, I could probably provide pointers on finding clashes, whereas Tom Goddard (whom I've cc'ed) would probably have to be the one to assist in filling a grid based on the atom's VDW radius (presumably scaling a three-dimensional gaussian or some such).
--Eric
On May 12, 2010, at 1:46 PM, Miguel Ortiz Lombardia wrote:
Le 12 mai 2010 à 19:00, Eric Pettersen a écrit :
Hi Miguel, I'm glad you got everything sorted out. Good luck. Feel free to shoot me any further questions you might have.
--Eric
Hi Eric,
Thanks! I managed to make it work. I'm attaching the script in case you or someone may find it useful. There is only a point I haven't managed to solve: as it is, the script creates a grid point at the atom center positions, while I would be more interested in the van der Waals volume. Nevertheless, since this is a very naive approach (it would be more interesting, for example, to avoid any clashes) I'm using an external set of programs (mapman and mama from the "Uppsala Software Factory") to extend this volume by a couple of grid points.
I'm attaching as well a figure so you see how it looks like (after expansion with mapman/mama).
Thanks for your advice, I have learnt a lot from this exercise.
Best regards,
-- Miguel
Architecture et Fonction des Macromolécules Biologiques (UMR6098) CNRS, Universités d'Aix-Marseille I & II Case 932, 163 Avenue de Luminy, 13288 Marseille cedex 9, France Tel: +33(0) 491 82 55 93 Fax: +33(0) 491 26 67 20 e-mail: miguel.ortiz-lombardia@afmb.univ-mrs.fr Web: http://www.pangea.org/mol/spip.php?rubrique2
<C3vol.png><torspace.py>
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
-- Miguel
Architecture et Fonction des Macromolécules Biologiques (UMR6098) CNRS, Universités d'Aix-Marseille I & II Case 932, 163 Avenue de Luminy, 13288 Marseille cedex 9, France Tel: +33(0) 491 82 55 93 Fax: +33(0) 491 26 67 20 e-mail: miguel.ortiz-lombardia@afmb.univ-mrs.fr Web: http://www.pangea.org/mol/spip.php?rubrique2

Hi Eric and Tom, Thank you very much for your ideas. Eric, you guessed exactly what I meant concerning the atom selection. I have now implemented it in a way that works, though I cannot include the torsion deactivation. If I include br.destroy() I get this error: Traceback (most recent call last): File "/Applications/Sci/Struct/Chimera.app/Contents/Resources/share/chimera/tkgui.py", line 345, in openPath mols = chimera.openModels.open(path, type=ftype) File "/Applications/Sci/Struct/Chimera.app/Contents/Resources/share/chimera/__init__.py", line 1497, in open models = func(filename, *args, **kw) File "/Applications/Sci/Struct/Chimera.app/Contents/Resources/share/chimera/__init__.py", line 938, in _openPython loadFunc(sandboxName, fileName, f) File "torspace.py", line 43, in <module> File "/Applications/Sci/Struct/Chimera.app/Contents/Resources/share/BondRotMgr/__init__.py", line 138, in increment self.bondRot.angle = (self.get() + increment, self.__anchorSide) File "/Applications/Sci/Struct/Chimera.app/Contents/Resources/share/BondRotMgr/__init__.py", line 135, in get return self.bondRot.angle ValueError: underlying C++ BondRot object is missing I'm afraid I don't clearly understand the concept of "active torsion" in the context of the script. What I do is to read the first torsion and assume it is the root of all the torsions to be rotated about so it can be used to select the atoms that will move in the way you showed. Then I create my 'torsionlist' as before. It seems to work. Now, I discovered that there were two errors in my original script: 1/ The torsion angle should be incremented by the step of the angle loop variable, not by the value of the variable itself... That is: for angle in range(0,360,step): torsionlist[0].increment(step) 2/ More importantly, the way I wrote the script was rotating one torsion angle after the other and not in a nested way, as I wanted. I have modified now the script to do it this way. In my laptop this means that the step has to be significantly bigger. If I try to compute more than about 25000 total steps, Chimera takes all memory available and eventually hungs. This problem seems not to appear (or be less important) if the script is run from the terminal with the --nogui option. But then, I haven't found yet how to save the volumen as a brix map... So, for the time being I'm limiting the number of torsion angles to be evaluated to 6. I'm attaching a corrected version of the script. I will now try to develop it following your suggestions. Best regards, -- Miguel Architecture et Fonction des Macromolécules Biologiques (UMR6098) CNRS, Universités d'Aix-Marseille I & II Case 932, 163 Avenue de Luminy, 13288 Marseille cedex 9, France Tel: +33(0) 491 82 55 93 Fax: +33(0) 491 26 67 20 e-mail: miguel.ortiz-lombardia@afmb.univ-mrs.fr Web: http://www.pangea.org/mol/spip.php?rubrique2

Hi Miguel, The Python call to save your volume data model v in a file is v.write_file('/tmp/myfile.brix', format = 'dsn6') If you do not want to create the volume model you can instead directly write out the grid object. from VolumeData import save_grid_data save_grid_data(grid, path, format) I figured this out by looking at the write_file() Python code in chimera/share/VolumeViewer/volume.py The allowed formats are listed in the file_writers variable in chimera/share/VolumeData/fileformats.py Tom
Hi Eric and Tom,
Thank you very much for your ideas. Eric, you guessed exactly what I meant concerning the atom selection. I have now implemented it in a way that works, though I cannot include the torsion deactivation. If I include br.destroy() I get this error:
Traceback (most recent call last): File "/Applications/Sci/Struct/Chimera.app/Contents/Resources/share/chimera/tkgui.py", line 345, in openPath mols = chimera.openModels.open(path, type=ftype) File "/Applications/Sci/Struct/Chimera.app/Contents/Resources/share/chimera/__init__.py", line 1497, in open models = func(filename, *args, **kw) File "/Applications/Sci/Struct/Chimera.app/Contents/Resources/share/chimera/__init__.py", line 938, in _openPython loadFunc(sandboxName, fileName, f) File "torspace.py", line 43, in<module> File "/Applications/Sci/Struct/Chimera.app/Contents/Resources/share/BondRotMgr/__init__.py", line 138, in increment self.bondRot.angle = (self.get() + increment, self.__anchorSide) File "/Applications/Sci/Struct/Chimera.app/Contents/Resources/share/BondRotMgr/__init__.py", line 135, in get return self.bondRot.angle ValueError: underlying C++ BondRot object is missing
I'm afraid I don't clearly understand the concept of "active torsion" in the context of the script. What I do is to read the first torsion and assume it is the root of all the torsions to be rotated about so it can be used to select the atoms that will move in the way you showed. Then I create my 'torsionlist' as before. It seems to work.
Now, I discovered that there were two errors in my original script:
1/ The torsion angle should be incremented by the step of the angle loop variable, not by the value of the variable itself... That is: for angle in range(0,360,step): torsionlist[0].increment(step)
2/ More importantly, the way I wrote the script was rotating one torsion angle after the other and not in a nested way, as I wanted. I have modified now the script to do it this way. In my laptop this means that the step has to be significantly bigger. If I try to compute more than about 25000 total steps, Chimera takes all memory available and eventually hungs. This problem seems not to appear (or be less important) if the script is run from the terminal with the --nogui option. But then, I haven't found yet how to save the volumen as a brix map... So, for the time being I'm limiting the number of torsion angles to be evaluated to 6.
I'm attaching a corrected version of the script. I will now try to develop it following your suggestions.
Best regards,
-- Miguel
Architecture et Fonction des Macromolécules Biologiques (UMR6098) CNRS, Universités d'Aix-Marseille I& II Case 932, 163 Avenue de Luminy, 13288 Marseille cedex 9, France Web: http://www.pangea.org/mol/spip.php?rubrique2

On May 15, 2010, at 2:29 PM, Miguel Ortiz Lombardia wrote:
I'm afraid I don't clearly understand the concept of "active torsion" in the context of the script. What I do is to read the first torsion and assume it is the root of all the torsions to be rotated about so it can be used to select the atoms that will move in the way you showed. Then I create my 'torsionlist' as before. It seems to work.
You can't increment or otherwise work with a torsion after you've destroyed it -- that's why you got an error. I assumed you would use the torsion just to determine the atom list, not try to continue to use it after the destroy() call. Therefore, in the context of your script it is correct not to call destroy, as you found out through experimentation. All the torsions you've created and not yet called destroy() on are "active". That means that each one is a "break point" as far as graph traversal is concerned. Therefore the way you went about it -- activating only one torsion, getting the atom list, then activating the other torsions -- gives you the right list of atoms. If you had activated all the torsions before asking for the list of atoms you would have had trouble. --Eric
participants (3)
-
Eric Pettersen
-
Miguel Ortiz Lombardia
-
Thomas Goddard