vtkChemistry rendering toolkit

Hello everyone,

I’d like to briefly cover the current state of vtkChemistry, the
chemistry rendering kit for VTK that I’ve been developing this summer,
and provide an opportunity for the Avogadro community to make any
feature requests. I still have about a month remaining in the project,
and now that basic molecular / electronic visualization has been
implemented, I’m looking for input from the community. As potential
users of the vtkChemistry rendering kit, I’d like to include the rest
of the Avogadro team in the development process and find out what
features you’d like to see.

Feel free to comment on any of these methods, suggest alternatives, or
propose changes.

– Overview of Functionality –

The root of the kit is the vtkMolecule class. It can be populated a
number of ways, using either fast, compact calls to functions in
vtkMolecule (a useful method when converting from one storage format
to another) or through the use of the proxy classes, vtkAtom and
vtkBond. The proxy method is helpful when, say, parsing from XML, and
all of the data is not available at once.

The vtkMolecule class uses a vtkMoleculeMapper to control the
appearance of it’s rendering. Several of the common molecular
rendering styles are easily usable, including ball-and-stick, van der
Waals spheres, etc. The class is customizable to allow tweaking of
atomic radii, etc.

vtkProgrammableElectronicData stores orbital information as
vtkImageData, a format similar to a gaussian cube file. This class
only performs trivial setting/getting of the vtkImageData, however, a
custom subclass of vtkAbstractElectronicData may be more complex; for
instance, the vtkOpenQubeElectronicData class will calculate
on-the-fly and then cache electronic information using the OpenQube
library.

A vtkMolecule can be used as input for a vtkElectronMapper and
vtkElectronActor, if it holds a pointer to a object subclassed from
vtkAbstractElectronicData. The vtkElectronMapper/Actor classes provide
a convenient way to visualize the electronic data (currently MOs and
electron density). This is currently possible using isosurfaces or
volume rendering techniques.

Another useful class worth mentioning is vtkPeriodicTable, which
provides access to the elemental data in the Blue Obelisk Data
Repository, available under the open-source MIT and “New” BSD
licenses. This is used to obtain atomic radii, default color mappings,
electronegativities, and much more.

– Screenshots –

To see some sample renderings that have been produced using this
toolkit, see the following links to my blog, where I have been posting
updates on the kit’s progress:


– Obtaining the current code –

To see the code, it is available on my github fork of VTK in the
“chemistry-unstable” branch. It can be checked out using the git VCS:

git clone git://github.com/dlonie/VTK.git
cd VTK
git checkout origin/chemistry-unstable

The code is in the Chemistry subfolder, with a few files in Filtering.
The source code and API can be browsed online here:

http://github.com/dlonie/VTK/tree/chemistry-unstable/Chemistry

– Example –

To provide a feel for how the library is used, the following code will
render a molecule along with its LUMO, using a
vtkOpenQubeMoleculeSource to create the molecule:

//--------------------------------------------------------------------------
// Set up molecule source
vtkNew oq;
oq->SetFileName(fname);
oq->Update();

//--------------------------------------------------------------------------
// Molecular geometry
vtkNew molMapper;
molMapper->SetInputConnection(oq->GetOutputPort());
molMapper->UseLiqouriceStickSettings();

vtkNew molActor;
molActor->SetMapper(molMapper.GetPointer());

//--------------------------------------------------------------------------
// Electron cloud
vtkNew eleMapper;
eleMapper->SetInput(mol);
eleMapper->UseLUMO();

vtkNew eleActor;
eleActor->SetMapper(eleMapper.GetPointer());
eleActor->SetRenderStyleToVolume(); // Could be Isosurface instead

Add eleActor and molActor to the target renderer, and that’s a
complete pipeline.

I have a request on my list for plotting contour slices of electronic
data, using broken lines to draw the negative isolines if possible. I
will certainly implement the contour slicing, and I’ll look into the
negative line style.

I may not find time to implement another request from earlier to add
spectroscopic tensor plotting, but there is an extension to avogadro
I’ve written to do this if anyone is interested:
http://github.com/dlonie/TensorVis

Any further requests are welcome!

Thanks,

David Lonie