How to open .CML files on Linux
To open .CML files on Linux, open the .cml file in Avogadro to view the chemical structure and related data.
Step-by-step instructions
- Open the .cml file in Avogadro to view the chemical structure and related data.
- Use Open Babel to read the file or convert it to another chemistry format if needed.
- For quick inspection, open it in a text editor and verify it is valid-looking XML.
Recommended software
- VS Code
- Notepad++/TextEdit
- jq (CLI)
Alternative methods
- Open .CML in a browser-based viewer if desktop apps fail.
- Try opening .CML on Linux with a secondary app to rule out app-specific issues.
- Convert .CML only with trusted tools when direct opening is not possible.
Common issues
The .CML file opens as plain text instead of a molecule/structure
CML is XML, so general-purpose editors will show tags and values rather than a chemical diagram.
- Open the file in a chemistry application that supports CML (for example, Avogadro) to render the structure.
- If your goal is conversion, use Open Babel to convert the .cml into another chemical format your target tool supports.
The file won’t open or imports with missing/incorrect data
CML has schemas and multiple conventions; some software only supports parts of CML or expects certain elements/versions.
- Try opening the file in an alternative tool (e.g., Avogadro vs. Open Babel) to compare results.
- If you can, validate or check the file against the published CML schema documentation to spot structural issues or unsupported constructs.
- Open the file in a text editor to check whether it appears truncated (incomplete XML) or malformed (unclosed tags).
Wrong file type: the .cml extension is used but the content is not CML (XML)
Some files may be mislabeled; a genuine CML file should look like XML and typically contains CML-related tags.
- Open the file in a text editor and confirm it is XML-based and resembles CML (not binary or unrelated text).
- If it is not XML/CML, ask the sender for the correct format or export option rather than renaming extensions.
Conversion results look different (coordinates, bonding, or metadata changes)
Interchange formats may represent structures and metadata differently, and conversions can drop or reinterpret fields depending on tool support.
- Convert using Open Babel and test a couple of target formats to see which preserves what you need.
- After converting, re-open both the original and converted file in a viewer (e.g., Avogadro) and compare key properties (atoms, bonds, coordinates, identifiers).
Security note
A .cml file is XML, not an executable; the main risk is from malformed or intentionally crafted XML that could exploit weaknesses in a parser, so open untrusted CML only in well-maintained chemistry tools.