GSoC 2022

Enhancing Avogadro for Biomolecular Modeling

This summer I set out to improve Avogadro 2 for better handling biomolecules. Here is the initial proposal; now I'd like to share my experience and review what was done.

Early performance work

My work on Avogadro started way before GSoC. Most of it involved fixes and optimization, as well as completing one of my GSoC goals: formal charge support.

Line chart, showing a 5-10x improvement over the preceding code for PDB loading
Performace impact of the aforementioned optimization.

Overall, these changes managed 35-50 times faster PDB import, as well as 15 times faster hydrogen adjustment, to give a few numbers.

More low-level changes

The weeks before starting GSoC were focused on cleaning up the code.

June: non-covalent interactions

One of my goals this summer was to implement at least one kind of molecular interaction, that would be rendered in a predictive manner. In June, I ended up implementing both generic "close contacts" and angle-dependent pair-hole interactions: hydrogen, chalcogen and halogen bonds.

Avogadro 2 screenshot, showing two hydrogen bonds and a close contact
Intermolecular hydrogen bond prediction.

June-July: molecular surfaces

The other major goal of mine was getting the unfinished molecular surface generation code to work. A marching cubes algorithm was already in place for generating meshes, all that was missing was computing some sort of distance function, plus a Laplacian smoothing algorithm to make the mesh look nice afterwards. I also had the goal to get surface coloring by mapping at least one property.

Avogadro 2 screenshot, showing a translucent surface generated around an aconitase molecule
Solvent-excluded surface with Laplacian smoothing, aconitase.

An Aspirin molecule with a solvent-accessible surface colored by electrostatic potential
Aspirin, with SAS colored by electrostatic potential (Gasteiger).

So, everything went smooth: Van der Waals, Solvent Accessible and the somewhat more complicated Solvent Excluded surfaces were all implemented, with Laplacian smoothing in place and coloring by electrostatic potential (with many methods and color schemes to choose).

July: revisiting everything

I had been made aware of a missing functionality with PDB/MMTF that had caused problems to at least one user. At the same time, I wanted to finish the remaining non-covalent interactions: salt bridges and "bad" contacts.

Zoomed view into '1ayo', displaying many salt bridges, hydrogen and chalcogen bonds...
Different kinds of interactions on the surface of 1ayo.

Helping out with templates

I had stated as a GSoC goal that I would work on coordination compounds. While I had a vague idea of what that could mean (updated charge/order/valency perception, zero-order bonds...) and had sketched some more or less developed proposals, an opportunity arose to work on meaningful functionality. My mentor, Geoff, had been working on a new tool to easily create coordination complexes and add chemical groups to molecules.

An iron-containing complex, with porphin, cyano and Cp ligands
Complex of iron with porphin, cyano- and Cp ligands.

Bonus: fancier rendering

Having finished all the proposed tasks, and with a few weeks remaining, I decided to go for a more ambitious target. I would try to implement post-processing shaders, and learn graphics programming along the path, in a practical way.

Avogadro 2 screenshot, showing a ribosome with Ambient Occlusion and Edge Detection on
Ribosome, with SSAO and Edge Detection enabled.