Copyright (C) 1997-1998 Per J. Kraulis
Copyright (C) 2026 James W. Murray
|
|
|
MolScriptSVG is a fork of MolScript, a program for displaying molecular 3D structures, such as proteins, in both schematic and detailed representations. As far as I can tell, MolScript is still the only program that can produce high quality protein cartoon diagrams in vector format. This fork extends the output modes of the original MolScript and fixes OpenGL support.
This fork also includes SVG, MetaPost, POV-Ray, X3D and WebGL-oriented output
backends. SVG, MetaPost, and POV-Ray are written directly from the MolScript
geometry pipeline and do not require any external library at export
time. X3D output is available as both XML (-x3d) and Classic
encoding (-x3dv). Both Classic and XML X3D are generated natively
inside MolScriptSVG. The -webgl mode writes an HTML viewer that
embeds the native XML X3D scene and displays it in the browser using
the X_ITE WebGL runtime.
Notes on syntax coverage and known grammar/doc mismatches are collected in UNDOCUMENTED_FEATURES.md.
Fork-specific modifications in this repository are copyright James W. Murray. Those modifications were developed with assistance from OpenAI Codex.
The original documentation is at http://pekrau.github.io/MolScript/.
MolScriptSVG is distributed as a fork under the MIT license in this GitHub repository. The original MolScript project is available at MolScript
The first version of MolScript (written in Fortran 77) was released in 1991, and its current version (2.1.2, written in C) in 1998.
This fork keeps the upstream MolScript 2.1.2 language and executable name,
but it is no longer a pristine 1998 code snapshot. The original OpenGL/image
build expected a 1990s GLUT/GLX setup and no longer built cleanly on a modern
Linux system. The code/Makefile.complete file has now been modernized to use
pkg-config for OpenGL, PNG, JPEG and GIF dependencies.
The default build path is now:
cd code
makecode/Makefile delegates to Makefile.complete, so plain make builds the
full MolScriptSVG binary by default.
-
Makefile- Default entry point.
- Produces the full build by including
Makefile.complete.
-
Makefile.complete- Modern Linux-oriented build using
pkg-config. - Enables OpenGL, EGL-backed image rendering, and PNG/JPEG/GIF support by default.
- Modern Linux-oriented build using
-
Makefile.basic- Minimal build with no OpenGL or OpenGL-backed raster image outputs.
- Still includes PostScript, SVG, Raster3D, VRML, X3D and WebGL export code.
To build the minimal version explicitly:
cd code
make -f Makefile.basicTo rebuild the full version explicitly:
cd code
make -f Makefile.complete clean allOn a modern Linux system, the default full build expects pkg-config plus
development packages for:
- OpenGL / GLU / GLUT / X11
- EGL
- libpng
- libjpeg
- libgd
- zlib
If those are present, make should produce:
molscriptmolauto
with support for:
-ps-svg-mp-pov-r3d-wrl-x3d-x3dv-webgl-gl-eps-epsbw-sgi-jpeg-png-gif
The image-output path prefers a headless EGL OpenGL context. That avoids
opening an X11 window and allows -png, -jpeg and -gif rendering without
a working X11 display. If EGL initialization fails, MolScriptSVG falls back to
the hidden GLUT window path for compatibility.
Build:
cd code
makeRun:
./molscript -svg -in examples/ras_std.in -out ras_std.svg
./molscript -mp -in examples/ras_std.in -out ras_std.mp
./molscript -pov -in examples/ras_std.in -out ras_std.pov
./molscript -x3d -in examples/ras_std.in -out ras_std.x3d
./molscript -x3dv -in examples/ras_std.in -out ras_std.x3dv
./molscript -webgl -in examples/ras_std.in -out ras_std.webgl.htmlIf povray is installed, the generated .pov scene files can be rendered to
PNG images with:
./scripts/render-pov-examples.shThe broader example refresh script:
./scripts/regenerate-examples.shwill also render *_pov.png images automatically when povray is available.
The SVG, MetaPost, POV-Ray, X3D and WebGL backends are available in both the basic and complete builds:
./molscript -svg -in examples/ras_std.in -out ras_std.svg
./molscript -mp -in examples/ras_std.in -out ras_std.mp
./molscript -pov -in examples/ras_std.in -out ras_std.pov
./molscript -x3d -in examples/ras_std.in -out ras_std.x3d
./molscript -x3dv -in examples/ras_std.in -out ras_std.x3dv
./molscript -webgl -in examples/ras_std.in -out ras_std.webgl.htmlmolauto has also been extended with a few modern convenience options:
-window n-rotate a11 a12 a13 a21 a22 a23 a31 a32 a33-translate x y z-ss_palette-colourblind-publication
The -colourblind preset uses a fixed high-contrast secondary-structure
palette:
- helices: orange
- strands: blue
- coils: green
- turns: yellow-orange
-x3dv, -x3d and -webgl are all generated natively by MolScriptSVG.
The -webgl output is a self-contained HTML wrapper around the native XML X3D
scene, but it still loads the X_ITE JavaScript runtime from a CDN at view time.
This fork differs from the historical 2.1.2 release in a few important ways:
- Added direct SVG output with
-svg. - Added MetaPost source output with
-mp. - Added POV-Ray scene output with
-pov/-povray. - Added a POV-Ray example render script and rendered
*_pov.pngexample images. - Added X3D output in both XML (
-x3d) and Classic (-x3dv) encodings. - Added HTML WebGL viewer output with
-webgl, backed by the X3D scene exporter. - Modernized the OpenGL build in
code/Makefile.completefor current Linux systems usingpkg-config. - Restored OpenGL-backed PNG, JPEG and GIF image export on modern systems.
- Updated the examples gallery to work from a local filesystem checkout and to include the generated SVG assets.
- XML X3D and WebGL are generated natively, without an external converter.
- MetaPost output can optionally include projected axes and semantic comments.
- POV-Ray output now uses fitted orthographic cameras and softer multi-light scene defaults for rendered examples.
The current tree has been smoke-tested for:
-svg-mp-x3d-x3dv-webgl- OpenGL interactive mode via
-gl - OpenGL-backed
-png,-jpegand-gif
The generated example outputs under examples/ are intended to be part of the
repository for comparison and regression checking.
For a quick smoke test after building:
./scripts/smoke-test.shPer J. Kraulis
MOLSCRIPT: a program to produce both detailed and schematic plots of
protein structures.
J. Appl. Cryst. (1991) 24, 946-950
This paper is now available under Open Access: PDF


