CML

Codename: cml

Contents

CML format

Marvin is capable of importing and exporting files in the Chemical Markup Language. Special atom types are lost during export.

Import. The following CML2 standard tags are recognized:

  • <cml>
    Children:

  • <molecule>
    Attributes:

    • title

    Children:

    • <propertyList>

      • <property dictRef="name" title="name"> - A property.

        • <scalar [dataType="dataType"]> value</scalar> - Supported data types: "string" (default), "boolean", "integer", "double", "ENTITY" (for special property classes).

        • <array dataType="dataType" [delimiter="delimiter"]>list of values</array> - Currently, only the "integer" data type is supported. The default delimiter is the space character.

    • <property>

    • <atomArray>
      Attributes:

      • atomID, elementType, x2, y2, x3, y3, z3, formalCharge, hydrogenCount, isotope

      Children:

      • <atom>
        Attributes:

        • id, elementType, x2, y2, x3, y3, z3, formalCharge, hydrogenCount, isotope

    • <bondArray>
      Attributes:

      • atomRefs1, atomRefs2, order

      Children:

      • <bond atomRefs2="a1 a2" order="order" >
        The atom references a1 and a2 must be valid atom ids. The order value can be "1", "S" (single), "2", "D" (double), "3", "T" (triple) or "A" (aromatic).
        Children:

        • <bondStereo>value</bondStereo>
          - Value can be "W" (wedge - up), "H" (hatch - down), "C" (cis) or "T" (trans)

        • <bondStereo convention="convention" conventionValue="value" />

          convention

          conventionValue

          meaning

          MDL

          1

          up

          MDL

          6

          down

          MDL

          4

          either

          MDL

          3

          cis or trans

          ChemAxon

          CTUnspec

          cis/trans or unspecified

        A <bond> tag is recognized at import even if the bondArray container is not present.

  • <reaction>
    Attributes:

    • title

    Children:

    • <reactantList>

      • <molecule>

    • <productList>

      • <molecule>

    • <propertyList> - Reaction properties

Export options

The argument of MolConverter, MolExporter and the getMol/getM functions (of the applets and beans) is the format string. The format specification ("cml") is followed by ":" and the selected option(s) for cml export.

cml:...

Basic options for aromatization and H atom adding/removal.

cml:A      

Atom attributes are stored in arrays. For 2D molecules, only the x, y coordinates are stored. This is a more compact form of storage than the default (using <atom> tags).

cml:P

Create human readable output: put new xml elements in new lines and indent for embedded elements.

cml:D

This option is important if the molecule has parity information and has 0 dimension. By default during the export, a clean method is invoked on the structure and the generated coordinates and wedge information are exported into CML format but NOT the parity information. However, using this option coordinates and wedge information are not generated but parity information is exported.

Example of CML file exported without options:

<?xml version="1.0"?><cml xmlns="http://www.xml-cml.org/schema" xmlns:convention="http://www.xml-cml.org/convention" convention="convention:molecular" xmlns:marvin="http://www.chemaxon.com/marvin/marvinDictRef">
<molecule title="Ethane" id="m1"><atomArray><atom id="a1" elementType="C" x2="0.0" y2="0.0"></atom><atom id="a2" elementType="C" x2="0.0" y2="1.54"></atom></atomArray><bondArray><bond atomRefs2="a1 a2" order="1"></bond></bondArray></molecule>
</cml>

Example of CML file exported with option "A":

<?xml version="1.0"?><cml xmlns="http://www.xml-cml.org/schema" xmlns:convention="http://www.xml-cml.org/convention" convention="convention:molecular" xmlns:marvin="http://www.chemaxon.com/marvin/marvinDictRef">
<molecule title="Ethane" id="m1"><atomArray atomID="a1 a2" elementType="C C" x2="0.0 0.0" y2="0.0 1.54"></atomArray><bondArray><bond atomRefs2="a1 a2" order="1"></bond></bondArray></molecule>
</cml>

Example of CML file exported with option "P":

<?xml version="1.0"?>
<cml xmlns="http://www.xml-cml.org/schema" xmlns:convention="http://www.xml-cml.org/convention" convention="convention:molecular" xmlns:marvin="http://www.chemaxon.com/marvin/marvinDictRef">
<molecule title="Ethane" id="m1">
  <atomArray>
    <atom id="a1" elementType="C" x2="0.0" y2="0.0"/>
    <atom id="a2" elementType="C" x2="0.0" y2="1.54"/>
  </atomArray>
  <bondArray>
    <bond atomRefs2="a1 a2" order="1"/>
  </bondArray>
</molecule>
</cml>

Example of CML file exported with options "AP":

<?xml version="1.0"?>
<cml xmlns="http://www.xml-cml.org/schema" xmlns:convention="http://www.xml-cml.org/convention" convention="convention:molecular" xmlns:marvin="http://www.chemaxon.com/marvin/marvinDictRef">
<molecule title="Ethane" id="m1">
  <atomArray atomID="a1 a2" elementType="C C" x2="0.0 0.0" y2="0.0 1.54"/>
  <bondArray>
    <bond atomRefs2="a1 a2" order="1"/>
  </bondArray>
</molecule>
</cml>

CML in other programs:

  • JChemPaint (last version tested: 1.9.8) and Marvin imports each other's CML files.

  • Jmol 8 imports CML files exported by Marvin that contain 3D structures. Jmol is a 3D viewer that does not import bonds but calculates them from atomic distances. This means that bonds are not imported correctly if the molecule is 2D.

References

Do you have a question? Would you like to learn more? Please browse among the related topics on our support forum or search the website. If you want to suggest modifications or improvements to our documentation email our support directly!