the newsletter of
collaborative
computational project 1

CCP1 GUI Development: a Proto type Based on Python

Huub J. J. van Dam and Paul Sherwood
Quantum Chemistry Group, Daresbury Laboratory, Warrington WA4 4AD
h.j.j.vandam@dl.ac.uk and p.sherwood@dl.ac.uk

Introduction

This project has arisen partly as a result of a long-standing requirement for a graphical interface for the GAMESS-UK quantum chemistry package and partly as a result of demand within the UK academic community (principally through CCP1) for a free, extensible GUI for community codes and teaching purposes.

Software Development Approach

Before starting development we considered a number of possible software approaches to the project, including a variety of languages and toolkits. Python[1] has a number of attractions at the present time, including

  • an active open source community, with extension modules being available to handle a variety of interfaces (databases, system functions, visualisation toolkits etc).
  • wide cross-platform portability
  • the existence of an open-source molecular modelling tool (PyMOL, from Warren DeLano [2]) which although at a relatively early stage of development seemed to combine good quality, fast (OpenGL) graphics with extensibility in Python.
  • a considerable amount of work has been invested in computational chemistry using Python, most notably in the MMTK project of Konrad Hinsen [3] and the possibility that MMTK and PyMOL might be merged in future.
  • an interface to the Tk tools (TkInter) is available [4], providing a free toolkit for GUI construction.

After considering the options we decided to start a prototype development based on PyMOL. It offers the advantages of Python as a development environment and there are already some model building and visualisation features which our project can exploit immediately.

Since making this decision we have learnt that the team designing the CCP4 3D visualisation tool (aimed at protein crystallography) are also likely to base their developments on Python. This should provide a future opportunity to merge the tools and enable computational chemistry and crystallography codes to interoperate.

Classes and Inheritance

We make heavy use of the object-oriented nature of python with the intention that adapting and extending the GUI should be possible by creating new classes which can inherit much of the functionality of the existing code. A particular example of this philosophy is the successive inheritance from the classes as follows:

  • Calc; a generic computational chemistry calculation. At present little data is held in this structure, but in future it will be possible to used it to derive MM and QM/MM classes.

    • QMCalc; incorporating all attributes of the Calc class and including generic QM data and control structures, such as level of theory and basis set specification.

      • GAMESSUKCalc; containing the code specific to GAMESS-UK (input file generation, recovery of calculation results). In future the corresponding classes for other QM codes may be implemented in the same way,

An example of the utility of this structure is provided by the requirement for all ab-initio codes to access libraries of basis sets and effective core potentials. Much of this code can be incorporated into the QMCalc object and only the code-specific details, for example how to translate the basis set into the required input format, needs to reside in the GAMESSUKCalc object.

Because Python supports multiple inheritance it will be possible to define calculation interfaces contain both QM and MM control parameters, providing an efficient way to construct interfaces to the QM/MM packages such as ChemShell.

Current Functionality and GUI Layout

The interface is written using the TkInter toolkit and it is provided as an additional module which replaces the PyMOL TkInter interface module with an extended version. An additional menu provides access to the QM (and in future MM and QM/MM) calculation schemes.

At present the GUI allows setup and visualisation of GAMESS-UK calculations using a variety of Hamiltonians and the generation of optimised structures, frequencies, molecular orbitals and charge densities. The control data for each calculation is managed using a notebook widget, which allows the control data associated with each area of GAMESS-UK functionality to be grouped together.

A screen shot of the PyMol molecular graphics system showing the notebook widget used to set the QM code options.

The details of a QM calculation (including the results) can be saved to a file and restored for use in a new session.

Future Work

We are currently implementing a Z-matrix editor to allow the construction of internal coordinate definitions, and will provide an example of an extension to an addition QM code (probably a semi-empirical code, such as MOPAC).

Availability

The GUI is available on an open source basis from the CCP1 web page [5]. It is distributed on an open source basis and interested parties are invited to submit any developments back to the authors.

References

[1] Python http://www.python.org

[2] PyMOL: http://www.pymol.org

[3] MMTK: http://starship.python.net/crew/hinsen/MMTK/

[4] TkInter: http://www.python.org/topics/tkinter/

[5] CCP1 GUI development: http://www.cse.clrc.ac.uk/Activity/CCP1

previous contents forward
design by CCP1, March 2001