Skip to content

Commit 2ad28c1

Browse files
committed
Merge branch 'rdkit' to switch from OpenBabel to RDKit
This closes #135 - Switch from OpenBabel to RDKit And also... closes #86 - Drawing of fused rings buggy closes #90 - molecule.fromSMILES(CC1=CC=CO1) gives "Unable to determine atom type for atom O." closes #121 - Furan inchi and SMILES cannot be resolved Should help with #106 in the future (I think RDKit has aromaticity detection). RDKit is now a requirement (but OpenBabel no longer is). Be sure to install RDKit with InChI Support, which at the moment requires building from source, I think. Note that anything being read in via InChI or SMILES will be Kekulized before making the RMG molecule. This means if you input benzene as SMILES="c1ccccc1" it will be equivalent to SMILES="C1=CC=CC=C1"
2 parents 3fbf75a + 8ff1243 commit 2ad28c1

File tree

15 files changed

+274
-783
lines changed

15 files changed

+274
-783
lines changed

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ bin/symmetry:
2929
QM: bin/symmetry
3030
echo "Checking you have rdkit..."
3131
python -c 'import rdkit; print rdkit.__file__'
32+
echo "Checking rdkit has InChI support..."
33+
python -c 'from rdkit import Chem; assert Chem.inchi.INCHI_AVAILABLE, "RDKit installed without InChI Support"'
3234

3335
documentation:
3436
$(MAKE) -C documentation html

documentation/source/users/rmg/installation/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Briefly, RMG depends on the following packages:
1313
* **NumPy:** fast matrix operations
1414
* **SciPy:** fast mathematical toolkit
1515
* **matplotlib:** generating plots
16+
* **rdkit:** open-source cheminformatics toolkit
1617
* **guppy:** memory profiling tools
17-
* **OpenBabel:** species format conversion
1818
* **Cython:** compiling Python modules to C
1919
* **quantities:** unit conversion
2020
* **nose:** advanced unit test controls

documentation/source/users/rmg/installation/linux.rst

+37-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
Linux Installation
55
******************
66

7-
RMG-Py and all of its dependencies may be easily installed through a short series of Terminal commands. The instructions listed below have been confirmed on a fresh Ubuntu 12.04 installation and should generally apply to other distributions.
7+
RMG-Py and all of its dependencies may be easily installed through a short series of Terminal commands.
8+
The instructions listed below have been confirmed on a fresh Ubuntu 12.04 installation and should generally apply to other distributions.
89

910
* Install compilers and libraries: ::
1011

@@ -30,15 +31,50 @@ RMG-Py and all of its dependencies may be easily installed through a short serie
3031
cd PyDAS; make F77=gfortran; sudo make install
3132
cd ../PyDQED; make F77=gfortran; sudo make install
3233

34+
* Install RDKit
35+
36+
Full installation instructions: http://code.google.com/p/rdkit/wiki/GettingStarted
37+
Be sure to **build it with InChI support.** Here's a synopsis::
38+
39+
cd ~
40+
sudo apt-get install flex bison build-essential python-numpy cmake python-dev sqlite3 libsqlite3-dev
41+
libboost-dev libboost-python-dev libboost-regex-dev
42+
git clone https://github.com/rdkit/rdkit.git
43+
cd rdkit
44+
export RDBASE=`pwd`
45+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RDBASE/lib
46+
export PYTHONPATH=$PYTHONPATH:$RDBASE
47+
cd External/INCHI-API
48+
./download-inchi.sh
49+
cd ../../
50+
mkdir build
51+
cd build
52+
cmake .. -DRDK_BUILD_INCHI_SUPPORT=ON
53+
make
54+
make install
55+
56+
You'll need various environment variables set (you may want to add these to your `.bash_profile` file), eg.::
57+
58+
export RDBASE=$HOME/rdkit # CHECK THIS (maybe you put RDKit somewhere else)
59+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RDBASE/lib
60+
export PYTHONPATH=$PYTHONPATH:$RDBASE # (or some other way to make sure it's on your Python path)
61+
3362
* Install RMG-Py: ::
3463

3564
cd ~
3665
git clone [email protected]:GreenGroup/RMG-database.git
3766
git clone [email protected]:GreenGroup/RMG-Py.git
67+
sudo pip install -r RMG-Py/requirements.txt
3868
cd RMG-Py; make
3969

4070
* Run an example: ::
4171

4272
python rmg.py examples/rmg/minimal/input.py
4373

4474
Verify your installation by opening the resulting output.html file under the "examples/rmg/minimal" directory.
75+
76+
You can also use the Makefile targets to test and run examples: ::
77+
78+
make test
79+
make eg1
80+
make eg2

documentation/source/users/rmg/installation/macos.rst

