Open Babel — Molecular Format Conversion

SkillFiles & storage

Convert molecular file formats using Open Babel. Handles SMILES, mol2, sdf, pdb, xyz, cif, and 100+ other formats. Also performs 3D coordinate generation and hydrogen addition.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Open Babel — Molecular Format Conversion skill

What this skill tells your AI

The instructions your AI receives, as published by hello-qm/catgo-lrg in .claude/skills/openbabel/SKILL.md and read by ahel’s review.

When to Use

  • User needs to convert between molecular file formats (SMILES, mol2, sdf, pdb, xyz, cif)
  • User wants to generate 3D coordinates from SMILES
  • User needs to add/remove hydrogens
  • User wants to perceive bond orders from a 3D structure
  • User needs canonical SMILES or InChI identifiers

Prerequisites

  1. Open Babel installed (obabel -V)
  2. For Python scripting: openbabel or openbabel-wheel package

Workflow Steps — CLI

Convert between formats

catgo_workflow_engine(action="add_task", params={
  "workflow_id": "wf_xxx",
  "task_type": "shell",
  "name": "convert_format",
  "command": "obabel input.mol2 -O output.pdb",
  "system_name": "format_convert"
})

Common CLI Commands

SMILES to 3D structure

obabel -:"CCO" -O ethanol.xyz --gen3d
# Generates 3D coordinates using force field optimization

Add hydrogens

obabel input.pdb -O output.pdb -h
# -h adds hydrogens at pH 7.4

Remove hydrogens

obabel input.pdb -O output.pdb -d

Batch conversion

obabel *.mol2 -O output_.pdb -m
# -m produces one output file per input molecule

Generate conformers

obabel input.sdf -O conformers.sdf --conformer --nconf 50 --writeconformers

Get canonical SMILES

obabel input.mol2 -O output.smi -ocan

Energy minimization

obabel input.xyz -O minimized.xyz --minimize --ff MMFF94 --steps 2500

Supported Formats (most common)

FormatExtensionNotes
SMILES.smi1D string representation
SDF/MOL.sdf, .mol2D/3D with bond orders
PDB.pdbProtein Data Bank format
MOL2.mol2Tripos format with charges
XYZ.xyzSimple Cartesian coordinates
CIF.cifCrystallographic Information File
CML.cmlChemical Markup Language
InChI-IUPAC identifier (use -oinchi)
POSCAR.vaspVASP structure (limited support)
GJF/COM.gjf, .comGaussian input

Python API

from openbabel import openbabel as ob

conv = ob.OBConversion()
conv.SetInFormat("smi")
conv.SetOutFormat("mol2")

mol = ob.OBMol()
conv.ReadString(mol, "c1ccccc1")  # benzene

# Generate 3D
builder = ob.OBBuilder()
builder.Build(mol)

# Force field optimization
ff = ob.OBForceField.FindForceField("MMFF94")
ff.Setup(mol)
ff.ConjugateGradients(500)
ff.GetCoordinates(mol)

conv.WriteFile(mol, "benzene.mol2")

Parameter Guidance

FlagPurpose
--gen3dGenerate 3D coordinates from 2D/SMILES
-hAdd hydrogens
-dDelete hydrogens
--minimizeEnergy minimization with force field
--ff MMFF94Force field: MMFF94, UFF, Ghemical
-mMultiple output files (one per molecule)
--conformerConformer search
-ocanOutput canonical SMILES

Common Pitfalls

  1. No 3D coordinates from SMILES — SMILES are 1D strings. Use --gen3d to create 3D structures.
  2. Bond order loss — XYZ format has no bond information. Converting xyz to mol2 requires bond perception (-b flag).
  3. Wrong protonation — default -h adds H at pH 7.4. Specify pH with -p <pH> if needed.
  4. Large molecule conformers--gen3d gives one conformation. For proper conformer sampling, use RDKit (molecular/rdkit/SKILL.md).
  5. Periodic structures — Open Babel's support for periodic systems (CIF/POSCAR) is limited. Use pymatgen or ASE for crystals.
  6. Force field coverage — MMFF94 covers organic molecules well but may not have parameters for transition metals.

Signals

GitHub stars
198
Forks
23
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
openbabel
Source
github.com/hello-qm/catgo-lrg