XYZ (.xyz)

  • Import and Export fully support the XYZ format.
  • Background

      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 and Export

    • Import[""] reads an XYZ molecule model and gives a visual representation of it.
    • Export["",expr] exports elements of a molecule model to an XYZ file.
    • Import[""] returns a Graphics3D object.
    • Import["",elem] imports the specified element from an XYZ file.
    • Import["",{elem,suba,subb,}] imports a subelement.
    • Import["",{{elem1,elem2,}}] imports multiple elements.
    • The import format can be specified with Import["file","XYZ"] or Import["file",{"XYZ",elem,}].
    • Export["",expr,elem] creates an XYZ file by treating expr as specifying element elem.
    • Export["",{expr1,expr2,},{{elem1,elem2,}}] treats each expri as specifying the corresponding elemi.
    • Export["",expr,opt1->val1, ] exports expr with the specified option elements taken to have the specified values.
    • Export["",{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.
    • ImportString and ExportString support the XYZ format.


    • General Import elements:
    • "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
    • "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["",{vert,coord},{{"VertexTypes","VertexCoordinates"}}] creates an XYZ model from a specification of atom types and their 3D coordinates.


    • General Import options:
    • 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, the Wolfram Language 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


    Basic Examples  (1)

    Import an XYZ example file, rendering it as a ball-and-stick model:

    Click for copyable input

    Show the same molecule as space-filling atoms:

    Click for copyable input

    Read the atom types and atom coordinates:

    Click for copyable input

    Export this data to XYZ:

    Click for copyable input

    See Also

    "MOL"  "PDB"  "FASTQ"  "HIN"  "JCAMP-DX"  "SFF"  "FCS"

    Introduced in 2007