Open Babel: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
(new page for Open Babel)
 
No edit summary
Line 1: Line 1:
[[Category:Software]][[Category:ComputationalChemistry]]{{ draft }}
[[Category:Software]][[Category:ComputationalChemistry]]{{ draft }}
[https://openbabel.org/ Open Babel] is a chemical toolbox designed to speak the many languages of chemical data.
[https://openbabel.org/ Open Babel] is a chemical toolbox designed to speak the many languages of chemical data.
It's an open, collaborative project allowing anyone to search, convert, analyze, or store data from molecular modeling, chemistry, solid-state materials, biochemistry, or related areas.
It's an open, collaborative project allowing anyone to search, convert, analyze, or store data from molecular modeling, chemistry, solid-state materials, biochemistry, or related areas.

Revision as of 21:10, 26 January 2024


This article is a draft

This is not a complete article: This is a draft, a work in progress that is intended to be published into an article, which may or may not be ready for inclusion in the main wiki. It should not necessarily be considered factual or authoritative.



Open Babel is a chemical toolbox designed to speak the many languages of chemical data. It's an open, collaborative project allowing anyone to search, convert, analyze, or store data from molecular modeling, chemistry, solid-state materials, biochemistry, or related areas.

On our systems we have two kinds of modules for Open Babel installed:

openbabel[edit]

This is the serial version of Open Babel which can safely be used even on login-nodes to convert chemical structure files between different formats. This is the right module for most users.

Example:

module load openbabel
# download acetic_acid.mol as an example file:
wget "https://www.chemspider.com/FilesHandler.ashx?type=str&3d=yes&id=171" -O acetic_acid.mol
# convert from .mol format to .pdb format:
obabel   -i mol   acetic_acid.mol   -o pdb   -O acetic_acid.pdb

openbabel-omp[edit]

This is the parallel version of Open Babel which has OpenMP parallelization enabled.

This module should not be used on login-nodes,, because even for simple tasks it will create as many threads as it detects CPUs on the machine, in turn causeing load-spikes will be disruptive for other users.

The parallel version of Open Babel is useful when converting very large numbers of files or calculating many of cheminformatics descriptors for large numbers of files. In this case please make sure to sent the environment variable OMP_NUM_THREADS in order to tell Open Babel how many CPUs it is allowed to use.

For example the following job would take the Structual Data File many_molecules.sdf which in this case should contain a database with many molecules and generate Canonical SMILES representations for each of them, using two CPU-cores.


File : parallel_openbabel_job.sh

#!/bin/bash
#SBATCH --time=00:15:00
#SBATCH --cpus-per-task=2
#SBATCH --mem-per-cpu=1000M
module load openbabel-omp
export OMP_NUM_THREADS="${SLURM_CPUS_PER_TASK:-1}"

obabel   -i sdf   many_molecules.sdf   -o can   -O many_canonical_smiles.txt


Python[edit]

Open Babel's functionality can be used from other languages such as Python. The Python interface for Open Babel has been added to the both openbabel and openbabel-omp modules as extensions. Therefore both the openbabel and pybel packages can be used after loading both openbabel and a compatible Python module.

For example:

$ module load python/3.11 openbabel/3.1.1
$ python
Python 3.11.5 (main, Sep 19 2023, 19:49:15) [GCC 11.3.0] on linux
>>> import openbabel
>>> print(openbabel.__version__)
3.1.1.1
>>> from openbabel import pybel
>>>

For further information on how to use Open Babel, please refer to the Open Babel User Guide