Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't load restart - pickling problems? #114

Closed
rwest opened this issue Apr 21, 2013 · 4 comments
Closed

Can't load restart - pickling problems? #114

rwest opened this issue Apr 21, 2013 · 4 comments

Comments

@rwest
Copy link
Member

rwest commented Apr 21, 2013

I am getting this when I try to restart the methylformate example:

  File "/nics/d/home/rwest/Code/RMG-Py/rmgpy/rmg/main.py", line 291, in initialize
    self.loadRestartFile(os.path.join(self.outputDirectory,'restart.pkl'))
  File "/nics/d/home/rwest/Code/RMG-Py/rmgpy/rmg/main.py", line 589, in loadRestartFile
    self.reactionModel = cPickle.load(f)
  File "quantity.py", line 275, in rmgpy.quantity.ArrayQuantity.__init__ (build/pyrex/rmgpy/quantity.c:4503)
rmgpy.quantity.QuantityError: (QuantityError('Dimension 0 has 7 elements for the given value, but 3 elements for the given uncertainty.',), <type 'rmgpy.quantity.ArrayQuantity'>, (array([  750.        ,   770.        ,  3400.        ,  2100.        ,
         647.28325342,   647.28380352,  3592.16637415]), 'cm^-1', array([ 0.,  0.,  0.]), '+|-'))

I'm not sure what the offending object is, but it's something with units of cm^-1. I'm guessing vibrational frequencies (first four integer ones from Franklin's groups, last 3 floats from fitting to the Cp). Not sure why it only has 3 uncertainties (that are all zero!).

Do we have a unit test on pickling and unpickling of frequencies?

@rwest
Copy link
Member Author

rwest commented Apr 21, 2013

I think this particular problem is addressed by d8b38a0
(When the extra frequencies were being estimated, the frequencies' value_si array was extended but its uncertainty array was not).
But so far nothing has been done to check for other errors of this type (eg. a check on set for value or value_si)

@rwest
Copy link
Member Author

rwest commented Apr 21, 2013

The above commit does indeed solve the loading from restart problem, but now immediately after loading we fail to save the HTML output:

Loading previous restart file...
Saving current model to HTML file...

Stack trace:

  File "/nics/d/home/rwest/Code/RMG-Py/rmgpy/rmg/main.py", line 361, in execute
    self.saveEverything()
  File "/nics/d/home/rwest/Code/RMG-Py/rmgpy/rmg/main.py", line 517, in saveEverything
    self.saveOutputHTML()
  File "/nics/d/home/rwest/Code/RMG-Py/rmgpy/rmg/main.py", line 658, in saveOutputHTML
    saveOutputHTML(os.path.join(self.outputDirectory, 'output.html'), self.reactionModel)
  File "/nics/d/home/rwest/Code/RMG-Py/rmgpy/rmg/output.py", line 113, in saveOutputHTML
    family = rxn.getSource().label
AttributeError: 'rmgpy.reaction.Reaction' object has no attribute 'getSource'

Seems we can't save reactions that came from a restart? Is the source being pickled correctly?

@jwallen
Copy link
Contributor

jwallen commented Apr 21, 2013

The source depends on the type of reaction being saved. I think in this case it's rmgpy.rmg.pdep.PDepReaction that is the issue; it is missing a specialized __reduce__() method, so it's using the one from the base class, which doesn't know how to save the source.

@rwest
Copy link
Member Author

rwest commented Apr 21, 2013

Thanks. Fixed in 60ed251.

..although a unit test would be nice.

rwest added a commit that referenced this issue May 2, 2013
If you manipulate an ArrayQuantity.value_si array without also
changing the uncertainty array then you can end up with arrays
of different sizes, which causes a problem when you pickle them
and unpickle them (eg. write and load a restart file).

Hopefully addresses #114
@rwest rwest closed this as completed in 60ed251 May 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants