LinuxCommandLibrary

obabel

open Babel command-line tool for converting between molecular file formats

TLDR

Convert a .mol file to XYZ coordinates

$ obabel [path/to/file.mol] -O [path/to/output_file.xyz]
copy
Convert a SMILES string to a 500x500 picture
$ obabel -:"[SMILES]" -O [path/to/output_file.png] -xp 500
copy
Convert a file of SMILES string to separate 3D .mol files
$ obabel [path/to/file.smi] -O [path/to/output_file.mol] --gen3D -m
copy
Render multiple inputs into one picture
$ obabel [path/to/file1 path/to/file2 ...] -O [path/to/output_file.png]
copy

SYNOPSIS

obabel [OPTIONS] [-i input-type] infile [-o output-type] -O outfile
obabel -:"SMILES-string" [OPTIONS] -O outfile

DESCRIPTION

obabel is the Open Babel command-line tool for converting between molecular file formats used in chemistry and computational modeling. It supports over 100 chemical data formats including SDF, MOL, PDB, SMILES, CML, and image formats for visualization.
Beyond simple conversion, obabel can filter molecules by properties, generate 3D coordinates, perform energy minimization using forcefields (MMFF94, UFF, GAFF), and manipulate molecular data. It handles batch processing with wildcard patterns and can split multi-molecule files into individual outputs.

PARAMETERS

-i format

Specify input format explicitly (e.g., -imol, -ismi)
-o format
Specify output format explicitly (e.g., -osmi, -opng)
-O outfile
Specify output file path
-:"SMILES"
Use SMILES string as input instead of a file
-m
Produce multiple output files (one per molecule)
-f #
Start import at molecule number specified
-l #
End import at molecule number specified
--gen3D
Generate 3D coordinates for molecules
-e
Continue with next object after error
-z
Compress output with gzip
-H
Display help; use -Hformat for format-specific help
-V
Display version number
-aoption
Input format-specific option
-xoption
Output format-specific option

CAVEATS

Format detection relies on file extensions; use -i and -o flags explicitly when extensions are ambiguous. Some conversions may lose data if the target format lacks equivalent fields. 3D coordinate generation (--gen3D) can be slow for large molecules.

HISTORY

Open Babel originated from the OELib/OBabel project started in 1998. The obabel command replaced the older babel command around version 2.3 (2011), offering improved option handling following Unix conventions. Open Babel 3.0 was released in 2019 with enhanced stereochemistry support.

SEE ALSO

rdkit(1), pymol(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community