Difference between revisions of "File formats"

From Jmol
Jump to navigation Jump to search
m (XYZ)
m
 
(31 intermediate revisions by 2 users not shown)
Line 10: Line 10:
 
Nice description of [http://reference.wolfram.com/mathematica/guide/3DGeometryAndModelingFormats.html 3D Geometry & Modeling Formats] by Wolfram Mathematica.
 
Nice description of [http://reference.wolfram.com/mathematica/guide/3DGeometryAndModelingFormats.html 3D Geometry & Modeling Formats] by Wolfram Mathematica.
  
 
+
See the specific subsections:
= Coordinates of molecule =
+
<div style="width:30ex;">
 
+
{{File_Formats}}
== (MDL) MOL and SD ==
+
</div>
MOL = MDL molfile
+
<div style="clear:both;"></div>
 
 
SD = SDF = Structure Data Format
 
 
 
Jmol reads MOL and SD files (and can write MOL files under some circumstances).
 
Original from Elsevier MDL, now Symyx Technologies.
 
Contains atom coordinates and bonds. Limited to 1000 atoms.
 
 
 
Official document (PDF): http://www.mdl.com/downloads/public/ctfile/ctfile.pdf, copied [{{SVN Trunk}}Jmol-datafiles/mol/ctfile.pdf here].
 
 
 
[{{SVN Trunk}}Jmol-datafiles/mol/ Example files].
 
 
 
Some extra information on SD files at [http://www.epa.gov/ncct/dsstox/MoreonSDF.html US EPA DSSTox].
 
 
 
 
 
== (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
 
 
 
[{{SVN Trunk}}Jmol-datafiles/pdb/ Example files].
 
 
 
== XYZ ==
 
Jmol reads XYZ files. Originally from XMol package, but has been widely adopted by many other programs. Contains only atom coordinates (no bonds) and, optionally, charges and vectors (e.g. for atom vibration). Supports multi-model data (multi-frame, animations).
 
 
 
[http://local.wasp.uwa.edu.au/~pbourke/dataformats/xyz/ Example] by Paul Bourke.
 
 
 
[{{SVN Trunk}}Jmol-datafiles/xyz/ Example files].
 
 
 
Description:
 
:XYZ datafiles specify molecular geometries using a Cartesian coordinate system. This simple, stripped-down, ASCII-readable format is intended to serve as a "transition" format for the XMol series of applications. For example, suppose a molecular datafile was in a format not supported by XMol. In order to read the data into XMol, it would be possible to modify the datafile, perhaps by creating a shell script, so that it fit the relatively lenient requirements of the XYZ format specification. Once data is in XYZ format, it may be examined by XMol, or converted to yet another format.
 
:The XYZ format supports '''multi-step datasets'''. '''Each step''' is represented by a two-line "header," followed by one line for each atom. The '''first line''' of a step's header is the number of atoms in that step. This  integer  may be preceded by whitespace; anything on the line after the integer is ignored.  The '''second line''' of the header leaves room for a descriptive string. This line may be blank, or it may contain some information pertinent to that particular step, but it must exist, and  it must be just one line long. '''Each line of text describing a single atom''' must  contain at least four fields of information, separated by whitespace: the atom's type (a short string of alphanumeric characters), and  its x-, y-, and z-positions. Optionally, extra fields may be used to specify a charge for the atom, and/or a vector associated with the atom. If an input line contains five or eight fields, the fifth field is interpreted as the atom's charge; otherwise, a charge of zero is assumed. If an input line contains seven or eight fields, the last three fields are interpreted as the components of a vector. These components should be specified in angstroms.
 
:Note that the XYZ format doesn't contain '''connectivity''' information. This intentional omission allows for greater flexibility: to create an XYZ file, you don't need to know where a molecule's bonds are; you just need to know where its atoms are. Connectivity information is generated automatically for XYZ files as they are read into XMol-related applications. Briefly, if the distance between two atoms is less than the sum of their covalent radii, they are considered bonded.
 
 
 
:''Source: man page for XYZ (part of XMol), quoted at http://www.ccl.net/chemistry/resources/messages/1996/10/21.005-dir/index.html''
 
 
 
The XYZ reader in Jmol reads any of the following (updated for Jmol v. 11.4.5 and 11.5.41):
 
<pre>
 
Sym  x  y  z
 
Sym  x  y  z    vibX  vibY  vibZ
 
Sym  x  y  z    FormalCharge(integer)
 
Sym  x  y  z    FormalCharge(integer)    vibX  vibY  vibZ
 
Sym  x  y  z    PartialCharge(decimal)
 
Sym  x  y  z    PartialCharge(decimal)    vibX  vibY  vibZ
 
</pre>
 
:where <code>Sym</code> is either an element symbol (C, Fe, Si) or an element symbol preceded by an isotope number (2H, 13C, etc.)
 
 
 
== CIF ==
 
Jmol reads CIF files.
 
Crystallographic Information File, the official format from the International Union of Crystallography. [http://www.iucr.org/iucr-top/cif/standard/cifstd1.html Original documentation], Acta Cryst. (1991). A47, 655-685, and [http://www.iucr.org/iucr-top/cif/spec/version1.1/index.html 2003 update].
 
 
 
 
 
== mmCIF ==
 
Jmol reads mmCIF files.
 
Macromolecular Crystallographic Information File, an expanded format to cope with macromolecules.
 
[http://www.pdb.org/robohelp/ftp/files_formats/structures/chemical_component_format/chemical_component_mmcif_format.htm Official documentation].
 
 
 
 
 
== (Tripos) Alchemy ==
 
Jmol reads Alchemy and Alchemy2000 files.
 
[http://local.wasp.uwa.edu.au/~pbourke/dataformats/alc/alc3/ Alchemy example] and [http://local.wasp.uwa.edu.au/~pbourke/dataformats/alc/ 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).
 
 
 
[http://www.msg.ameslab.gov/GAMESS/doc.menu.html Official documentation].
 
 
 
 
 
== Gaussian ==
 
Jmol reads only the output format.
 
There are
 
[{{SVN Trunk}}Jmol-datafiles/gaussian/ example files]
 
of Gaussian input, output and log.
 
 
 
 
 
== (Gaussian) Cube ==
 
Jmol reads Cube files, original from Gaussian software ([http://www.gaussian.com/ Gaussian website]).
 
 
 
Description of Cube Input and Cube Output formats:
 
http://www.nersc.gov/nusers/resources/software/apps/chemistry/gaussian/g98/00000430.htm
 
 
 
[http://local.wasp.uwa.edu.au/~pbourke/dataformats/cube/ Description] by Paul Bourke.
 
 
 
[{{SVN Trunk}}Jmol-datafiles/cube/ Example files].
 
 
 
 
 
== GROMACS ==
 
''This is not yet read by Jmol, but may be so in the near future.''
 
 
 
File format is called '''gro''' or '''Gromos87'''. Usual extension is <code>.gro</code>
 
 
 
[http://www.gromacs.org/documentation/reference/online/gro.html Description] of the format.
 
 
 
 
 
== (Hyperchem) HIV ==
 
Jmol reads HIV files, the native format of Hyperchem, a software sold by [http://www.hyper.com/ Hypercube Inc.].
 
 
 
[http://local.wasp.uwa.edu.au/~pbourke/dataformats/hyperchem/ Example] by Paul Bourke, and other [{{SVN Trunk}}Jmol-datafiles/hin/ example files].
 
 
 
 
 
== MOPAC ==
 
Jmol reads '''mopout''' output files from [http://openmopac.net/ MOPAC]
 
and the new '''graphf''' output from MOPAC2007 (<code>.mgf</code> files), which
 
contains coordinates, charges, and molecular orbitals.
 
 
 
openMOPAC, Molecular Orbital PACkage, public domain.
 
 
 
 
 
== PQR ==
 
Jmol (11.1.30 or later) reads '''pqr''' files.
 
 
 
PQR format is a format based on <code>[[#PDB|pdb]]</code>, where the ''occupancy'' is replaced with the atomic charge and the ''temperature'' (or ''B factor'') is replaced with atomic radius (however, the column positions in many pqr files do not match those of pdb files). This gives the acronym: '''P''' for pdb, '''Q''' for charge, '''R''' for radius. Jmol interprets the charge values (property ''partialcharge'') and the radii (property ''vanderwaals''), and can hence use them e.g. in <code>color atoms partialCharge</code> and <code>spacefill</code>.
 
 
 
The PQR format has somewhat uncertain origins, but is used by several computational biology packages, including MEAD, AutoDock and [http://apbs.sourceforge.net/ APBS], for which it is the primary input format.
 
 
 
[http://apbs.sourceforge.net/doc/user-guide/index.html#pqr-format PQR format description] within APBS documentation. ''Note that APBS reads PQR loosely, based only on white space delimiters, but Jmol may be more strict about column positions.''
 
 
 
PDB files can be converted to PQR by the [http://pdb2pqr.sourceforge.net/ PDB2PQR] software, which adds missing hydrogen atoms and calculates the charge and radius parameters from a variety of force fields.
 
 
 
= 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:
 
<code>File > Export > Export Image or Script</code>
 
and in the <code>Image Type</code> drop-down list, choose among <code>JPEG</code>, <code>PNG</code> or <code>PPM</code> formats, write a filename and click on <code>Save</code>.
 
 
 
Information on these image formats on [[:en:Graphics_file_format|Wikipedia]].
 
 
 
== Saving images from Jmol applet ==
 
<i>Note:</i> 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
 
<code>getProperty image</code>.
 
 
 
The result is a base-64 encoded JPEG image that looks like this:
 
<pre>/9j/4AAQSkZJRgABAAAAAQABAAD//gBBSl...</pre>
 
 
 
Pop that into an <code><img></code> 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:
 
<pre>var myImage = jmolGetPropertyAsString("image")
 
document.getElementById("someDiv").innerHTML =
 
  '<img src="data:image/jpeg;base64,' + myImage + '">'</pre>
 
This is implemented in
 
[http://www.stolaf.edu/academics/chemapps/jmol/docs/examples-11/new.htm 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 <code>load</code> command, but the <code>pmesh</code> command.
 
[http://www.stolaf.edu/academics/chemapps/jmol/docs/#pmesh Description].
 
 
 
Example files [http://svn.sourceforge.net/viewvc/jmol/trunk/Jmol-datafiles/pmesh/ _1_] and [http://www.stolaf.edu/academics/chemapps/jmol/docs/misc/10x10pmesh.txt _2_].
 
 
 
 
 
== (Gaussian) Cube ==
 
 
 
See [[#(Gaussian)_Cube|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 [http://jspecview.sourceforge.net/ JSpecView Applet] and [http://www.mdlchime.com MDL Chime].)
 
 
 
Open DX files are produced, among others, by [http://apbs.sourceforge.net/ APBS] (Adaptive Poisson-Boltzmann Solver).
 
APBS exists in standalone and web-server-based versions, and as a plug-in for [http://pymol.sourceforge.net/ 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 <code>phase</code> parameter of the <code>isosurface</code> 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:
 
* [http://www.stolaf.edu/academics/chemapps/jmol/docs/misc/JVXL-format.pdf Jmol interpretation of DX files and re-exporting into much smaller JVXL files]
 
* [http://apbs.sourceforge.net/doc/user-guide/index.html#opendx-format DX generation of MEP data by APBS]
 
* [http://www.opendx.org OpenDX specification and software package]
 
 
 
= Scripting =
 
 
 
== Script input ==
 
Jmol reads script files, using not the <code>load</code> command, but the <code>script</code> 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 [http://www.stolaf.edu/academics/chemapps/jmol/docs/ 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:
 
<code>File > Export > Export Image or Script</code>
 
and in the <code>Image Type</code> drop-down list, choose <code>SPT</code>, write a filename and click on <code>Save</code>.
 
 
 
 
 
== Inline formats ==
 
Molecular data are usually contained in an external file and loaded into Jmol using the <code>load</code> 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: <code>[http://jmol.org/jslibrary/#jmolAppletInline jmolAppletInline], [http://jmol.org/jslibrary/#jmolLoadInline jmolLoadInline], [http://jmol.org/jslibrary/#jmolLoadInlineScript jmolLoadInlineScript]</code>.
 
 
 
=== Molecular coordinates inline within a script or script file ===
 
Can be done using the <code>[http://www.stolaf.edu/academics/chemapps/jmol/docs/?ver=11.0#data data "model"]</code> command (Jmol 11 only).
 
 
 
=== Script inline within a molecular coordinates file ===
 
Scripts can be included after a <code>#jmolscript:</code> 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 <code>REMARK #jmolscript:</code> in any line, followed by the script commands in the same line.
 
* In a MOL file, use <code>#jmolscript:</code> in the '''third line''', followed by the script commands in the same line. Note, however, that <code>#</code> cannot be the first character on that line, so use an initial '''space''' if nothing else.
 
* In an XYZ file, use <code>#jmolscript:</code> in the '''second line''', followed by the script commands in the same line.
 
* In a CIF file, use <code>#jmolscript:</code> in any line, followed by the script commands in the same line.
 
 
 
In all cases, the script will be applied after the whole molecule has loaded.
 

Latest revision as of 22:56, 26 January 2020

Jmol + JSmol Documentation

(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.

Nice description of 3D Geometry & Modeling Formats by Wolfram Mathematica.

See the specific subsections: