JMol

Wrapper for the chemical structure viewer based on JMol.

Simple demo application available here.

Summary
JMolWrapper for the chemical structure viewer based on JMol.
Functions
jmolConvert DIV panel into JMol / JSmol viewer.
Types
Options
Functions
setCSID
setSMILES
reloadReloads jmol/jsmol based on currently set options
setMOLShow molecule with this mol.
setMoleculeDisplayTypesets the display type of molecule in JMol
setZoomScalingSets the zoom scale
setSpinRatesSet the X, Y coordinate spins based on specified frames/second value
setOptionsSet new options to update the widget’s view
toggleSpinIf JSMol spin is on then it sets it to off, and vice-versa

Functions

jmol

Convert DIV panel into JMol / JSmol viewer.

Parameters

optionsInitialization Options
$('#jmolView').jmol ({
        width: 300,
        height: 300,
        csid: 236,
        modality: 'JAVA',
        spin: true,
        spinRateX: 10,
        spinRateY: 14,
        spinFPS: 20,
        zoomScaling: 1.5,
        vibration: false,
        useSignedApplet: true
});

Types

Options

Properties

widthWidth of the widget in pixels.  Default value - 300
heightHeight of the widget in pixels.  Default value - 300
csidChemSpider ID to be displayed
smilesSMILES string of the molecule that should be displayed
molstring containing contents of mol connection file of the molecule to be displayed (with each new line delimited by \n) e.g. mol:”” +”\n” +”\n” +”\n 2 1 0 0000 0 0 0 0 0999 V2000” +”\n 2.4000 -0.4625 0.0000 C 0 0 0 0 0 0 0 0 0 0 0” +”\n 3.7167 -0.4667 0.0000 C 0 0 0 0 0 0 0 0 0 0 0” +”\n 2 1 2 0” +”\nM END” +”\n” +”\n$$$$\n”
modalitydetermines the various options to be tried (applet and surrogates) and the order in which to try them.  Note that Jmol-JSO cannot detect if the user has intentionally disabled Java in some browsers.
spinset to true to make molecule spin when displayed, or false if not
spinRateXset spin Rate of molecule in JSmol in x direction (if spin is set to true)
spinRateYset spin Rate of molecule in JSmol in y direction (if spin is set to true)
spinFPSset spin frames per second of molecule in JSmol (if spin is set to true)
moleculeStyledisplay style used for molecular representation.  One of: ‘WIREFRAME|SPACEFILL|BALLSTICK
zoomScalingset zoom scaling factor of JSmol
vibrationwhether structure animation should vibrate
useSignedAppletWhen set to true, you can put applet files, model files and page files wherever you want to and run them from local disk.  It also allows to load local files into Jmol faster than from elsewhere.

Functions

setCSID

setCSID: function (csid)
Show molecule with this ChemSpider IDretrieves mol from ChemSpider webservice.

Parameters

csidChemSpider ID
jmol.setCSID(10368587);

setSMILES

setSMILES: function (smiles)
Show molecule that has this smilesconverts smiles to mol using ChemSpider webservice.

Parameters

smilesSMILES string
jmol.setSMILES('CC(=O)Oc1ccccc1C(=O)O');

reload

reload: function ()

Reloads jmol/jsmol based on currently set options

jmol.reload();

setMOL

setMOL: function (mol)

Show molecule with this mol.

Parameters

molcontents of mol connection file defining structure
jmol.setMOL(""
                +"\n"
                +"\n"
                +"\n  2  1  0  0000  0  0  0  0  0999 V2000"
                +"\n    2.4000   -0.4625    0.0000 C   0  0  0  0  0  0  0  0  0  0  0"
                +"\n    3.7167   -0.4667    0.0000 C   0  0  0  0  0  0  0  0  0  0  0"
                +"\n  2  1  2  0"
                +"\nM  END"
                +"\n"
                +"\n$$$$\n");

setMoleculeDisplayType

setMoleculeDisplayType: function (displayType)

sets the display type of molecule in JMol

Parameters

displayTpeWIREFRAME|SPACEFILL|BALLSTICK
jmol.setMoleculeDisplayType('WIREFRAME');

setZoomScaling

setZoomScaling: function (zoomScaling)

Sets the zoom scale

Parameters

zoomScalingthe zoom scaling factor for molecule
jmol.setZoomScaling(1.5);

setSpinRates

setSpinRates: function (spinRateX,
spinRateY,
spinFPS)

Set the X, Y coordinate spins based on specified frames/second value

Parameters

spinRateXspin Rate of molecule in x direction
spinRateYspin Rate of molecule in y direction
spinFPSspin frames per second of molecule
jmol.setSpinRates(10, 10, 25);

setOptions

setOptions: function (options)

Set new options to update the widget’s view

jmol.setOptions({
    bondWidth: 2,
    spinRateX: 0.1,
    spinRateY: 0.1
});

toggleSpin

toggleSpin: function ()

If JSMol spin is on then it sets it to off, and vice-versa

jmol.toggleSpin();
setCSID: function (csid)
setSMILES: function (smiles)
reload: function ()
Reloads jmol/jsmol based on currently set options
setMOL: function (mol)
Show molecule with this mol.
setMoleculeDisplayType: function (displayType)
sets the display type of molecule in JMol
setZoomScaling: function (zoomScaling)
Sets the zoom scale
setSpinRates: function (spinRateX,
spinRateY,
spinFPS)
Set the X, Y coordinate spins based on specified frames/second value
setOptions: function (options)
Set new options to update the widget’s view
toggleSpin: function ()
If JSMol spin is on then it sets it to off, and vice-versa