Blog

Signals Blog

Interactive, Browser-Based 3D Molecule Visualizations with GLmol and WebGL

Although many tools for 3D visualization of small molecules and biopolymers have been released as desktop applications, relatively few programs are available for use in Web applications. GLmol is one such tool that takes advantage of fast in-browser 3D graphics capabilities now available through WebGL. This article introduces GLmol by discussing its main features, and provides fully-functional examples of deployment and scripting.

Application Demo

The GLmol download package contains a sample page illustrating the most important features:

Deployment Demo: Embedding a Protein Structure

GLmol can read PDB files loaded via asynchronous HTTP calls. This use is illustrated in the protein embedding demo:

Note that same origin policies may prevent direct loading of files from sources other than the original host in some situations.

Scripting Demo: Spinning Molecule

GLmol is written entirely in JavaScript. As such, the software lends itself to a variety of interesting scripting techniques by default. The spinning molecule demo shows how to combine GLmol with the requestAnimationFrame API to animate a scene:

WebGL Support

WebGL is now supported on all modern browsers except Internet Explorer. Microsoft has so far not publicly indicated whether WebGL would be supported in IE 11.

Other Software

Other pure JavaScript 3D molecule display components have been described. One of the authors of Jmol has developed a Java- and WebGL-free version of the software called JSmol. Jolicule is a JavaScript application for 3D molecular visualization that also requires no WebGL. iChemLabs offers a set of 3D Structure Canvases based on WebGL.

Those wanting a more detailed look at how to use WebGL in the context of a molecule display element may find a recent tutorial helpful.

Conclusions

GLmol offers many possibilities for both interactive and scripted 3D molecule visualizations. Avoiding the Java Plugin and its accompanying complications, GLmol offers an attractive alternative to the popular Jmol applet. GLmol's liberal open source license (MIT or GPL3) makes it an appealing starting point for further development.