JSmol
Categories
Component ID
2757745
Component name
JSmol
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Component created
Component changed
Component body
Synopsis
The JSmol project creates two render elements that module developers can use to embed Jmol objects into their Drupal site.
Requirements
You will need to download Jmol from http://jmol.sourceforge.net/. The README file in the lib directory describes what files are needed.
Roadmap
The module currently includes:
- Full JSmol Element
- Lite JSmol Element
Future plans include:
- Field Formatter for uploaded pdb files
- Field Formatter for SMILES text strings
Basic Usage
A module designer would create the array of JSmol configuration parameters as defined in the Jmol Documentation. The object is then rendered. For example:
$Info = [
'width' => 400,
'height' => 400,
'debug' => FALSE,
'color' => "0xC0C0C0",
'disableJ2SLoadMonitor' => TRUE,
'disableInitialConsole' => TRUE,
'addSelectionOptions' => TRUE,
'serverURL' => "http://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
'use' => "HTML5",
'readyFunction' => null,
'script' => 'load $caffeine'
];
$output[] = [
'#type' => 'jsmol',
'#info' => $Info,
];
The project also contains an example module, called jsmol_examples. This module contains several Drupal controllers, templates, and javascript files to recreate, in Drupal, the examples which are provided with the jsmol library.
