GSOC 2016

21 Aug 2016

alt text

Integration of cclib with Avogadro 2

A little Introduction

I applied for Google Summer of code in the final semester of my undergraduate studies. During my undergraduate studies I concentrated on the field of Computational Chemistry, where I used Avogadro quite a bit. Avogadro is an advanced molecular editor, used for various research purposes.

I applied for GSOC-2016 under the Open Chemistry organization because I had extensively utilized the applications provided by them and I wanted to give back to the community. The entire summer has been a very fruitful period where I have interacted with my mentors on a daily basis. I have also indicated to them that I wish to continue contributing to the organization.

cclib is an open source library, written in Python, for parsing and interpreting the results of computational chemistry simulations. It provides a consistent interface to extract (parse) data from the output files generated by various cheminformatic program packages like Gaussian, Gamess, Jaguar, MolPro, Orca etc.

Avogadro-2 is an advanced molecular editor which provides flexible rendering, and a powerful plugin architecture designed for use in computational chemistry, molecular modeling, and other related areas. Avogadro-2 is part of the OpenChemistry suite of applications.

This project proposed to integrate the cclib data parsing library with Avogadro-2 using the Chemical JSON format. Chemical JSON is a standard JSON format being developed by the OpenChemistry group across different applications.

  1. Organization : Open Chemistry
  2. Project Title : Avogadro-2: Integration of cclib data parser using Chemical JSON (Abstract)
  3. Mentors:
  4. Repositories contributed to:
  5. Commits authored:
  6. Pull requests:

Work accomplished:

Chemical JSON

The chemical JSON design was completed with the help of Karol Langner, Adam Tenderholt, Geoffrey Hutchison and Marcus Hanwell. The design has been shared here on a public Google Doc.

The 56 different attributes that the cclib library can parse have been organized under the right object names (such as properties, atoms, vibrations, optimization etc). These attributes have also been given a more human readable Key name (for e.g: ‘Anharmonicity constants’ for ‘vibanharms’ attribute).

Using this design spec as a model, the CJSON writer was implemented and merged with the cclib library. Users of cclib can use the CJSON writer in the following manner to generate a CJSON file from any computational chemistry output file which cclib supports.

On command line:

for the indented version: ccwrite cjson output_file_name

for the non indented version, a –terse flag is provided: ccwrite cjson --terse output_file_name

An example input file is provided here, and the generated CJSON files are available here:

Similarly a CJSON reader was implemented and merged with the parent repository. Using the cjsonreader a user can parse any of the 56 attributes that cclib supports by the following command:

ccget --cjson <attribute_name> output_file_name

Avogadro 2

The primary task in the integration was to develop a manner in which the computational output file provided by the user would be passed to cclib and the generated CJSON would be read by avogadro internals.

The cclib-avogadro interfacing script was written in the form of a formatScript (python). The generated CJSON was passed to a CJSON file format which previously existed. The CJSON format was extensively developed to parse and store the attributes that are available in the CJSON. The data parsed from the CJSON file was stored in the internal Data structures of the Molecule class.

From this stored data, the Molecular Properties dialog box was split into two :

General Properties

General Properties

Energy Properties

Energy Properties

Future Tasks:

  1. Integration of the CJSON Data structure within the cjsonwriter
  2. On the cclib end, relevant test cases for the cjson writer and reader are pending
  3. Migration of the Orbitals Widget from Avogadro-1 to Avogadro-2
  4. Integration of cclib in the Open Chemistry super-build

Personal Takeaway:

It’s been a very hectic 5 months to say the least, I had a sync up session with both Karol and Adam on a daily basis. We used to meet at 9.15 p.m IST (8.45 a.m PST) where we would discuss what I did during the day and if I was stuck in any way.

I learnt new things about Python and C++ on a daily basis. The design aspect of the project was quite challenging and a lot of fun, hearing everyones opinion and understanding their thinking behind them helped me grow a lot.

On a formal note: I would like to thank the following: