# Open Babel

**Open Babel** 是一个开源化学信息学工具包，以 C++ 编写，采用 GNU GPL 第 2 版许可，用于在文件格式之间转换化学数据，并提供一个用于搜索、过滤和操作分子数据的库。其命令行程序 `obabel` 可在分子建模、计算化学及相关领域使用的多种文件格式之间相互转换，还可过滤分子并对化学数据进行简单操作。<sup>[1](https://openbabel.org/docs/Command-line_tools/babel.html)</sup> 该程序背后是一个完整的化学信息学库，可从 C++ 使用，并可通过 SWIG 生成的绑定从 Python、Perl、Ruby、CSharp 和 Java 使用。<sup>[2](https://openbabel.org/docs/UseTheLibrary/intro.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 它是什么 | 一个开放的化学工具箱，用于在文件格式之间转换化学数据，另附一个用于化学信息学的 C++ 库<sup>[3](https://open-babel.readthedocs.io/_/downloads/en/latest/pdf/)</sup> |
| 文件格式 | 共支持 146 种格式，涵盖二维描绘、三维查看器和计算化学软件包<sup>[4](https://openbabel.org/docs/FileFormats/Overview.html)</sup> |
| 许可证 | GNU 通用公共许可证（GPL-2.0-only）；任何使用该库的软件都必须遵守 GPLv2 条款<sup>[2](https://openbabel.org/docs/UseTheLibrary/intro.html)</sup><sup> • </sup><sup>[5](https://pypi.org/project/openbabel/3.2.1/)</sup> |
| 最新版本 | openbabel-3.2.1（2026 年 7 月 11 日），向后兼容 3.0 和 3.1<sup>[6](https://github.com/openbabel/openbabel/releases)</sup> |
| 语言绑定 | C++，以及通过 SWIG 提供的 Python（含 Pybel 模块）、Perl、Ruby、CSharp 和 Java<sup>[2](https://openbabel.org/docs/UseTheLibrary/intro.html)</sup> |
| 可扩展性 | 插件架构，涵盖文件格式、操作、电荷模型、力场、指纹和描述符<sup>[7](https://openbabel.org/docs/WritePlugins/index.html)</sup> |
| 标准引用 | O'Boyle 等，*Open Babel：开放的化学工具箱*，Journal of Cheminformatics 2011, 3, 33<sup>[8](https://dblp.org/rec/journals/jcheminf/OBoyleBJMVH11.html)</sup> |

## 历史

Open Babel 源自最初的 Babel 程序。两位原作者开始了一项名为 OBabel 的 C++ 重写，但从未公开发布，不过 Matt Stahl 在其雇主 OpenEye Software 以 GNU GPL 发布的 OELib 中使用了其中一些思路。当 OpenEye 决定将 OELib 重写为闭源的 OEChem 时，GPL 许可的 OELib 版本将不再维护；在 Stahl 和其他贡献者的支持下，这个自由版本被重新命名，成为 Open Babel。<sup>[9](https://openbabel.org/docs/Introduction/faq.html)</sup> 自 2001 年诞生以来，该项目已有了长足发展。<sup>[9](https://openbabel.org/docs/Introduction/faq.html)</sup>

该项目属于 Blue Obelisk 运动，这是一个开源化学项目团体，其共享组件降低了第二代化学软件的门槛，使这些软件不再需要自行处理底层的化学结构操作；在 2011 年对该运动的一项调查中，有 40 多个项目被列为使用 Open Babel 组件。<sup>[10](https://jcheminf.biomedcentral.com/counter/pdf/10.1186/1758-2946-3-37)</sup>

## obabel 命令行

`obabel` 程序可转换文件、过滤分子并操作化学数据。如果只给出输入和输出文件，它会根据文件扩展名猜测文件类型；用 `-:` 记法提供的文本被假定为 SMILES，除非指定了其他输入格式。<sup>[1](https://openbabel.org/docs/Command-line_tools/babel.html)</sup> `-L` 选项列出插件类型（`charges`、`descriptors`、`fingerprints`、`forcefields`、`formats`、`loaders` 和 `ops`）或给定类型的插件，`-H` 显示某格式的格式化选项。<sup>[1](https://openbabel.org/docs/Command-line_tools/babel.html)</sup>

除转换之外，命令行还支持改变结构本身的操作。`--gen3d` 选项生成三维坐标，`-p <pH>` 使用 `phmodel.txt` 中的变换添加适合给定 pH 的氢原子，`--partialcharge` 按选定方法计算部分电荷，`--minimize` 执行力场能量最小化。<sup>[1](https://openbabel.org/docs/Command-line_tools/babel.html)</sup> `--conformer` 选项使用基于力场的方法（系统穷举生成、随机生成或加权转子搜索，默认力场为 MMFF94）或遗传算法方法搜索构象异构体，并提供构象数、变异频率和评分函数（rmsd 或能量）等选项。<sup>[1](https://openbabel.org/docs/Command-line_tools/babel.html)</sup>

具有相同功能的图形用户界面可作为命令行的替代方案使用。<sup>[11](https://app.readthedocs.org/projects/open-babel/downloads/pdf/latest/)</sup>

## 库、绑定与许可

Open Babel 是一个 C++ 库，任何使用它的软件都必须遵守 GNU 公共许可证第 2 版的条款，包括 Python 脚本和其他语言绑定；分发给他人的软件必须应要求提供其源代码。<sup>[2](https://openbabel.org/docs/UseTheLibrary/intro.html)</sup> 该项目的常见问题解答澄清了一个常见误解：在工作场所内外，在个人项目中使用 Open Babel 代码都不受限制，但发布使用 Open Babel 代码的软件包时，该软件包必须按 GPL 发布。区别在于使用与分发。<sup>[9](https://openbabel.org/docs/Introduction/faq.html)</sup>

绑定是使用 SWIG 从 C++ 库自动生成的，Python 模块 Pybel 提供了对绑定功能的更便捷访问。<sup>[2](https://openbabel.org/docs/UseTheLibrary/intro.html)</sup> 在 PyPI 上，`openbabel` 包要求 Python 3.10 或更高版本，并被归类为面向科学和研究受众的生产/稳定软件。<sup>[5](https://pypi.org/project/openbabel/3.2.1/)</sup>

## 指纹与相似性搜索

分子指纹对分子结构进行编码，最常见的是用一系列二进制位表示特定子结构的存在与否；比较指纹可以确定两个分子之间的相似性，或找到与查询子结构匹配的结构。<sup>[12](https://openbabel.org/docs/Fingerprints/intro.html)</sup> Open Babel 提供多种指纹类型：基于路径的指纹 FP2；基于子结构的指纹 FP3、FP4 和 MACCS；用户定义的子结构；环形指纹 MNA（多级原子邻域）和 MolPrint2D；以及编码分子三维结构的 Spectrophores。<sup>[12](https://openbabel.org/docs/Fingerprints/intro.html)</sup>

## 插件架构

Open Babel 对文件格式、操作、电荷模型、力场、指纹和描述符采用插件架构。使用该库的应用程序启动时，会搜索可用插件并加载它们，这意味着插件可以与 Open Babel 发行版分开分发；甚至插件类型本身也是插件，因此很容易添加新类别。<sup>[7](https://openbabel.org/docs/WritePlugins/index.html)</sup> 添加任何类型的新插件都遵循简单的步骤：复制一个现有的插件 .cpp 文件，编辑它，并将其名称添加到相应的 `CMakeLists.txt` 中。<sup>[7](https://openbabel.org/docs/WritePlugins/index.html)</sup> 项目自带的电荷模型包括 Gasteiger-Marsili σ 部分电荷、MMFF94 部分电荷、QEq（电荷平衡）和 QTPIE（电荷转移、极化和平衡）。<sup>[7](https://openbabel.org/docs/WritePlugins/index.html)</sup>

2011 年的工具包论文描述了这种分离背后的设计目标：将插件的实现与核心库代码清晰分离，使新插件（例如新的文件格式）易于贡献，只需一个 C++ 文件和对一个构建文件的微小改动。<sup>[13](https://pmc.ncbi.nlm.nih.gov/articles/PMC3198950/)</sup>

## 发布与安全

2026 年 5 月 26 日发布的 3.2.0 版被描述为最新稳定版本，向后兼容 3.0 和 3.1，通过 OSS-Fuzz 基础设施以及 Cisco TALOS、Trail of Bits、ADA Logics 和 [Claude Mythos](https://www.edgepedia.org/zh/claude-mythos) 的报告，修复了许多内存和崩溃错误。<sup>[6](https://github.com/openbabel/openbabel/releases)</sup> 3.2.1 版于 2026 年 7 月 11 日发布，包含更多错误修复，包括修复 CVE-2026-54751，即 MMD 解析器中未初始化值的使用，该问题可能暴露先前的原子数据。<sup>[6](https://github.com/openbabel/openbabel/releases)</sup>

该项目的安全政策规定，修复应用于 `master` 分支并包含在下一个标记版本中；长期支持分支通常不维护，Debian、Fedora 和 conda-forge 等下游打包者负责向后移植。3.2.x 版本受支持，3.2 以下版本不受支持。<sup>[14](https://github.com/openbabel/openbabel/blob/master/SECURITY.md)</sup> 该项目的 CVE 跟踪表记录了格式解析器中的内存安全错误，包括 CIF、MOL2、CDXML、GAMESS、ChemKin 和 SMILES 等解析器组件中的越界读取、空指针解引用和释放后使用错误，其中大部分是通过模糊测试发现的，并在 3.2.0 和 3.2.1 中修复。<sup>[14](https://github.com/openbabel/openbabel/blob/master/SECURITY.md)</sup>

## Open Babel 与 RDKit

Open Babel 和 RDKit 是两大主导的开源化学信息学工具包，它们侧重不同的优势。Open Babel 优先考虑全面的文件格式支持和为高通量转换设计的命令行界面，支持 110 多种化学文件格式，超过 RDKit 的原生能力，这使其适用于迁移历史数据和对接旧版电子实验记录本。<sup>[15](https://inferensys.com/differences/scientific-research-agent-and-lab-automation-platforms/cheminformatics-and-bioinformatics-analysis-agents/rdkit-vs-open-babel-cheminformatics-toolkit)</sup> RDKit 提供更符合 Python 风格的 API，原生支持 NumPy，并与 PyTorch 和 [DeepChem](https://www.edgepedia.org/zh/deepchem) 等机器学习框架更紧密集成；Open Babel 通过 SWIG 生成的 Python 绑定和 C++ 核心不太适合需要无缝张量转换的现代机器学习工作流。<sup>[15](https://inferensys.com/differences/scientific-research-agent-and-lab-automation-platforms/cheminformatics-and-bioinformatics-analysis-agents/rdkit-vs-open-babel-cheminformatics-toolkit)</sup> 2023 年的一篇比较预印本指出了常见任务的重叠和高级功能的差异，但该预印本未经同行评审。<sup>[16](https://techyorker.com/rdkit-vs-open-babel-which-cheminformatics-toolkit-should-you-use/)</sup>

两个工具包共同出现在共享基础设施中：化学信息学微服务是一个用于化学数据任务的开源网络服务，并排使用 CDK、RDKit 和 Open Babel。<sup>[17](https://pmc.ncbi.nlm.nih.gov/articles/PMC10577930/)</sup> Open Babel 还作为组件存在于其他应用程序中；Avogadro 分子编辑器使用 Open Babel 库，从而支持常用化学文件格式的很大一部分。<sup>[18](https://pmc.ncbi.nlm.nih.gov/articles/PMC3542060/)</sup>

互操作性基准测试也反馈到了代码中。2018 年一项涵盖 15 个工具包（包括 Open Babel 开发版（2018 年 5 月））的 SMILES 基准测试揭示了边界情况和错误，导致 Open Babel、Cactvs、CDK、ChemDoodle、iwtoolkit、KnowItAll 和 OpenChemLib 发生了更改。<sup>[19](https://www.nextmovesoftware.com/products/SMILESBenchmark_ICCS_May2018.pdf)</sup>

## References

1. [obabel - Convert, Filter and Manipulate Chemical Data, Open Babel 3.2.0 documentation](https://openbabel.org/docs/Command-line_tools/babel.html)
2. [Write software using the Open Babel library, Open Babel 3.2.0 documentation](https://openbabel.org/docs/UseTheLibrary/intro.html)
3. [Open Babel documentation (readthedocs PDF)](https://open-babel.readthedocs.io/_/downloads/en/latest/pdf/)
4. [Supported File Formats and Options, Open Babel 3.1.1 documentation](https://openbabel.org/docs/FileFormats/Overview.html)
5. [openbabel 3.2.1, PyPI](https://pypi.org/project/openbabel/3.2.1/)
6. [Releases, openbabel/openbabel, GitHub](https://github.com/openbabel/openbabel/releases)
7. [Adding plugins, Open Babel 3.2.0 documentation](https://openbabel.org/docs/WritePlugins/index.html)
8. [dblp: Open Babel: An open chemical toolbox, Journal of Cheminformatics 3:33 (2011)](https://dblp.org/rec/journals/jcheminf/OBoyleBJMVH11.html)
9. [Frequently Asked Questions, Open Babel 3.2.0 documentation](https://openbabel.org/docs/Introduction/faq.html)
10. [Open Data, Open Source and Open Standards in chemistry: The Blue Obelisk five years on, Journal of Cheminformatics 3:37 (2011)](https://jcheminf.biomedcentral.com/counter/pdf/10.1186/1758-2946-3-37)
11. [Open Babel Documentation (readthedocs, latest PDF)](https://app.readthedocs.org/projects/open-babel/downloads/pdf/latest/)
12. [Molecular fingerprints and similarity searching, Open Babel 3.2.0 documentation](https://openbabel.org/docs/Fingerprints/intro.html)
13. [O'Boyle et al., Open Babel: An open chemical toolbox, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC3198950/)
14. [openbabel/SECURITY.md, GitHub](https://github.com/openbabel/openbabel/blob/master/SECURITY.md)
15. [RDKit vs Open Babel: Cheminformatics Toolkit Comparison, Inference Systems](https://inferensys.com/differences/scientific-research-agent-and-lab-automation-platforms/cheminformatics-and-bioinformatics-analysis-agents/rdkit-vs-open-babel-cheminformatics-toolkit)
16. [RDKit vs Open Babel: Which Cheminformatics Toolkit Should You Use?, TechYorker](https://techyorker.com/rdkit-vs-open-babel-which-cheminformatics-toolkit-should-you-use/)
17. [Cheminformatics Microservice: unifying access to open cheminformatics toolkits, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC10577930/)
18. [Avogadro: an advanced semantic chemical editor, visualization, and analysis platform, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC3542060/)
19. [SMILES Benchmark, NextMove Software (ICCS May 2018)](https://www.nextmovesoftware.com/products/SMILESBenchmark_ICCS_May2018.pdf)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Named software products and platforms › Engineering simulation and CAD software

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/open-babel

English original: https://www.edgepedia.org/open-babel
