The Graphical User Interface(GUI) is important part of the program which very much simplify the work with a complicated program and permit intuitive dislpay of results of simulations. GUI designing require substantial programming eorts and until only com- ercial simulation packages were based on the GUI. Our nal goal is to achieve the same type GUI functionality and exibilty as in the best comercial programs as InsightII or HYPERCHEM, while maintain the code for developers so new functionality can be added to the program. GUI of HARLEM is build on the basis of MFC(Microsoft Foundation Classes) which is a standard library for the development of applications for WINDOWS operating system, X- WINDOWS MOTIF library (a standard for UNIX environment) and RASMOL a powerful and portable freeware program for molecular visualization. HARLEM adopts a so called Document/View architecture, which is supported by MFC classes. HaMolSet class which as we described in the previous section the core class of the program specing the geometry molecular system under study is derived from the CDocument class of the MFC library, while 3D representation of the molecular system is given by HaMolView class which has a parent CView class of MFC library. We employ so called MDI (Multiple Document Interface) organization of the program, which immediately permits several instances of CDocument class (in this case several molecular sets) to coexist in the same instance of the program. HaMolView class which shows a 3D image of the molecule is built on the basis of RASMOL program. RASMOL allow several methods of 3D representation of the molecules. Available display modes include: (1)wireframe model (bonds are represented as lines) (2) spacell (atoms are represented as spheres) (3) sticks (bonds represented as cylinders) (4) ball and stick (a combination of sticks model and spacell model with decreased atom radii) (5) ribbons and cartoon(solid ribbon) represenation of the biomolecular secondary structure. RASMOL permits exible coloring schemes for atoms and bonds, allows the display of 119 the atomic labels, boundary boxes, dot surfaces, hydrogen bonds (as dotted lines). It has simple menu interface for the most frequently used functions and a quite developed text command language. RASMOL can read and write molecular geometry in several popular formats and save displayed molecular image is several graphical formats. While incorporating RASMOL to our program we tried to preserve RASMOL functionality and compatibility of the text command interface. Thus a person familiar with RASMOL can immediately perform basic molecular display operations on HARLEM. RASMOL is written in C programming language and because of the way the data are organized inside the program allows only one molecule and one molecular image to be displayed. We translated RASMOL code into C++, incapsulating into separate classes data structures and code of the program performing specic tasks and eliminating global functions and variables. We achieved a substantial localization of the code of the program, which among other allowed to present simultaneusly several molecules in the same window, each of each can be indepedently created and manipulated. This functionality will be very useful for future simulations of intermolecular interactions with the program, and the addition of molecular editing functionality to the program. The method of allocation of memory and storage of data in HARLEM substantially changed compare to RASMOL. In RASMOL the collections of item such as atoms are organized as linked lists, with each item containing a pointer of the next item in the collection. Allocation of the memory for items were performed with specialized utility functions. We straighforward memory allocation and storage of the data using contaner template classed of the STL library. RASMOL is running on UNIX, WINDOWS and MAC-OS operationg systems with a min- imal amount of a code specific for a given platform. Such a transferability is achieved thanks to the development of the specialized library of functions realizing 3D primitives, such as line, cylinder of sphere. These functions ll a buer which represent 3D image of the molecular system. This buer can be displayed on the screen, with just a few system dependent commands, which makes most of the code of the program system independent. We incapsulated graphical primitives and the associated data structures into a class Can- vas3D which is contained in the main molecular display class HaMolView. Substitution of the Canvas3D class by the class which maintain the same member function call interface but using different libraries of 3D primitives for example OpenGL library, provide a path 120 to modify molecular 3D display in HARLEM without great changes in the program text. HaMolView class maintain a pointer to an instance HaMolSet class which contains a list of pointers to 3D objects being displayed. An C++ abstruction for the 3D object is Object3D class. Every 3D object can be rotated and translated independently of each other in screen coordinates (only tranformation matricies of the objects are chanaged) or in real space (reference coordinates of the object are changed). There are currently only two types of 3D objects : HaMolecule class (abstraction for a molecule) and HaSurface class (abstruction for a contour surface). However new graphical elements can be easily if they can be displayed with graphical primitives of Canvas3D class. The possibility to display contour surfaces is a new functionality of HARLEM compare to RASMOL. Introduction of these new graphical elements was very much simplied by the object-oriented design of the program. Interaction of a user with the program functional modules is mostly accomplished through the dialogs. In the Windows version of HARLEM every dialog is a class, deirved from MFC CDialog class. Dialogs of the Unix-Motif version of the program are organized as functions because Motif library written in C not in C++. There about 20 dialogs currently in the program. Every dialog maintains a pointer to the class which is associated with, for example a pointer of some computational module (an instance HaCompMod class). When the user click mouse close to a particular atom in the 3D display window associated with HaMolView class, open dialogs which can use this information are notied. This way the user can interactively choose atoms or other graphical elements in the 3D display. Unix/Motif version of the program was not updated for several mothes due to the neccessety to rewrite dialogs in Motif, which were relatively easily generated under Windows using MFC classes. We plan to reorganize Unix Menu and Dialog interface so it will be more compatible with Windows interface, eliminating or reducing the need to write the different code of the same functionality for different platforms. One path can be the use of comercial or freeware WIN32 clone libraries, which allow to compile MFC library on UNIX and directly transfer the code from Windows to UNIX. Another alternative can be to write our own clone of the main MFC classes with a minimum neccessary functionality to encapsulate MOTIF functions into classes with the same member function calling specications as MFC classes. RASMOL mechanism of text command processing was modified in HARLEM to better fit the object-oriented design of the program. Classes of the program which need handle text commands are derived from HaTextCmdTarget class. A command entered through dialog interface a by other means (for example form the processing of the script or remote command) First handled by currently active instance of HaMolSet class which then redirect it if neccessary to be processed in other class derived from HaTextCmdTarget for example some computational module. Such code organization permits developers working on a particular module introduce text commands specific for their modules without changing basic classes used by other modules.
1.3.6