[MMTK] serializing normal modes across MMTK versions

Edvin Fuglebakk edvin.fuglebakk at ii.uib.no
Wed Oct 5 11:17:48 UTC 2011

Thanks to both Ramon and Konrad.

The MMTK.load function has the benefit of loading a full-fledged modes-object (and the associated universe-object), so it will really like to get it working, rather than using Ramons approach which I suppose will only provide me with the eigenvectors and eigenvalues upon loading on a different platform.

I tried saving a NormalModes-object with MMTK 2.5.24 under Python 2.5.2 (numpy 1.1.1) and loading this with MMTK 2.7.4 under Python 2.5.6 (numpy 1.6.1). Neither of the Python environments have Numeric installed. I got the following error:

>>> MMTK.load("1a6m_python2.5.2_MMTK2.5.24.modes")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/lib/python2.5/site-packages/MMTK/Utility.py", line 280, in load
    obj = Unpickler(file).load()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/pickle.py", line 858, in load
  File "/opt/local/lib/python2.5/site-packages/MMTK/Utility.py", line 248, in load_inst
    raise UnpicklingError('%s is not safe for unpickling' %
NameError: global name 'UnpicklingError' is not defined

A similar error

I have also tested saving and loading modes in a few other versions (newer pythons and newer MMTKs) which work the way Konrad describes, so maybe it is the MMTK 2.5.24 serializing (pickling and unpicking) that is not consistent with later releases. Has there been any fixes to load and save after this release ?


On 5. okt. 2011, at 09:54, Konrad Hinsen wrote:

> On 4 oct. 11, at 13:37, Edvin Fuglebakk wrote:
>> I would like to communicate serialized normal modes (calculated with MMTK) between computational environments, with possibly different versions of python and MMTK. Is there are recommended way for doing this. The MMTK.save and MMTK.load function seems to be sensitive to the python / MMTK configuration.
> I didn't try, but in theory, MMTK.load/save (which end up using Python's pickle module) should be portable between environments as long as all machines use NumPy rather than the old Numeric. With Numeric, the formats were different between 32-bit and 64-bit machines, but also portable within each category. Serialized arrays are never exchangeable between Numeric and NumPy.
> One more reason to switch to NumPy for those who didn't make the transition yet!
> Konrad.
> --
> ---------------------------------------------------------------------
> Konrad Hinsen
> Centre de Biophysique Moléculaire, CNRS Orléans
> Synchrotron Soleil - Division Expériences
> Saint Aubin - BP 48
> 91192 Gif sur Yvette Cedex, France
> Tel. +33-1 69 35 97 15
> E-Mail: research at  khinsen dot fastmail dot net
> ---------------------------------------------------------------------

More information about the mmtk mailing list