This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
Mathematica Import/Export Format

XYZ (.xyz)

MIME type: chemical/x-xyz
XMOL molecule model files.
Used in cheminformatics applications and on the web for storing and exchanging 3D molecule models.
Plain text tabular format.
Represents a single chemical compound.
Stores atomic coordinates and meta-information.
Does not store chemical bond information.
Developed in 1990 at the Minnesota Supercomputer Center.
  • Import["file.xyz"] reads an XYZ molecule model and gives a visual representation of it.
  • Export["file.xyz", expr] exports elements of a molecule model to an XYZ file.
  • Import["file.xyz", elem] imports the specified element from an XYZ file.
  • Import["file.xyz", {elem, suba, subb, ...}] imports a subelement.
  • Import["file.xyz", {{elem1, elem2, ...}}] imports multiple elements.
  • The import format can be specified with Import["file", "XYZ"] or Import["file", {"XYZ", elem, ...}].
  • Export["file.xyz", expr, elem] creates an XYZ file by treating expr as specifying element elem.
  • Export["file.xyz", {expr1, expr2, ...}, {{elem1, elem2, ...}}] treats each expri as specifying the corresponding elemi.
  • Export["file.xyz", expr, opt1->val1, ...] exports expr with the specified option elements taken to have the specified values.
  • Export["file.xyz", {elem1->expr1, elem2->expr2, ...}, "Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
"Elements"list of elements and options available in this file
"Rules"full list of rules for each element and option
"Options"list of rules for options, properties, and settings
  • Graphics element:
"Graphics3D"XYZ file rendered as a Graphics3D object
  • Import uses the "Graphics3D" element by default for the XYZ format.
  • Data representation elements:
"VertexCoordinates"atomic coordinates, typically given in picometers
"VertexTypes"all atoms or groups constituting the molecule, typically given as a list of chemical element abbreviations
  • Export["file.xyz", {vert, coord}, {{"VertexTypes", "VertexCoordinates"}}] creates an XYZ model from a specification of atom types and their 3D coordinates.
ImageSizeAutomaticspecifies the overall size of the graphics to display
BackgroundWhitespecifies what background color to use
ViewPointAutomaticpoint in space from which the 3D model is to be viewed
  • With the default setting "ViewPoint"->Automatic, Mathematica automatically calculates the optimal viewing angle for the imported molecule model.
  • Selecting a 3D rendering style:
"Rendering""BallAndStick"specifies the visualization method
  • Possible settings for "Rendering" are:
"BallAndStick"displays atoms and bonds as a ball-and-stick model
"Spacefilling"atoms shown as overlapping spheres
"Wireframe"bonds rendered as lines