ReactionMechanismGenerator / RMG-Py

Python version of the amazing Reaction Mechanism Generator (RMG).
http://reactionmechanismgenerator.github.io/RMG-Py/
Other
382 stars 226 forks source link

Testing with Gaussian #678

Closed andreeleuterio closed 6 years ago

andreeleuterio commented 8 years ago

Hi, I am trying to run the tests on examples/, but I am running into the following error: Traceback (most recent call last): File "/path/rmg.py", line 41, in <module> from rmgpy.rmg.main import RMG, initializeLog, processProfileStats, makeProfileGraph File "/path/main.py", line 65, in <module> from rmgpy.qm.main import QMDatabaseWriter File "/path/main.py", line 34, in <module> import rmgpy.qm.mopac File "/path/mopac.py", line 3, in <module> import external.cclib as cclib ImportError: No module named external.cclib

I am using Gaussian instead of MOPAC. On the 1,3-hexadiene I changed line 71 to software='gaussian', but I still get the error. It seems that it tries to load mopac although I set it to gaussian. What other configuration am I missing? Thank you in advance, André Eleuterio

connie commented 8 years ago

Hi Andre,

What you have is not a MOPAC loading error. It is an import error for the external.cclib python module. cclib (https://cclib.github.io/) is used to parse logs from computational chemistry software.

It looks to me to be a PYTHONPATH problem. Can I ask how you have your RMG installed? Is it through anaconda? Could you copy and paste the output from the following commands?

conda list echo $PYTHONPATH

andreeleuterio commented 8 years ago

Hi Connie, Our environment isn't conencted to the internet so I installed the dependencies from source. I have cclib installed and on my PYTHONPATH, I can load it from a python shell with >>>import cclib

connie commented 8 years ago

You should not have to install it separately. It is located in the base RMG-Py/external/cclib folder. https://github.com/ReactionMechanismGenerator/RMG-Py/tree/master/external and does not need to be compiled.

Is RMG-Py folder on your PYTHONPATH? If so the external.cclib import should work.....

rwest commented 8 years ago

Also note that the cclib bundled with RMG in the module external.cclib is not quite the same as the official cclib from https://cclib.github.io/. (We ought to get our changes merged upstream and use the official, but we have not yet.)

@aeleuterio please could you explain in more detail how you installed RMG? It might be that our setup.py script is such that install puts rmgpy module into the python site packages but not the external module, and we can improve things (or at least improve our instructions).

But in the mean time Connie is right - ensuring the RMG-Py folder is on your PYTHONPATH so that import external.cclib works should solve things.

andreeleuterio commented 8 years ago

@rwest I went through the dependencies list found here. I compiled all of them from source in a specific folder that I created for the RM-Py installation. I wrote a script that would add every dependencie's bin folder to my PATH and lib/python2.7/... folder to my PYTHONPATH. Libraries are added to LD_LIBRARY_PATH. For all python installations, I used python setup.py install --prefix=install-folder The external module was not installed to install-folder with the command above.

@connie it worked for the minimal test, but for diesel, I got the following error:

Traceback (most recent call last):

  File "/home/tmp/rmgpy/rmgpy/1.0.4/bin/rmg.py", line 165, in <module>
    rmg.execute(inputFile, output_dir, **kwargs)

  File "/home/tmp/rmgpy/RMG-Py-1.0.4/rmgpy/rmg/main.py", line 539, in execute
    bimolecularReact=self.bimolecularReact)

  File "/home/tmp/rmgpy/RMG-Py-1.0.4/rmgpy/rmg/model.py", line 747, in enlarge
    self.processNewReactions(self.react(database, self.core.species[i]), self.core.species[i], None)

  File "/home/tmp/rmgpy/RMG-Py-1.0.4/rmgpy/rmg/model.py", line 648, in react
    reactionList.extend(database.kinetics.generateReactionsFromFamilies([moleculeA], products=None, only_families=only_families))

  File "/home/tmp/rmgpy/RMG-Py-1.0.4/rmgpy/data/kinetics/database.py", line 419, in generateReactionsFromFamilies
    reactionList.extend(family.generateReactions(reactants))

  File "/home/tmp/rmgpy/RMG-Py-1.0.4/rmgpy/data/kinetics/family.py", line 1341, in generateReactions
    reactionList.extend(self.__generateReactions(reactants, forward=False))

  File "/home/tmp/rmgpy/RMG-Py-1.0.4/rmgpy/data/kinetics/family.py", line 1571, in __generateReactions
    reaction.degeneracy = self.calculateDegeneracy(reaction)

  File "/home/tmp/rmgpy/RMG-Py-1.0.4/rmgpy/data/kinetics/family.py", line 1369, in calculateDegeneracy

    but generated {2}').format(reaction, self.label, len(reactions)))
rmgpy.data.kinetics.common.KineticsError: Unable to calculate degeneracy for reaction <Molecule "CC12C3=CC1C=CC31C=CC12"> <=> <Molecule "CC1=CC=CC2=CC=CC=C12"> in reaction family Intra_Diels_alder. Expected 1 reaction but generated 2

Thank you for your help

connie commented 8 years ago

So does this mean your external.cclib problem is fixed?

The error you have for the diesel example is a chemistry / database problem, and not a code issue.