MoloVol - A Software Tool for Geometrical Analysis of Molecules

August 15, 2022

Reading time ~4 minutes

MoloVol is a software tool for a particular problem of theoretical chemists or biologist [1], that was released a year ago with a recent accompanying publication in the Journal of Applied Crystallography. It was developed by my friend Jasmin Maglic, whom I supported during the development. We just release the web version of that tool. One might ask since when I am working on chemistry software since my background nor my work is in the area of chemistry?

My work for many years on my game engine and game Caveland had a profound impact on me. It gave me incredible software engineering skills, but also showed me the amount of energy which can go into something, which does not last. I am hesitant to work on big projects now. I still have a deep desire to build things. This might be a personal thing but I think it is a trait that many men share. Many men also share the need to watch construction workers from the side and to the worker's suffering also comment on it and know everything better. I saw my friend build MoloVol and felt the same urge to comment and know everything better.

MoloVol was envisioned as an easily accessible cross-platform desktop-based application. I love desktop applications but I also have built my fair share of web tools and know the benefits of them (which is mainly no installation required). I saw the potential in MoloVol to become even easier to use, but just because I have some idea it is not going to become reality. Hence I went and created a proof of concept.

When I was in school I used the early internet in the 2000s for research to some homework. Sometimes you would find some tools that could help you do some calculations. They were simple HTML forms on websites with the aesthetics where a colourful pattern was repeated on the background, and the page was built using frames. This tool is my homage to this time and feeds on my nostalgia. I have worked in the area of web development before but it was always commercial, games and hobbies tools or university assignments. This tool should be used by real scientists. Hence we added some nice style sheets and added UX improvements. In that sense, we did a modernised version. We hope that the tools help scientists to do their work. (Update Mai 2023: MoloVol has already been accepted by the community and cited in some papers.)

Bildschirmfoto%202022-08-15%20um%2019.48.55 The first challenge was making the GUI application work with the command line. Compiling was difficult because the GUI library wxWidgets was expected as a dependency and I had issues installing it. WxWidgets is responsible for handling the arguments so it could not be left out of compiling the application without it. Luckily docker solved the issue of reproducible builds. I managed to create a dockerfile that compiles the dependencies and then the application (more adventures with dockerfiles in my last article). With the docker file, you can compile it on every machine. Using a fake frame buffer the application can run in headless mode, meaning that there is no rendering to a screen. A docker image for wxwidget can be found here.

Now that I could compile the application and run it in headless CGI mode, the next step would be to create a REST endpoint. By wrapping Python flask around a call to the subprocess you can simply provide HTTP support without touching C++ code and embedding a Webserver. For serving you can use Nginx which talks to the development flask web server [2]. When the client sends in a request with the HTTP accept header that it accepts HTML I serve a simple HTML form and voila, the web tool is running in your browser. This deployment is cheap and can run on a virtual host compared to other options e.g. running it on a Kubernetes cluster.

Update May 2023: In the meantime I have included the flask application in the docker container for easier deployment.

[1]: calculating surfaces, volumes and cavities of molecules

[2]: For better scalability, security etc. a wsgi or asgi server like Daphne should be used instead of the flask development wsgi server. There are docker images that provides all this, where you just set the flask application path.