Filewatcher File Search File Search
Content Search
» » » » » » openbabel-mingw4-2.2.0-src.tar.bz2 » Content »
pkg://openbabel-mingw4-2.2.0-src.tar.bz2:5190673/scripts/ruby/  info  downloads


The Ruby Interface to Open Babel (v. 1.0)

This is the Ruby interface to the Open Babel library. 

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.

This code was automatically generated with SWIG and provides access to almost all of the Open Babel API via Ruby.

More details can also be found at the Open Babel website:


To install this module globally, first install Open Babel. Then invoke the following commands:

$ ruby extconf.rb
$ make
# make install

To install this module locally in ~/tree, first install Open Babel. Then invoke the following commands:

$ ruby extconf.rb 
   (use the option --with-openbabel-dir=~/tree
    if OpenBabel was installed locally)
$ make
$ export DESTDIR=~/tree
$ make install
$ export RUBYLIB=~/tree/usr/local/lib/site_ruby/1.8/i486-linux/


If OpenBabel is installed locally, then set LD_LIBRARY_PATH to the directory containing

The module can be easily tested from irb (interactive ruby):

$ irb

irb(main):001:0> require 'openbabel'
=> true
=> #<OpenBabel::OBMol:0x2add323ddf58>
irb(main):003:0> mol.num_atoms
=> 0

Note: all Open Babel methods have been renamed to follow Ruby conventions. 
For example, the method to count the number of atoms in a molecule is
 "num_atoms", not "NumAtoms."

Also note: The following fields have been renamed for Ruby compatibility:

OpenBabel::OBResidueIndex::_1MA -> OpenBabel::OBResidueIndex::U1MA
OpenBabel::OBResidueIndex::_1MG -> OpenBabel::OBResidueIndex::U1MG
OpenBabel::OBResidueIndex::_2MG -> OpenBabel::OBResidueIndex::U2MG
OpenBabel::OBResidueIndex::_7MG -> OpenBabel::OBResidueIndex::U7MG
OpenBabel::OBResidueIndex::_5MU -> OpenBabel::OBResidueIndex::U5MU
OpenBabel::OBResidueIndex::_5MC -> OpenBabel::OBResidueIndex::U5MC


Given the "openbabel-ruby.i" interface file (contained in this directory's 
parent directory), wrapper code can be generated with SWIG. From the directory
containing this README, use the following command:

swig -ruby -autorename -c++ -I../../include -o openbabel_ruby.cpp ../openbabel-ruby.i

This command produces the glue code "openbabel_ruby.cpp".

To disable the autorenaming of Open Babel methods, use the "-noautorename"
flag (SWIG 1.3.29+). Earlier SWIG versions don't support renaming.

Generating the C++ glue code using SWIG currently gives a top-level module 
called "Openbabel" instead of "OpenBabel". To use the latter name, change the 
argument to "rb_define_module" from "Openbabel" to "OpenBabel" in 
openbabel_ruby.cpp. These modifications are also made automatically by the 
Open Babel makefiles. Make sure you run ./configure with the 
--enable-maintainer-mode flag when building Open Babel to enable rebuilding
these scripting interfaces.


Copyright (C) 2007 Geoffrey R. Hutchison  <> 
    and Richard L. Apodaca <>

This Ruby module is part of the Open Babel project.

Open Babel is distributed under the GNU General Public License (GPL).
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License. Full details
can be found in the file "COPYING" which should be included in your

Results 1 - 1 of 1
Help - FTP Sites List - Software Dir.
Search over 15 billion files
© 1997-2017