Convert crystal structure CIF files to/from PNG images for machine learning compatibility.

Install

mkdir -p .claude/skills/xtal2png && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11125" && unzip -o skill.zip -d .claude/skills/xtal2png && rm skill.zip

Installs to .claude/skills/xtal2png

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Encode/decode crystal structures to/from PNG images. Use when applying image-based ML models (GANs, diffusion models) to crystal structure prediction or generation.
164 chars✓ has a “when” trigger
Advanced

Key capabilities

  • Encode structures to PNG
  • Decode PNG to structures
  • Integrate with ML models
  • Relax structures

How it works

It encodes crystal structures into 64x64 grayscale PNG images and reconstructs them, enabling image-based ML model usage.

Inputs & outputs

You give it
Crystal structure or PNG image
You get back
Encoded image or decoded structure

When to use xtal2png

  • Structure classification
  • Generative crystal structure modeling
  • ML-based structure prediction

About this skill

xtal2png

Overview

xtal2png encodes/decodes crystal structures to/from grayscale PNG images. This QR-code-like representation enables direct use of image-based ML models (GANs, VAEs, diffusion models) for crystal structure tasks.

Installation

# Conda (recommended)
conda create -n xtal2png -c conda-forge xtal2png m3gnet
conda activate xtal2png

# PyPI
pip install xtal2png

Quick Start

from xtal2png import XtalConverter, example_structures

# Encode structures to PNG
xc = XtalConverter(relax_on_decode=False)
data = xc.xtal2png(example_structures, show=True, save=True)

# Decode PNG back to structures
decoded_structures = xc.png2xtal(data, save=False)

# With surrogate DFT relaxation
xc_relax = XtalConverter(relax_on_decode=True)
relaxed = xc_relax.png2xtal(data)

CLI Usage

# Encode CIF files to PNG
xtal2png --encode --path structure.cif --save-dir output/

# Decode PNG to CIF
xtal2png --decode --path structure.png --save-dir output/

Key Capabilities

Structure Encoding

  • 64x64 grayscale PNG images
  • Captures lattice, sites, chemistry
  • Max 52 sites per structure

Structure Decoding

  • Reconstruct from PNG
  • Optional M3GNet relaxation

Model Integration

  • GANs, VAEs, diffusion models
  • CNN-based analysis

Use Cases

  • Image-based ML for crystals
  • Generative modeling
  • Structure classification
  • Transfer learning

When to Use This Skill

  • Applying image-based ML models to crystal structure tasks
  • Using GANs, VAEs, or diffusion models for crystal generation
  • Encoding structures as PNG for CNN-based analysis
  • Transfer learning from image models to materials domain
  • Converting between structure and image representations

Best Practices

  • Use relax_on_decode=True with M3GNet for relaxed structures
  • Limit to 52 atoms per structure for encoding
  • Validate decoded structures with pymatgen StructureMatcher
  • Use CLI for batch encoding/decoding operations
  • Test reconstruction quality before ML model training

Resources

When not to use it

  • When the structure exceeds 52 atoms
  • When the user needs non-image-based prediction

Prerequisites

xtal2png package

Limitations

  • Max 52 sites per structure
  • Requires validation with StructureMatcher

How it compares

It provides a unique image-based representation for crystal structures, facilitating the use of standard image ML models.

Compared to similar skills

xtal2png side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
xtal2png (this skill)03moReviewAdvanced
llava78moReviewAdvanced
cocoindex69moReviewIntermediate
ai-multimodal96moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

llava

zechenzhangAGI

Large Language and Vision Assistant. Enables visual instruction tuning and image-based conversations. Combines CLIP vision encoder with Vicuna/LLaMA language models. Supports multi-turn image chat, visual question answering, and instruction following. Use for vision-language chatbots or image understanding tasks. Best for conversational image analysis.

7117

cocoindex

cocoindex-io

Comprehensive toolkit for developing with the CocoIndex library. Use when users need to create data transformation pipelines (flows), write custom functions, or operate flows via CLI or API. Covers building ETL workflows for AI data processing, including embedding documents into vector databases, building knowledge graphs, creating search indexes, or processing data streams with incremental updates.

6116

ai-multimodal

mrgoonie

Process and generate multimedia content using Google Gemini API. Capabilities include analyze audio files (transcription with timestamps, summarization, speech understanding, music/sound analysis up to 9.5 hours), understand images (captioning, object detection, OCR, visual Q&A, segmentation), process videos (scene detection, Q&A, temporal analysis, YouTube URLs, up to 6 hours), extract from documents (PDF tables, forms, charts, diagrams, multi-page), generate images (text-to-image, editing, composition, refinement). Use when working with audio/video files, analyzing images or screenshots, processing PDF documents, extracting structured data from media, creating images from text prompts, or implementing multimodal AI features. Supports multiple models (Gemini 2.5/2.0) with context windows up to 2M tokens.

9108

rag-implementation

wshobson

Build Retrieval-Augmented Generation (RAG) systems for LLM applications with vector databases and semantic search. Use when implementing knowledge-grounded AI, building document Q&A systems, or integrating LLMs with external knowledge bases.

10101

rdkit

K-Dense-AI

Cheminformatics toolkit for fine-grained molecular control. SMILES/SDF parsing, descriptors (MW, LogP, TPSA), fingerprints, substructure search, 2D/3D generation, similarity, reactions. For standard workflows with simpler interface, use datamol (wrapper around RDKit). Use rdkit for advanced control, custom sanitization, specialized algorithms.

856

pyhealth

davila7

Comprehensive healthcare AI toolkit for developing, testing, and deploying machine learning models with clinical data. This skill should be used when working with electronic health records (EHR), clinical prediction tasks (mortality, readmission, drug recommendation), medical coding systems (ICD, NDC, ATC), physiological signals (EEG, ECG), healthcare datasets (MIMIC-III/IV, eICU, OMOP), or implementing deep learning models for healthcare applications (RETAIN, SafeDrug, Transformer, GNN).

351

Search skills

Search the agent skills registry