CDXML (.cdxml)

Background & Context

    • MIME type: chemical/x-cdxmlXML version of the ChemDraw Exchange format, CDX.
    • Represents an arbitrary number of chemical compounds.
    • XML format.
    • Stores atomic coordinates, chemical bond information and metadata.

Import & Export

  • Import["file.cdxml"] imports a CDXML file as a molecule.
  • Export["file",mol] exports a molecule to a CDXML file.
  • Two-dimensional coordinates from the CDXML file are stored in the molecule in the AtomDiagramCoordinates option value.
  • Use mol["AtomDiagramCoordinates"] to retrieve the coordinates from the imported molecule mol.
  • See the following reference pages for full general information:
  • Import, Exportimport from or export to a file
    CloudImport, CloudExportimport from or export to a cloud object
    ImportString, ExportStringimport from or export to a string
    ImportByteArray, ExportByteArrayimport from or export to a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements

Options

  • General Export options:
  • IncludeHydrogensAutomaticspecifies whether hydrogen atoms are included in the exported file
  • With the default setting of Automatic, hydrogen atoms bonded to a carbon atom are not shown. Use option values True or False to include or hide all hydrogen atoms.

Examples

open allclose all

Basic Examples  (3)

Import a fluorene derivative from a CDXML file:

Show the molecule in a 2D structure diagram:

Import a model of a symmetric triglyceride from a CDXML file:

Show the molecule in a 2D structure diagram:

Export a molecule to a CDXML file:

Export Options  (1)

IncludeHydrogens  (1)

With the default setting of IncludeHydrogensAutomatic, hydrogen atoms attached to carbon atoms are treated as implicit and not exported to the file. For octanol, only the hydrogen attached directly to the oxygen atom is included explicitly:

To include all atoms in the output file, use IncludeHydrogensTrue:

Be aware that when all atoms are laid out, the structure may not look correct unless all hydrogens are shown when plotted:

Use the PlotTheme option for MoleculePlot to show all atoms: