From: richard a. <ric...@ya...> - 2006-10-28 02:06:32
|
Success! Geoff, I think this works now. I checked out OB-SVN. With a couple of minor modifications (for example, changing openbabel_ruby.cpp to openbabel_wrap.cpp, adding #include <math.h>) - I'll detail them shortly), I got the scripts/ruby wrapper compiled. Behold: $ irb irb(main):001:0> require 'openbabel_wrap' => true irb(main):002:0> m=Openbabel_wrap::OBMol.new => #<Openbabel_wrap::OBMol:0x2ba75b5563c8> irb(main):003:0> h=m.NewAtom => #<Openbabel_wrap::OBAtom:0x2ba75b552778> irb(main):004:0> h.SetAtomicNum(1) => nil irb(main):005:0> m.GetMolWt => 1.00794 It looks like all of the format interconversion utilities (smiles, mdl, etc) are missing, but we should be able to fix that. The important thing is now we've got a good place to start from. It must have been the older version of OB that I was using (2.0.2) that was the source of the problems. Could you verify that the above Ruby code works for you too? BTW, I'll respond in more detail to you're suggestions below shortly. cheers, Rich --- Geoffrey Hutchison <ge...@ge...> wrote: > > On Oct 14, 2006, at 4:47 PM, richard apodaca wrote: > > > (3) edit openbabel.i: comment out line 27 (Swig > can't > > find std_list.i for Ruby - it works for Python, > > though). Change line 5 to %module openbabel_wrap > > (don't want to risk a collision w/ installed > openbabel > > library) > > Seems like it might soon be a good idea to have > different openbabel.i > files for the different scripting modules. The SVN > version (for > 2.1.0bX) has the std_list.i #ifdef'ed out > automatically. > > > This generates lots of warnings that don't appear > when > > the argument is -python instead of -ruby (maybe > this > > is the problem): > > Nah. I get these for Perl and Python too. The > problem is that C++ has > different naming restrictions than scripting > languages. So some > functions may not be available until remapped. Not a > problem for core > functionality, as far as I've seen. > > > (8) save the following as "extconf.rb": > > require 'mkmf' > > > > dir_config('openbabel') > > dir_config('openbabel-2.0') > > have_library('openbabel') > > > > create_makefile('openbabel_wrap') > > One bit which might be good is to have a path to the > libopenbabel > too. On my system it was looking in the normal > search path, which may > or may not work for everyone (e.g., with a custom > --prefix call to > the Open Babel configure script.) > > > (9) create the makefile: > > > > ruby extconf.rb > > > --with-openbabel-include='/usr/local/include/openbabel-2.0/openbabel' > > > --with-openbabel-2.0-include='/usr/local/include/openbabel-2.0' > > Ideally could this be something that could go into > the scripts/ > Makefile.am as a shell script? The Makefiles should > have the correct > paths already. > > > (13) require 'openbabel_wrap' > > irb(main):001:0> require 'openbabel_wrap' > > Here (on OS X, Ruby 1.8.4), I get: > > irb(main):001:0> require 'openbabel_wrap' > => true > > Not quite sure of enough ruby (or the binding) to > try anything else > yet... Maybe you should try this on the SVN version? > I'd obviously > like to get a ruby module into 2.1.0 anyway. > > Cheers, > -Geoff > ____________________________________________________________________________________ We have the perfect Group for you. Check out the handy changes to Yahoo! Groups (http://groups.yahoo.com) |