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

Thomas Goddard goddard at cgl.ucsf.edu
Mon May 17 10:40:24 PDT 2010

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


The allowed formats are listed in the file_writers variable in



> 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

More information about the Chimera-dev mailing list