The repository of the developer can be found at github.
Because the code has been developed a few years ago there are some problems if you try to install pgchem with the current (or at least close to current) postgres and openbabel releases.
It took me at least a few weeks and a lot of help from some colleagues at Freiburg university to get a postgres/pgchem system up and running on my local linux x64 machine (Ubuntu 12.10).
In the end it proved to be easier than expected due to the big help of Björn Grüning and Kiran Telukunta who fixed the x64 Makefile and thus allowed the pgchem code to compile on a modern system.
Björn's repository with the updated code can be found here:
and they also included a nice shell script that handles the installation of postgres and openbabel as well as the actual pgchem and barsoi installation. It can also be found in Björn's repository (install_debian-ubuntu.sh). The current version of the repo also contains changed SQL function definitions of the pgchem functions because two of them did not work with the new versions of openbabel and pgchem.
However, if you don't want to use this script, you have to do the following:
- Install postgres
- this could be done from source code or using a packet manager such as apt-get
- Create a new user account for your database
- Install openbabel (not necessary if you don't want a global ob installation)
- If you install it globally, you can also use the command line tools
- If you install python bindings as well you can use openbabel/pybel in python scrips
- The shared-flag has to be switched on for the libraries to work with pgchem:
- Install pgchem
- Download the package from Björn's gibthub
- Install the included openbabel version
- cmake .. -DBUILD_SHAREDON -DBUILD_GUIOFF -DBUILD_TESTINGOFF -DCMAKE_INSTALL_PREFIX
- Install barsoi in the pgchem directory:
cd barsoi make -f Makefile.linux
- Now some re-naming has to take place for the makefile to work:
- locale.h in openbabel-2.3.2/include/openbabel/locale.h has to be renamed to _locale.h (in the same dir as locale.h)
- In openbabel-2.3.2/build/lib there has to be a symbolic link from inchiformat.so to libinchiformat.so
- change into the pgchem directory
- Have a look at the makefile (only x64 is updated!) and change it if needed (should not be the case)
- Compilemake -f Makefile.linux.x64
- Then again some copying needs to be done:
- copy libpgchem.so, barsoi/libbarsoi.so, openbabel-2.3.2/build/lib/libinchi.so.0.4.1, openbabel-2.3.2/build/lib/libopenbabel.so.4.0.2, openbabel-2.3.2/build/lib/inchiformat.so to your postgres library directory
- copy setup/tigress/obdata/dictionary* to your portgres lib dir at openbabel/share/openbabel/2.3.2
- Create the following links in the porstgres lib dir:
sudo ln -s libinchi.so.0.4.1 libinchi.so.0sudo ln -s libinchi.so.0 libinchi.sosudo ln -s libopenbabel.so.4.0.2 libopenbabel.so.4sudo ln -s libopenbabel.so.4 libopenbabel.sosudo ln -s inchiformat.so libinchiformat.so
- Because only the openbabel library files are needed you can then remove the bin and include folders from your pgchem openbabel installtion
- Restart postgres
- Create a new database, etc.
- Run the pgchem_setup.sql script in your database
In the interactive command prompt you have to use the "\i" command:
<your_db># \i /$POSTGRES_DIR/contrib/pgchem/setup/pgchem_setup.sql
Examples for how to use pgchem are given in the Documentation that can be accessed from the any of the repositories or found here.