rmcgibbo / openmm-cmd

OpenMM Command Line Application
7 stars 3 forks source link

Mysterious bug when reading restart file. #6

Closed leeping closed 11 years ago

leeping commented 11 years ago

Hi Robert,

I can't figure out why the cPickle.load() function expects four input arguments. The documentation is turning up nothing.

Traceback (most recent call last):
  File "/home/leeping/local/bin/openmm", line 5, in <module>
    pkg_resources.run_script('openmm-cmd==0.1', 'openmm')
  File "/home/leeping/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 489, in run_script
  File "/home/leeping/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1207, in run_script
  File "/home/leeping/local/lib/python2.7/site-packages/openmm_cmd-0.1-py2.7.egg/EGG-INFO/scripts/openmm", line 964, in <module>
    openmm.start()
  File "/home/leeping/local/lib/python2.7/site-packages/openmm_cmd-0.1-py2.7.egg/EGG-INFO/scripts/openmm", line 773, in start
    loadRestartFile(simulation, self.simulation.restart_file)
  File "/home/leeping/local/lib/python2.7/site-packages/openmm_cmd-0.1-py2.7.egg/ipcfg/restartreporter.py", line 212, in loadRestartFile
    data = pickle.load(f)
TypeError: __new__() takes exactly 4 arguments (2 given)
leeping commented 11 years ago

Locally I changed to json instead of pickle. It seems to work well, plus it may have other advantages such as cross-platform compatibility. Let me know what you think.

rmcgibbo commented 11 years ago

I fixed this bug in OpenMM pr #69.  Have you updated?

-Robert Sent from my iPhone.

On Fri, Aug 9, 2013 at 2:24 PM, Lee-Ping notifications@github.com wrote:

Locally I changed to json instead of pickle. It seems to work well, plus it may have other advantages such as cross-platform compatibility. Let me know what you think.

Reply to this email directly or view it on GitHub: https://github.com/rmcgibbo/openmm-cmd/issues/6#issuecomment-22424147

leeping commented 11 years ago

Thank you. I needed to update. Should we stay with pickle or switch to json? I'm fine either way.

rmcgibbo commented 11 years ago

Can you check the size difference between the two types of files for the same system? I don't see anything wrong with json, but it is ASCII and I think pickle2 is binary.

-Robert Sent from my iPhone.

On Fri, Aug 9, 2013 at 4:17 PM, Lee-Ping notifications@github.com wrote:

Thank you. I needed to update. Should we stay with pickle or switch to json? I'm fine either way.

Reply to this email directly or view it on GitHub: https://github.com/rmcgibbo/openmm-cmd/issues/6#issuecomment-22428650

leeping commented 11 years ago

It looks like the json-generated file is a bit bigger than the pickle, but just by a little bit. I may have been influenced by the people on the #python IRC chat channel who consistently dislike pickle for having low cross-platform compatibility, having security vulnerabilities and whatnot. I don't have a particularly strong preference, but if you think json seems like a decent option, we can try it out.

leeping@leeping:~/temp/openmm-cmd-examples/04-ExamplePDB-Restart$ ls restart* -ltra
-rw-rw-r-- 1 leeping leeping 1111432 2013-08-09 14:30 restart.json
-rw-rw-r-- 1 leeping leeping  762148 2013-08-09 16:32 restart.p
rmcgibbo commented 11 years ago

we switched to the json config file, so this is no longer an issue anyways.