Skip to content
Skillv1.0.0

structure-conversion

Convert crystal structure files between extxyz and CIF, including splitting multi-frame extxyz into per-frame CIF files.

by AI4MS(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from AI4MS/MatCreator (src/matcreator/skills/structure-conversion/SKILL.md). Install upstream with npx skills add AI4MS/MatCreator --skill structure-conversion. Copyright stays with the author.

Overview

Use the CLI script structure_conversion_tools.py (located alongside this file) to convert structure files between extxyz and cif. It mirrors the behavior of the former ase_structure_convert_tool and is especially useful for turning MatterGen multi-frame extxyz outputs into per-frame cif files.

Every command writes a JSON object to stdout and exits 0 on success or 1 on error. Always parse the JSON output and confirm "status": "success".

python skills/structure_conversion/structure_conversion_tools.py convert <input_file> <output_path> [options]

Supported Conversions

  • cif -> extxyz
  • single-frame extxyz or xyz -> single cif
  • multi-frame extxyz or xyz -> directory of per-frame cif files
  • extxyz or xyz -> extxyz

For multi-frame extxyz input, never collapse all frames into one cif. Write one cif file per frame using stable names such as frame_000001.cif.

Command

convert

Convert a structure file and return output metadata.

Positional arguments

Argument Description
input_file Source structure path. Supported: .extxyz, .xyz, .cif
output_path Output file path or output directory

Optional arguments

Flag Type Description
--output-format str Explicit target format: cif or extxyz. If omitted, infer from output_path

JSON response fields

status, message, output_mode, output_format, frame_count, output_path, output_paths

Recommended Behavior

  • Prefer directory outputs when converting multi-frame extxyz to cif
  • Always return absolute paths
  • Report the output mode, frame count, output directory or file, and all generated paths
  • Surface exact parsing or conversion errors from ASE

Examples

# Multi-frame extxyz to per-frame CIF directory
python skills/structure_conversion/structure_conversion_tools.py convert \
    generated.extxyz converted_cifs --output-format cif

# Single CIF to extxyz
python skills/structure_conversion/structure_conversion_tools.py convert \
    structure.cif structure.extxyz

Notes

  • This skill is commonly used after mattergen generation and before downstream property prediction
  • If output_format is omitted, the script infers it from output_path
  • If the input contains multiple frames and the target is cif, the result is a directory, not a single file

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/ai4ms-matcreator-structure-conversion/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

ai4ms-matcreator-structure-conversion.ocm.jsonjson
{
  "ocm": "1",
  "id": "ai4ms-matcreator-structure-conversion",
  "kind": "skill",
  "name": "structure-conversion",
  "description": "Convert crystal structure files between extxyz and CIF, including splitting multi-frame extxyz into per-frame CIF files.",
  "publisher": "AI4MS",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "structure",
      "conversion",
      "extxyz",
      "cif",
      "ase",
      "github"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Convert crystal structure files between extxyz and CIF, including splitting multi-frame extxyz into per-frame CIF files."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "github",
      "repository": "https://github.com/AI4MS/MatCreator",
      "path": "src/matcreator/skills/structure-conversion/SKILL.md",
      "ref": "cb5dc92f6cbb630aeaab11a6ac1cc791ae6f45c4",
      "url": "https://github.com/AI4MS/MatCreator/blob/cb5dc92f6cbb630aeaab11a6ac1cc791ae6f45c4/src/matcreator/skills/structure-conversion/SKILL.md",
      "key": "AI4MS/MatCreator/src/matcreator/skills/structure-conversion/SKILL.md"
    }
  },
  "instructions": "## Overview\n\nUse the CLI script `structure_conversion_tools.py` (located alongside this file) to convert structure files between `extxyz` and `cif`. It mirrors the behavior of the former `ase_structure_convert_tool` and is especially useful for turning MatterGen multi-frame `extxyz` outputs into per-frame `cif` files.\n\nEvery command writes a JSON object to stdout and exits **0** on success or **1** on error. Always parse the JSON output and confirm `\"status\": \"success\"`.\n\n```bash\npython skills/structure_conversion/structure_conversion_tools.py convert <input_file> <output_path> [options]\n```\n\n",
  "cost": {
    "context_tokens": 608
  }
}

Fetch it by URL: GET /api/v1/registry/ai4ms-matcreator-structure-conversion/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.