What was new in version 2?

Version 2 of MolScript is a major new release. There are several new output formats and several new features. In fact, it is an entirely new program, with much expanded functionality compared to previous versions (v1.4 and older). It is almost completely backwards-compatible with the previous versions.

Interactive OpenGL

A new interactive OpenGL mode is available on computer systems that support OpenGL. The implementation uses the GLUT library by Mark Kilgard for the window system interface.

The rendering is based on the same graphics objects as the other output formats. The 3D OpenGL image is rotatable and scalable using the mouse, and the current rotation matrix can be output for the user to cut-and-paste into the MolScript input file. This considerably simplifies the process of defining a good view of a molecule, previously a cumbersome iterative process.

When an error in the input file is encountered, the OpenGL output mode does not abort the program. Instead, the graphics objects created so far in the script are rendered, so that the user can correct the input file, and re-read it within the same running MolScript process. This speeds up debugging of input scripts, and also makes it easy to test different modifications to the graphics state parameters.

VRML 2.0

The VRML 2.0 output mode is entirely new. VRML 2.0 is a standard for distribution of 3D objects on the Web. It is a very good option for publishing protein 3D structural data in carefully crafted models with accompanying annotation. In the current version, there is support for all graphical objects, and for making anchors (Web links) from the graphical objects.

The VRML 2.0 specification supports dynamic behaviour, and features based on this may be included in future versions of MolScript. Currently, investigations are being made to test support for dynamic behaviour in the models, such as molecular dynamics, illustrations of enzymatic reactions, or depiction of changes in quaternary structure.

Image files

It is now possible to create image files in the JPEG, PNG, Encapsulated PostScript (EPS) and SGI (aka RGB) formats directly from an input file. It is no longer necessary to use screen-capture programs or similar software to make JPEG files or other image files for use in Web sites.


The Raster3D implementation has three major new features:


The MolAuto program is a stand-alone program which reads a coordinate file, and produces a MolScript input file based on what is found there. Features such as secondary structure and ligands are identified and commands to render these are output.

The MolAuto program considerably simplifies the process of creating new MolScript images. The behaviour of MolAuto can be controlled to some degree by command-line options.

External objects interface

An interface to graphics objects created by external programs has been added to MolScript. The object command reads an object file containing the specification of the objects. The format of the object file is straightforward, and allows points, lines, triangles and triangle strips to be specified. This can be used for e.g. molecular surfaces or electron density representations generated by other software.

The appearance of the objects is determined by the same parameters as the ordinary graphical objects in MolScript. It is also possible to specify explicit colours in the object file. The object coordinates may be transformed by the view matrix specified by the most recent transform command.

Graphics commands

Graphics state parameters

Command-line options

Relaxed command syntax

Reimplementation in C

The MolScript program has been completely rewritten in the C programming language. The MolScript C source code is strict ANSI C, and should therefore compile with any ANSI-C compliant compiler. The previous versions (1.4 and older) were written in Fortran 77.

No static memory limits

There were many static limits on the size of molecules and the complexity of graphical objects that could be handled in MolScript v1.4. The cause of these limits was the lack of a dynamic-memory mechanism in standard Fortran 77. The values of the limits could be changed only by modifying the source code and recompiling the program.

In version 2, there are no such limits; all memory usage is dynamic, and the size of the application is now limited only by the physical or virtual memory of your computer. This means that there will be no need to recompile the program when the applications increase in size and complexity.

Increased computational efficiency

The reimplementation has resulted in a considerably more efficient program. Tests on an SGI machine indicate that execution of equivalent input scripts are often more than 50 % faster with version 2 compared with v1.4.

The memory footprint of the new version 2 is almost always much smaller than in v1.4, since memory is dynamically allocated only when it is actually needed by the program. In v1.4, memory allocation had to be statically determined at compile time, and therefore set to the maximum expected application size. This could pose a problem on certain computer systems.

Organisation of the source code

The source code for version 2 has been organised to facilitate implementation of new output formats. The set of routines that need to be written for a new output format are well-defined. The routines that create the graphics objects have been made independent of the output routines.

Top page