# XYZ file format

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/XYZ_file_format
> Markdown URL: https://mediated.wiki/source/XYZ_file_format.md
> Source: https://en.wikipedia.org/wiki/XYZ_file_format
> Source revision: 1314087328
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

The **XYZ file format** is a [chemical file format](/source/Chemical_file_format). There is no formal standard and several variations exist, but a typical XYZ format specifies the [molecule geometry](/source/Molecule_geometry) by giving the number of [atoms](/source/Atoms) with [Cartesian coordinates](/source/Cartesian_coordinates) that will be read on the first line, a comment on the second, and the lines of atomic coordinates in the following lines.[1] The file format is used in [computational chemistry](/source/Computational_chemistry) programs for importing and exporting geometries. The units are generally in [ångströms](/source/%C3%85ngstr%C3%B6m). Some variations include using atomic numbers instead of atomic symbols, or skipping the comment line. Files using the XYZ format conventionally have the .xyz extension.

## Format

The formatting of the .xyz file format is as follows:

<number of atoms> comment line <element> <X> <Y> <Z> ...

[Connectivity information](/source/Connectivity_information) in the XYZ file format is implied rather than explicit. According to the main page for XYZ (part of XMol),

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.[2]

### Example

The [pyridine](/source/Pyridine) molecule can be described in the XYZ format by the following:

11

C       -0.180226841      0.360945118     -1.120304970
C       -0.180226841      1.559292118     -0.407860970
C       -0.180226841      1.503191118      0.986935030
N       -0.180226841      0.360945118      1.29018350
C       -0.180226841     -0.781300882      0.986935030
C       -0.180226841     -0.837401882     -0.407860970
H       -0.180226841      0.360945118     -2.206546970
H       -0.180226841      2.517950118     -0.917077970
H       -0.180226841      2.421289118      1.572099030
H       -0.180226841     -1.699398882      1.572099030
H       -0.180226841     -1.796059882     -0.917077970

## Animation

Most molecule viewers such as [Jmol](/source/Jmol) and [VMD](/source/Visual_Molecular_Dynamics) can show animations using .xyz files. The following is an example xyz format for m successive snapshot which can be rendered as an animation:

<number of atoms> comment line atom_symbol11 x-coord11 y-coord11 z-coord11 atom_symbol12 x-coord12 y-coord12 z-coord12 ... atom_symbol1n x-coord1n y-coord1n z-coord1n <number of atoms> comment line atom_symbol21 x-coord21 y-coord21 z-coord21 atom_symbol22 x-coord22 y-coord22 z-coord22 ... atom_symbol2n x-coord2n y-coord2n z-coord2n . . . <number of atoms> comment line atom_symbolm1 x-coordm1 y-coordm1 z-coordm1 atom_symbolm2 x-coordm2 y-coordm2 z-coordm2 ... atom_symbolmn x-coordmn y-coordmn z-coordmn

Note that the xyz standard does not require that the number or chemical nature of atoms should be the same at subsequent snapshots, which allows for atoms disappearing from or coming into the field of view during the animation.

## Further reading

- [Extended XYZ format](https://web.archive.org/web/20190811094343/https://libatoms.github.io/QUIP/io.html#extendedxyz)

- [Extended XYZ file format](https://www.ovito.org/docs/current/reference/file_formats/input/xyz.html#extended-xyz-format)

## References

1. ["The XYZ file specification"](https://web.archive.org/web/20110915031151/http://openbabel.org/wiki/XYZ_(format)). *OpenBabel*. Archived from [the original](http://openbabel.org/wiki/XYZ_%28format%29) on 2011-09-15. Retrieved 2011-08-24.

1. ["XYZ man page (part of XMol)"](http://www.ccl.net/chemistry/resources/messages/1996/10/21.005-dir/index.html). Retrieved 22 September 2015.

---
Adapted from the Wikipedia article [XYZ file format](https://en.wikipedia.org/wiki/XYZ_file_format) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/XYZ_file_format?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
