obabel
Convert between chemical file formats
TLDR
Convert a .mol file to XYZ coordinates
Convert a SMILES string to a 500x500 picture
Convert a file of SMILES string to separate 3D .mol files
Render multiple inputs into one picture
SYNOPSIS
obabel [options]
obabel -iinput-format input-file -ooutput-format output-file [options]
PARAMETERS
-iformat
Specifies the input file format. If omitted, obabel attempts to guess from the file extension.
-oformat
Specifies the output file format. If omitted, obabel attempts to guess from the output file extension.
-r
Reads input from stdin instead of a file.
-w
Writes output to stdout instead of a file.
-p
Generates or optimizes 2D coordinates for molecules lacking them.
-c
Generates or optimizes 3D coordinates for molecules lacking them. Often used with --gen3d.
-s smarts
Performs a substructure search using a SMARTS pattern. Only molecules matching the pattern are processed.
-v
Enables verbose output, providing more detailed information about the process.
-H
Prints a comprehensive list of all supported chemical file formats, along with their extensions and read/write capabilities.
--addhydrogens
Adds hydrogens to the molecules, typically adding polar hydrogens or completing valencies.
--removehydrogens
Removes all hydrogens from the molecules, leaving only heavy atoms.
--gen3d
Generates 3D coordinates for molecules, often followed by energy minimization for better geometry.
--minimize
Performs energy minimization using a specified force field (e.g., MMFF94, UFF) to optimize molecular geometry.
-m
If multiple molecules are output, write each to a separate file, appending an index to the filename.
-O output_file_or_prefix
Specifies the output filename or a prefix for multiple output files (when used with -m).
DESCRIPTION
obabel is the powerful command-line interface to the Open Babel cheminformatics toolkit. It is designed for interconverting chemical file formats, performing molecular manipulations, and calculating chemical properties. Supporting over 110 chemical file formats (including SMILES, PDB, SDF, CML, XYZ), obabel is an indispensable tool for chemists, biologists, and material scientists. Beyond format conversion, it can generate 2D or 3D coordinates, add or remove hydrogens, perform substructure searches, calculate various molecular descriptors, and even carry out energy minimization, making it highly versatile for diverse computational chemistry tasks.
CAVEATS
Coordinate generation (e.g., with --gen3d) provides initial geometries, but for chemically accurate structures, subsequent energy minimization using a suitable force field is recommended.
The quality and completeness of format conversion can vary, as some formats support features not present in others. Large substructure searches or database processing can be computationally intensive.
SUPPORTED FORMATS
obabel supports an extensive range of chemical file formats. Use the -H option to see a comprehensive list of all supported formats, their common extensions, and whether they can be used for reading or writing.
DEFAULT BEHAVIOR
If input or output formats are not explicitly specified, obabel will attempt to infer them from the file extensions. If no output file is specified, the processed chemical data will be written to stdout.
HISTORY
Open Babel originated from the earlier babel program, with development starting in 2000. It aimed to be a more robust, cross-platform, and extensible cheminformatics toolkit. It has since evolved into a widely recognized open-source project, maintained by a community of developers, and is a cornerstone for many computational chemistry workflows and software.