Object-oriented programming in crystallography

David S Moss and William R Pitt
[coat of arms]
Department of Crystallography
Birkbeck College
Malet Street
London WC1E 7HX
UK

Introduction

In the late 1950s crystallographers were among the first scientists to make use of computers. In fact much of the crystallographic computing software that we use today has its origins in the 1960s when 32k was a typical core memory size of computers. Since then there have been increases of several orders of magnitude in both the memory size and speed of computers. Crystallographic software has taken advantage of these developments which have, for example, permitted electron density maps to be stored in central memory.

Developments in software engineering have also taken place, particularly in the past ten years. Arguably the most significant development has been the object oriented approach to software construction and its support in new programming languages such as C++ and Java. However, crystallographic computing with its large base of legacy code, is only just beginning to exploit these new developments.

Many other changes in software development have taken place. Ten years ago scientific programming was done almost exclusively in Fortran, file formats were relatively simple, graphical user interfaces had not emerged as an important issue and the explosive growth of macromolecular crystal structures had only just started. Today C has become one of the most widely used language for scientific computing and the Internet and the World Wide Web have transformed the way in which the scientific community can participate in software development and gain access to the results. The Linux operating system (Unix clone for PCs) is a remarkable testimony to what can be achieved.

Object technology has recently gained widespread acceptance in software development, not just because of code reusability, but because it takes advantage of a new generation of object oriented environments. These environments and associated tools are rapidly becoming standardised. A draft ANSI C++ standard has been published and its new Standard Template Library is likely to influence programming paradigms for years to come. The Common Object Request Broker Architecture ( CORBA), which allows the distribution of objects across disparate systems, is becoming an industry standard for distributed objects and OMDG has set a standard for object databases. The latest release of the X-Window system contains an object oriented application framework ( FRESCO) which uses CORBA to allow the distribution of graphical objects. On the World Wide Web, the Java language which is exclusively object oriented, is already having an important impact on the engineering of Web software.

Object-oriented programming in crystallography

The purpose of the tutorial will be to enable the student to appreciate the basic concepts of object oriented programming.

Practical examples will allow students to use a class library which will enable them to construct atom and molecule objects. They will be able to write software to rotate molecules and carry out molecular geometry calculations. These simple calculations would require considerable effort on the part of a student if he/she were to write a program from scratch to carry them out. However, object oriented programming facilitates the production of reusable code. This code comes in the form of class libraries. One such library is the Standard Template Library which provides simple and efficient methods for storing and accessing any sort of data (including atom and molecule objects). This library has been heavy exploited in the production of a class library for bioinformatics and molecular modelling currently being developed at Birkbeck College Crystallography Department. Atom, residue, and molecule classes are included in this library. It is this library that will be used by students during the tutorial.

The C++ programming language will be used throughout but the use of Java will also be discussed.

Who will benefit?

Students who already know some Fortran and/or C and are planning to develop crystallographic software will benefit from this tutorial if they are considering an object oriented approach.