[chimera-dev] Extension to export VTK format files
Tom Goddard
goddard at sonic.net
Thu Aug 8 16:15:43 PDT 2013
Hi Shawn,
Thanks, I've added your VTK export to the Chimera daily builds. Will be in tonight's builds.
Tom
On Aug 8, 2013, at 12:19 PM, Shawn Waldon wrote:
> Hi Tom,
>
> Thanks for the code tips and locations! I changed my code so that it works with Multiscale surfaces and the MSMSModel surfaces. I also handle the case where a multiscale surface piece doesn't have atoms (because it was generated as part of the biological unit) now using some helper functions from the msc command.
>
> As far as exporting things twice, the code does technically process the molecule twice. Once, which the model it is processing is the molecule itself, it creates points for atoms and lines for bonds and gives it some model number. Then when it is processing the surface it exports the geometry and the data for the closest atom to each point (that is relevant to that surface piece, thanks for that tip), but assigns this a different model number. In VTK it is relatively straightforward to threshold on this model num and just get the data that is of interest.
>
> I've attached the new version of the code. Let me know if anything else needs fixing.
>
> Shawn
>
>
> On Wed, Aug 7, 2013 at 1:46 PM, Tom Goddard <goddard at sonic.net> wrote:
> Hi Shawn,
>
> The solvent excluded surfaces produced by the surface command or menu Actions / Surface / Show are instances of Python class MSMSModel defined in share/MolecularSurface/msurf.py. They are a subclass of SurfaceModel and the only type of Chimera surface which has a direct association between surface vertices and nearest atoms. That association is given by s.atomMap which maps vertex number (0 based) to Python atom object.
>
> The MultiScale surfaces are a plain SurfaceModel. I'd suggest adapting your current code to use
>
>
> for piece in m.surfacePieces:
> if hasattr(m, 'surfacePieceAtomsAndBonds'):
> atoms, bonds = m.surfacePieceAtomsAndBonds([piece], create = False)
> # Now export associated atom (closest among atoms) for each vertex.
> …
> # Now add triangles for surface piece even if it has no associated atoms
>
>
> I didn't study your code closely but it seems you will handle molecules that belong to multiscale surfaces twice. Not sure if that will create duplicates in your vtk output.
>
> Tom
>
>
>
> --
> Shawn Waldon
> Graduate Research Assistant
> Department of Computer Science
> University of North Carolina at Chapel Hill
>
> <ExportVTK.zip>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20130808/dbbf49b8/attachment.html>
More information about the Chimera-dev
mailing list