File formats/Formats/XYZ

From Jmol
Jump to navigation Jump to search

The XYZ file format

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.

Note, however, that if there is any text after the number Jmol will not automatically recognize it as an xyz-formatted file; in that case, you need to explicitly indicate the format in the load command, like this:
load xyz::myFile.xyz
That given, the presence of any text after the number in the 1st line will not affect proper file reading.

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.

Jmol support

The XYZ reader in Jmol reads any of the following, alternative, formats in each atom's line (updated for Jmol v. 11.4.5 and 11.5.41):

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
where Sym is either an element symbol (C, Fe, Si) or an element symbol preceded by a supported isotope number (2H, 13C, etc.)

Sources

Contributors

AngelHerraez