+15-8
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ but other methods like the `Scipy Superpack <http://fonnesbeck.github.com/ScipyS
1717
brew update
1818
brew install git
1919

20-
* Install `Open Babel <http://openbabel.org/>`_ and its Python bindings. For now, the easiest way to get version 2.3.1 and the Python bindings is::
21-
22-
brew install https://raw.github.com/rwest/homebrew/open-babel-new/Library/Formula/eigen2.rb
23-
brew install https://raw.github.com/rwest/homebrew/open-babel-new/Library/Formula/open-babel.rb
24-
25-
2620
* Make a directory to put everything in::
2721

2822
mkdir ~/Code
@@ -31,6 +25,7 @@ but other methods like the `Scipy Superpack <http://fonnesbeck.github.com/ScipyS
3125

3226
cd ~/Code
3327
git clone [email protected]:GreenGroup/RMG-database.git
28+
git clone [email protected]:GreenGroup/RMG-Py.git
3429

3530
* Install the Python dependencies listed in the :file:`RMG-Py/requirements.txt` file using `pip` (do ``easy_install pip`` if you don't already have it)::
3631

@@ -66,16 +61,28 @@ but other methods like the `Scipy Superpack <http://fonnesbeck.github.com/ScipyS
6661
cd RMG-Py
6762
make
6863

69-
* Install RDKit, *if* (and only if) you want to use the new 3D geometry branch::
64+
* Install RDKit::
7065

7166
brew uninstall boost
7267
brew install boost --build-from-source
73-
brew tap rwest/homebrew-rdkit
68+
brew tap edc/homebrew-rdkit
7469
brew install rdkit --with-inchi
70+
71+
You'll need various environment variables set, eg.::
72+
73+
export RDBASE=$HOME/rdkit # CHECK THIS (maybe you put RDKit somewhere else)
74+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RDBASE/lib
75+
export PYTHONPATH=$PYTHONPATH:$RDBASE
7576

7677
* Run an example: ::
7778

7879
cd ~/Code/RMG-Py/
7980
python rmg.py examples/rmg/minimal/input.py
8081

8182
Verify your installation by opening the resulting output.html file under the "examples/rmg/minimal" directory.
83+
84+
You can also use the Makefile targets to test and run examples: ::
85+
86+
make test
87+
make eg1
88+
make eg2

documentation/source/users/rmg/installation/windows.rst

+15-1
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,28 @@ Download and run the installers listed below. These builds have been verified as
118118

119119
.. _remainingdependencies:
120120

121+
122+
RDKit
123+
================
124+
125+
Project home on GitHub: https://github.com/rdkit/rdkit
126+
127+
Installation instructions: http://code.google.com/p/rdkit/wiki/GettingStarted
128+
Build it with InChI support.
129+
Required environment variables:
130+
131+
* RDBASE pointing to the root of the distribution
132+
* PYTHONPATH: should include $RDBASE
133+
* PATH: should include $RDBASE/lib
134+
121135
Remaining Dependencies
122136
======================
123137

124138
Install the remaining six python dependencies using 'pip': ::
125139

126140
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
127141
easy_install pip
128-
pip install nose quantities sphinx pydot psutil xlwt cython==0.16
142+
pip install nose quantities sphinx pydot psutil xlwt cython
129143

130144
.. _rmgsources:
131145

examples/rmg/1,3-hexadiene/input.py

+1-20
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,7 @@
1212
species(
1313
label='HXD13',
1414
reactive=True,
15-
structure=CML(
16-
"""
17-
<molecule>
18-
<atomArray>
19-
<atom id="a1" elementType="C" />
20-
<atom id="a2" elementType="C" />
21-
<atom id="a3" elementType="C" />
22-
<atom id="a4" elementType="C" />
23-
<atom id="a5" elementType="C" />
24-
<atom id="a6" elementType="C" />
25-
</atomArray>
26-
<bondArray>
27-
<bond atomRefs2="a1 a2" order="D" />
28-
<bond atomRefs2="a2 a3" order="S" />
29-
<bond atomRefs2="a3 a4" order="D" />
30-
<bond atomRefs2="a4 a5" order="S" />
31-
<bond atomRefs2="a5 a6" order="S" />
32-
</bondArray>
33-
</molecule>
34-
"""),
15+
structure=SMILES("C=CC=CCC"),
3516
)
3617
species(
3718
label='CH4',

rmgpy/data/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ def load(self, path, local_context=None, global_context=None):
176176
provide these.
177177
"""
178178

179-
# Collision efficiencies are in SMILES format, so we'll need OpenBabel
179+
# Collision efficiencies are in SMILES format, so we'll need RDKit
180180
# to convert them to Molecule objects
181181
# Do the import here to ensure it is imported from a pure Python
182182
# environment (as opposed to a Cythonized environment, which is not
183183
# allowed during an exec() call)
184-
import pybel
184+
from rdkit import Chem
185185

186186
# Clear any previously-loaded data
187187
self.entries = {}

0 commit comments

Comments
 (0)