File formats

From Jmol
Revision as of 14:47, 5 June 2007 by Anonymous (talk)
Jump to navigation Jump to search

(An attempt to compile information on file format specifications. It's not complete yet.)

Jmol example/test data files in all formats accepted.

Chemical file formats on Wikipedia.

File formats on Open Babel.


Coordinates of molecule

(MDL) MOL and SD

Jmol reads MOL and SD files (and can write MOL files under some circumstances). Original from Elsevier MDL. Contains atom coordinates and bonds. Limited to 1000 atoms.

Official document: http://www.mdl.com/downloads/public/ctfile/ctfile.pdf, copied here.

Example files.


(Sybyl) MOL2

Jmol reads MOL2 files. Original from Tripos. Contains atom coordinates, bonds, partial charge, substructure information.

Official document: http://www.tripos.com/data/support/mol2.pdf


PDB

Jmol reads PDB files. Contains atom coordinates and information on biomolecular residues, sequence, chains, hydrogen and disulfide bonds, secondary structure, biologically relevant sites, cofactors. Can also contain temperature factor, formal charge, element symbol, alternate locations.

(Official Protein Data Bank document) Atomic Coordinate Entry Format. Description: http://www.wwpdb.org/documentation/format23/v2.3.html

Example files.

XYZ

Jmol reads XYZ files. Originally from XMol package, but has been widely adopted by many other programs. Contains only atom coordinates.

Example by Paul Bourke.

Example files.


CIF

Jmol reads CIF files. Crystallographic Information File, the official format from the International Union of Crystallography. Original documentation, Acta Cryst. (1991). A47, 655-685, and 2003 update.


mmCIF

Jmol reads mmCIF files. Macromolecular Crystallographic Information File, an expanded format to cope with macromolecules. Official documentation.


Gaussian

Jmol reads only the output format. There are example files of Gaussian input, output and log.


(Gaussian) Cube

Jmol reads Cube files, original from Gaussian software (Gaussian website).

Description of Cube Input and Cube Output formats: http://www.nersc.gov/nusers/resources/software/apps/chemistry/gaussian/g98/00000430.htm

Description by Paul Bourke.

Example files.


(Hyperchem) HIV

Jmol reads HIV files, the native format of Hyperchem, a software sold by Hypercube Inc..

Example by Paul Bourke, and other example files.


(Tripos) Alchemy

Jmol reads Alchemy and Alchemy2000 files. Alchemy example and Alchemy2000 description by Paul Bourke.


GAMESS

Jmol reads GAMESS files (General Atomic and Molecular Electronic Structure System, by Gordon research group at Iowa State University).

Official documentation.


MOPAC

Jmol reads mopout output files from MOPAC and the new graphf output from MOPAC2007 (.mgf files), which contains coordinates, charges, and molecular orbitals.

openMOPAC, Molecular Orbital PACkage, public domain.

Images

Saving images from Jmol application

Images (snapshots) of Jmol's viewport, including the model in the current rendering, can be saved by using the application's top menu bar: File > Export > Export Image or Script and in the Image Type drop-down list, choose among JPEG, PNG or PPM formats, write a filename and click on Save.

Information on these image formats on Wikipedia.

Saving images from Jmol applet

Note: This only works for certain browsers, so it is not a general solution for the general user. In particular, it does not work in MSIE. In Firefox, it may fail for large applet sizes.

The command from the console or via JavaScript is getProperty image.

The result is a base-64 encoded JPEG image that looks like this:

/9j/4AAQSkZJRgABAAAAAQABAAD//gBBSl...

Pop that into an <img> tag using Firefox or Opera (not MSIE), and you have an image that you can copy into your clipboard and do anything you would do with a JPG. The JavaScript required to create the tag looks like this:

var myImage = jmolGetPropertyAsString("image")
document.getElementById("someDiv").innerHTML =
  '<img src="data:image/jpeg;base64,'   myImage   '">'

This is implemented in Bob Hanson's examples page. (Just under the applet, click on the word "image".)

Surfaces

Jmol Voxel (JVXL)

Jmol reads and writes JVXL files.

This format is unique to Jmol, stores isosurface data.

Documented at http://www.stolaf.edu/academics/chemapps/jmol/docs/misc/JVXL-format.pdf


Pmesh

Jmol reads pmesh files for rendering pmesh surfaces, using not the load command, but the pmesh command. Description.

Example files _1_ and _2_.


(Gaussian) Cube

See above.


Open DX

Jmol (11.1.18 or later) reads DX files for rendering isosurfaces and color mapping. DX contains three-dimensional scalar data; most frequently, isosurface and color by molecular electrostatic potential (MEP).

(Not to be confused with JCAMP-DX format, used for spectral vibrational data, which can be shown using JSpecView Applet and MDL Chime.)

Open DX files are produced, among others, by APBS (Adaptive Poisson-Boltzmann Solver). APBS exists in standalone and web-server-based versions, and as a plug-in for PyMOL.

Technical:

DX, as Cube, defines a three-dimensional grid of points in space. At each point is a number (a "scalar value"). This set of point values is then used by Jmol to define an "isosurface" -- the surface separating points having values greater than a given cutoff from those that have a value less than a certain cutoff. A typical application is molecular orbitals. The phase parameter of the isosurface command allows bicolor rendering: one color for "points greater than x" and another color for "points less than -x".
Jmol can read DX files and re-export them to much smaller JVXL files.

Generally a MEP data set is not used for the isosurface itself. Rather, it is used to map color onto another isosurface, usually some representation of the "molecular surface".

Bottom line is that we can now take molecular electrostatic potential data that were generated in PyMOL (requires the APBS plugin for PyMOL) and use them to color a surface generated in Jmol.

Documentation:

Scripting

Script input

Jmol reads script files, using not the load command, but the script command. These are plain-text files containing commands in the Jmol scripting language (in part common with Rasmol and Chime), that will modify the way the molecular model is shown. The file can have any extension.

For details on the scripting language, visit the Interactive Scripting Documentation.

Script output

Jmol application (not the applet) can write a script file that will restore the current appearance and state of the model. This functionality is still under improvement.

Use the application's top menu bar: File > Export > Export Image or Script and in the Image Type drop-down list, choose SPT, write a filename and click on Save.


Inline formats

Molecular data are usually contained in an external file and loaded into Jmol using the load command, but they can also be contained within the webpage (or fed into it using JavaScript or PHP, e.g. from a database).

In turn, script commands can also be contained in the molecular file.

To allow for this "inline" formats, several methods are implemented:

[Please, note that these are advanced procedures. For normal needs, they can be avoided in favour of using normal scripting practices.]

Molecular coordinates inline within a webpage

Can be done using direct instructions for the applet or, more easily, using functions in the Jmol.js library: jmolAppletInline, jmolLoadInline, jmolLoadInlineScript.

Molecular coordinates inline within a script or script file

Can be done using the data "model" command (Jmol 11 only).

Script inline within a molecular coordinates file

Scripts can be included after a #jmolscript: tag (case-sensitive). This must be taken as a comment by the molecular file parser, so its location depends on the file format:

  • In a PDB file, use REMARK #jmolscript: in any line, followed by the script commands in the same line.
  • In a MOL file, use #jmolscript: in the third line, followed by the script commands in the same line. Note, however, that # cannot be the first character on that line, so use an initial space if nothing else.
  • In an XYZ file, use #jmolscript: in the second line, followed by the script commands in the same line.

In all cases, the script will be applied after the whole molecule has loaded.