mhoffman / kmos

kMC on steroids: A vigorous attempt to make lattice kinetic Monte Carlo modelling easier
http://mhoffman.github.com/kmos/
GNU General Public License v3.0
53 stars 35 forks source link

error with kmos view command #58

Closed Abel-Ding closed 7 years ago

Abel-Ding commented 7 years ago

Expected behavior

run thekMC model about CO adsorption and desorption according to the tutorials: A first kMC Model- the API way (http://kmos.readthedocs.io/en/latest/tutorials/index.html)

Actual behavior

I installed the kmos and the dependencies on ubuntu 16.04, and learn the tutorials "A first kMC Model-the API way"

while, after I export the xml, and try to view the model, it rised an TypeError, the error info is shown as followed:

abel@Abel:~/CL-SMR-KMC/kmos-learn/myfirst_kmc_local_smart$ kmos view
Traceback (most recent call last):
  File "/usr/local/bin/kmos", line 21, in <module>
    main()
  File "/home/abel/.local/lib/python2.7/site-packages/kmos/cli.py", line 426, in main
    view.main(steps_per_frame=options.steps_per_frame)
  File "/home/abel/.local/lib/python2.7/site-packages/kmos/view.py", line 452, in main
    viewer = KMC_Viewer(model, steps_per_frame=steps_per_frame)
  File "/home/abel/.local/lib/python2.7/site-packages/kmos/view.py", line 398, in __init__
    self.vbox, self.window)
  File "/home/abel/.local/lib/python2.7/site-packages/kmos/view.py", line 174, in __init__
    View.__init__(self, self.vbox, rotations)
TypeError: __init__() takes exactly 2 arguments (3 given)

It seems to be related to the ase.view, but I don't know how to deal with it. How could I fix this problem? Did I do something wrong in installation? Looking forward to your solution and suggestion.

abel@Abel:~/CL-SMR-KMC/kmos-learn/myfirst_kmc_local_smart$ kmos view
Traceback (most recent call last):
  File "/usr/local/bin/kmos", line 21, in <module>
    main()
  File "/home/abel/.local/lib/python2.7/site-packages/kmos/cli.py", line 426, in main
    view.main(steps_per_frame=options.steps_per_frame)
  File "/home/abel/.local/lib/python2.7/site-packages/kmos/view.py", line 452, in main
    viewer = KMC_Viewer(model, steps_per_frame=steps_per_frame)
  File "/home/abel/.local/lib/python2.7/site-packages/kmos/view.py", line 398, in __init__
    self.vbox, self.window)
  File "/home/abel/.local/lib/python2.7/site-packages/kmos/view.py", line 174, in __init__
    View.__init__(self, self.vbox, rotations)
TypeError: __init__() takes exactly 2 arguments (3 given)

Steps to reproduce the issue

1. 2. 3.

System information

gfortran version (4:5.3.1-1ubuntu1).
python-dev iversion (2.7.11-1).
python-glade2 version (2.24.0-4ubuntu1).
python-lxml version (3.5.0-1build1).
python-numpy version (1:1.11.0-1ubuntu1).
python-kiwi version (1.9.22-4).
python-matplotlib version (1.5.1-1ubuntu1).
python-pygoocanvas version (0.14.1-1.1ubuntu1).
gazpacho version (0.7.2-3).

abel@Abel:~/CL-SMR-KMC/kmos-learn/myfirst_kmc_local_smart$ ase info
platform        Linux-4.4.0-21-generic-x86_64-with-Ubuntu-16.04-xenial
python-2.7.12   /usr/bin/python
ase-3.15.0b1    /usr/local/lib/python2.7/dist-packages/ase-3.15.0b1-py2.7.egg/ase/
numpy-1.11.0    /usr/lib/python2.7/dist-packages/numpy/
scipy-0.17.0    /usr/lib/python2.7/dist-packages/scipy/
jmlorenzi commented 7 years ago

I took a quick look and it looks like somewhere between ase version 3.12.0b1 (the one I happen to have in my workstation) and the current version, they changed the signature for ase.gui.view.View from

def __init__(self, vbox, rotations): to def __init__(self, rotations):

Sadly, I am not familiar with how this class works on ase and/or the significance of the vbox parameter for kmos. If you need to use the viewer as soon as possible, I would recommend reverting to and older ase version for now.

An alternative quick hack that could work, but is definitely not guarranteed to is to change View.__init__(self, self.vbox, rotations) to View.__init__(self, rotations). If you test this and works, you could then wrap this line in a try-except block, that calls the function without the vbox arguments in case of an exception.

However, I doubt this will work. I guess @mhoffman should be able to come up with an estimate on how difficult implementing support for this newer ase version would be.

Hope this helps, Juan

Abel-Ding commented 7 years ago

Thank you for your suggestion, I will try as you said and response to you as soon as possible.

Have a nice day,

DING Haoran