Monday, 7 October 2019

Installing OpenBabel

I previously wrote a little blogpost about the OpenBabel software for cheminformatics.

This week I decided to install the latest OpenBabel on my Mac laptop.

Here's what I did:

--- The latest instructions for installation from the OpenBabel website are here.

--- I downloaded the latest development version from github here. (Note: I first tried to install the latest release, but there was a problem, so instead I found I could install the development version, which is newer.)

--- I then did this on my Mac laptop, in an terminal window:
     % mkdir /Users/alc/Documents/Software/openbabel
     % cd /Users/alc/Documents/Software/openbabel
     % mv ~alc/Downloads/openbabel-openbabel-3-0-0a2.tar.gz .
     % gunzip openbabel-openbabel-3-0-0a2.tar.gz
     % tar xvf openbabel-openbabel-3-0-0a2.tar
     % mkdir ob-build
     % mv openbabel-openbabel-3-0-0a2 ob-src

--- I then installed CMake as it wasn't on my Mac laptop already (Note to self: I downloaded the Mac dmg from https://cmake.org/ and asked Systems to install it).

--- In the CMake GUI on my Mac laptop, I then set:
     'where is the source code' to /Users/alc/Documents/Software/openbabel/ob-src
    'where to build the binaries' to /Users/alc/Documents/Software/openbabel/ob-build
    and CMAKE_INSTALL_PREFIX to /Users/alc/Documents/Software/openbabel-install
(Note: setting the CMAKE_INSTALL_PREFIX variable like this means that you can make a local installation of OpenBabel even if you are don't have the administrator password for the computer.)
  

     








--- I then clicked 'Configure' in Cmake and then clicked 'Generate' in Cmake. This makes a makefile for building OpenBabel.

---  Back in the terminal window on my Mac laptop, I typed:
% cd ob-build
% make
% make install

--- Then I tried running Openbabel:
% /Users/alc/Documents/Software/openbabel/ob-build/bin/obabel
No input file or format spec or possibly a misplaced option.
Most options must come after the input files. (-i -o -O -m can be anywhwere.)

Open Babel 3.0.0a2 -- Oct  1 2019 -- 10:22:49
Usage:
obabel [-i<input-type>] <infilename> [-o<output-type>] -O<outfilename> [Options]
Try  -H option for more information.


Hurray!!! It worked : )

Now let's try some OpenBabel magic:
% /Users/alc/Documents/Software/openbabel/ob-build/bin/obabel -:"c1ccccc1C(=O)Cl" -oascii

  Cl                                   O                                      
                                __                                            
         __                   _/                                              
           \_              __/   __                                           
             \__        __/    _/                                             
                \_    _/    __/                                               
                  \__/    _/                                                  
                    \_  _/                                                    
                     |_/                                                      
                     |                                                        
                     |                                                        
                     |                                                        
                     |                                                        
                     |                                                        
                     |                                                        
                     |                                                        
                     |                                                        
                     |                                                        
                     |                                                        
                     |                                                        
                     |                                                        
                     __                                                       
                   _/  \_                                                     
                __/      \__                                                  
              _/      __    \__                                               
           __/          \_     \_                                             
        __/               \__    \__                                          
      _/                     \__    \_                                        
   __/                          \_    \_                                      
   |                              \_   |                                      
   |                                   |                                      
   |  |                                |                                      
   |  |                                |                                      
   |  |                                |                                      
   |  |                                |                                      
   |  |                                |                                      
   |  |                                |                                      
   |  |                                |                                      
   |  |                                |                                      
   |  |                                |                                      
   |  |                                |                                      
   |                              __   |                                      
   _                            _/    __                                      
    \_                       __/    _/                                        
      \__                 __/    __/                                          
         \_             _/    __/                                             
           \__        _/    _/                                                
              \__        __/                                                  
                 \_    _/                                                     
                   \__/                                                       
                                                                              
1 molecule converted


No comments: