Open Babel is a C++ library for
reading, writing and converting chemical file formats, computing
descriptors and fingerprints, and more. Ropenbabel bundles
the Open Babel sources and builds them as a static library when the
package is installed, so that other R packages can link to Open Babel on
Linux, macOS and Windows without a system installation. It follows the
model of Rhtslib and Rhdf5lib.
Ropenbabel itself has no user-level functionality. End
users will normally use a client package such as
ChemmineOB.
## [1] "3.2.1"
In the client package’s DESCRIPTION:
Imports: Ropenbabel
LinkingTo: Ropenbabel
SystemRequirements: GNU make
In src/Makevars (and src/Makevars.win,
using Rscript.exe):
RSCRIPT = "$(R_HOME)/bin/Rscript"
PKG_CPPFLAGS = $(shell $(RSCRIPT) -e "Ropenbabel::pkgconfig('PKG_CPPFLAGS')")
PKG_LIBS = $(shell $(RSCRIPT) -e "Ropenbabel::pkgconfig('PKG_LIBS')")
pkgconfig() gives the include path and the libraries to
link:
## -I'/tmp/RtmpV0Wqb3/Rinst6d11296176c/Ropenbabel/openbabel/include/openbabel3'
## '/tmp/RtmpV0Wqb3/Rinst6d11296176c/Ropenbabel/openbabel/lib/libopenbabel.a' '/tmp/RtmpV0Wqb3/Rinst6d11296176c/Ropenbabel/openbabel/lib/libinchi.a' -lcairo -lz
Then include Open Babel headers as usual, e.g.
#include <openbabel/mol.h>. Because the library is
static, all file formats and plugins are registered at link time; no
plugin directory is needed at run time.
Open Babel reads force-field parameters, atom typing rules and
similar data from the directory given by the BABEL_DATADIR
environment variable. Ropenbabel sets it to
dataDir() when it is loaded, unless it is already set. A
client package that imports Ropenbabel gets this
automatically.
## [1] "/tmp/RtmpV0Wqb3/Rinst6d11296176c/Ropenbabel/openbabel/share/openbabel/3.2.1"
pkg-config at install time,
enables PNG output (Open Babel’s png format). Set the
environment variable OB_DISABLE_CAIRO=ON to build without
it.OB_JOBS sets the number of parallel compile jobs
(default 2).## R version 4.6.2 (2026-10-29)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 26.04.1 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so; LAPACK version 3.12.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: Etc/UTC
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] Ropenbabel_0.99.0 BiocStyle_2.41.0
##
## loaded via a namespace (and not attached):
## [1] digest_0.6.39 R6_2.6.1 fastmap_1.2.0
## [4] xfun_0.62 maketools_1.3.2 cachem_1.1.0
## [7] knitr_1.52 htmltools_0.5.9 rmarkdown_2.32
## [10] buildtools_1.0.0 lifecycle_1.0.5 cli_3.6.6
## [13] sass_0.5.0 jquerylib_0.1.4 compiler_4.6.2
## [16] sys_3.4.3 tools_4.6.2 evaluate_1.0.5
## [19] bslib_0.12.0 yaml_2.3.12 BiocManager_1.30.27
## [22] jsonlite_2.0.0 rlang_1.3.0