MediaWiki/ExtensionV4

From Jmol
Revision as of 16:28, 16 August 2017 by AngelHerraez (talk | contribs) (documenting version 4 of the Extension)
Jump to navigation Jump to search
Running Jmol / JSmol

Jmol MediaWiki Extension (version 4)

Jmol MediaWiki Extension

Please check the version you have installed in your wiki (browse to Special pages, then Version). Documentation for former versions of the Extension may be found in MediaWiki/ExtensionV3.


There are 3 ways to use Jmol / JSmol models in a wiki that implements this extension:

  1. Simple calls: Inserting a link that will open a Jmol model in a popup window, with no custom rendering, no scripting.
  2. Popup calls: Inserting a link or a button that will open a Jmol model in a popup window, allowing scripts and custom rendering.
  3. In-page models: Inserting a Jmol object within the page content, allowing scripts and custom rendering. Alternatively, inserting controls that will act on the Jmol object (links, buttons, radio buttons, menus... that will apply scripts to the model).


Simple calls

These tags in a MediaWiki page generate a hyperlink that will open a new window (pop-up) filled with a Jmol object (by default the JSmol HTML5 modality). The Jmol object will fit the window, which is resizable. No custom rendering styles or scripting can be applied to the model.

The model data may come from one of 3 sources:

  1. a file that has been previously uploaded to the wiki;
  2. a file retrieved from the RCSB PDB database server (macromolecules);
  3. a file retrieved from the CACTUS NIH server.

All 3 tags need to include the file name/ID of the model and optionally they may include a text parameter that will be used as the visible text making the link.

Tag <jmolFile>

This tag produces a link that opens a popup Jmol object and loads the model from a file that has been previously uploaded to the wiki. The model is displayed in the default rendering (ball and stick, CPK color, white background).

The file must be uploaded to the wiki as if it were an image, using the "Upload file" link in the "Toolbox" panel on the left. Its location is hence [[File:MyMolecule.mol]], but only the name, MyMolecule.mol, must be inserted inside the <jmolFile> tag.

Examples:

<jmolFile>Chair.cml</jmolFile>

is rendered as Chair.cml which, when clicked, will open a Jmol object with the model read from File:Chair.cml.

<jmolFile text="Show ethanol">Ethanol.xyz</jmolFile>

is rendered as Show ethanol which, when clicked, will open a Jmol object with the model read from File:Ethanol.xyz.

Tag <jmolPdb>

This tag produces a link that opens a Jmol object and loads the model from the RCSB PDB database server. The model is displayed in the default rendering (ball and stick, CPK color, white background).

Only the 4-character ID of the molecule in the PDB must be inserted inside the <jmolPdb> tag.

Examples:

<jmolPdb>2CDS</jmolPdb>

is rendered as 2CDS which, when clicked, will open a Jmol object with the model retrieved from the PDB server.

<jmolPdb text="structure of lysozyme">2CDS</jmolPdb>

is rendered as structure of lysozyme which, when clicked, will open a Jmol object with the model read from the PDB server.

Tag <jmolSmiles>

This tag produces a link that opens a Jmol object and loads the model from the CACTUS NIH server, constructed from a SMILES string, CAS number, InChI key or chemical name. The model is displayed in the default rendering (ball and stick, CPK color, white background).

The name or key of the molecule must be inserted inside the <jmolSmiles> tag.

Examples:

<jmolSmiles>CCCNC</jmolSmiles>

is rendered as CCCNC which, when clicked, will open a Jmol object with the propylmethylamine structure (of which CCCNC is the SMILES string) retrieved from the CACTUS server.

<jmolSmiles text="something for your headache">aspirin</jmolSmiles>

is rendered as something for your headache which, when clicked, will open a Jmol object with the structure of aspirin read from the CACTUS server.

Popup calls

Contributors

AngelHerraez