Skip to content

Avogadro: Surface Support

I am pleased to announce that we now have working surface support in Avogadro. We originally began working on support for surfaces around November time when Geoff improved the support in OpenBabel for grids and added some initial code to the Avogadro repository. Quite quickly it became evident that this algorithm did not deal well with data sets containing discrete objects that you wanted to polygonise.

I began a search of the available algorithms and came across a very nice guide to the marching cube algorithm with example code. I had a brief look for a C++ implementation and didn't find anything initially, began implementing what was on his page and then came across Zhu3d which is a Qt 4 based program that actually uses an implementation of the algorithms described in the guide and references them. As it is GPL licenced code I imported the relevant class into our repository and began the task of adapting it to fit into our framework.

Avogadro surface pointsAvogadro surface lines

With some code from Geoff, more pointers from Geoff, some reading and quite a bit of help from Tim (not sure if he has a web page/blog) we got it working. Since then Tim has actually fixed a big bug in OpenBabel that was causing crashes and done more work on the IsoGen class. The screenshots above show the results of our early work where initially we got points and then lines working. I was very pleased at this stage as it adds a feature that had been missing for quite some time to the Avogadro framework.

Avogadro surface with filled trianglesAvogadro surface with filled triangles coloured by electrostatic charge

I then got filled triangles added with transparency support, allowing us to visualise the underlying structure of the molecule and map other parameters onto the surface. Tim then added electrostatic charge mapping to the colour of the surface which I hope you agree is already looking very good.

There is still quite a bit left to do. I need to move the class into libavogadro and out of the engines, integrate it into our Painter API, implement caching and am thinking of using the Qt Concurrent framework to do intelligent multithreading once Qt 4.4 is released as surface generation is quite slow for big molecules. I also need to link the mesh size to the global quality level and see what other optimisations might be possible. Another big one is adding support for visualising molecular orbitals. Geoff has already done a lot of work on the back end in OpenBabel for this and so hopefully it will not take me long to get it added in.

Lots to do but some great progress already. I would love to know what you think. Once we have been able to polish this new feature a little I hope we can get a release out of the door so that more people can test out these new features and let us know what they think, point out bugs and shower us with compliments ;-) Until then I hope you enjoy the screenshots!

Note: For some reason the exported graphics shown in this post were not antialiased. They are on screen and I need to look into why they are not when I export graphics in this way.

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

Magnus Lundborg on :

Magnus LundborgI think this looks really good. I'm very interested in all openbabel progress and it seems very promising. When it comes to chemistry it is still a bit difficult to replace some commercial programs with free applications, but soon I hope it will be possible.

Marcus D. Hanwell on :

Marcus D. HanwellWell this is a mixture of OpenBabel and Avogadro progress but I am glad you like what you see ;-) We are certainly trying to get useful features into Avogadro and make it easy to extend for other people.

What do you feel are the main barriers preventing you from replacing commercial programs? It interests me when people make these statements but I certainly agree we do not have all the features of all the commercial applications just yet!

Magnus Lundborg on :

Magnus LundborgYes, I'm sorry that I forgot to mention Avogadro. Of course I want to acknowledge to success of Avogadro too. Very impressing.

What I mainly miss in open source is still a good, and above all stable, 2D drawing program. I admit I have only tested BKChem, GChemPaint, JChemPaint, molsKetch and XDrawChem most of them are good but none of them fulfill my needs quite yet. If I had more time I would try to improve at least one of them, but I cannot do that right now.

When it comes to 3D viewing, docking, calculations and simulations the situation is certainly a lot better.

mxttie on :

mxttieI always had a negative feeling about the marching cubes algorithm because of the patent issue so I was surprised to see it in open source libs.. So I looked it up and guess what? the patent has expired, yay! =)

Marcus D. Hanwell on :

Marcus D. HanwellYep - I forgot to mention that the patent had expired. I am also looking at adding the tetrahedron algorithm too but this is very early code with lots of rough edges. Kind of amazed they ever allowed someone to patent this algorithm but software patents often amaze me (and not in a good way)...

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA 1CAPTCHA 2CAPTCHA 3CAPTCHA 4CAPTCHA 5


You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.