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

a possible bug in hb2skf.py #32

Open
GengSS opened this issue May 10, 2022 · 2 comments
Open

a possible bug in hb2skf.py #32

GengSS opened this issue May 10, 2022 · 2 comments

Comments

@GengSS
Copy link

GengSS commented May 10, 2022

Hi
I am using the hb2skf.py code to convert the hotbit parameter to the skf file.
Here is the procedure:
1. I went to the example folder AuAu_parametrization
2. I renamed the Au_Au_repulsion.par file to Au_Au.par
3. then I copied the hb2skf.py from the source code to the current example folder AuAu_parametrization
4. run the python code by 'python hb2skf.py Au Au'

Then I encountered an error like this:

Fitting a spline basis function in the range between 0.494382851691 and 0.594382851691
DEBUG  t=[0.49438285 0.51438285 0.53438285 0.55438285 0.57438285 0.59438285]

DEBUG  start=0.494382851691
Traceback (most recent call last):
  File "hb2skf.py", line 276, in <module>
    generate_DFTBplus_repulsion(tmp,
  File "hb2skf.py", line 129, in generate_DFTBplus_repulsion
    splParams, fitCovariances = curve_fit(splinefit, [t, start], data)
  File "/u/home/g/gengsun/anaconda3/lib/python3.8/site-packages/scipy/optimize/minpack.py", line 742, in curve_fit
    xdata = np.asarray_chkfinite(xdata, float)
  File "/u/home/g/gengsun/anaconda3/lib/python3.8/site-packages/numpy/lib/function_base.py", line 486, in asarray_chkfinite
    a = asarray(a, dtype=dtype, order=order)
  File "/u/home/g/gengsun/anaconda3/lib/python3.8/site-packages/numpy/core/_asarray.py", line 102, in asarray
    return array(a, dtype, copy=False, order=order)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.

In which, I modified the hb2skf.py to print the two lines starting with DEBUG.
It seems that the curve_fit function complains about the input [t, start]. 't' is a numpy array, but 'start' is a float. This is a little bit strange to me.
Is there anything wrong in my usage of the code? or is this a bug?

Thanks.
Best,

Geng

@pekkosk
Copy link
Owner

pekkosk commented May 10, 2022

It's a bug. But have you used the newest version of the script? It ought to be fixed there.

@GengSS
Copy link
Author

GengSS commented May 10, 2022

Hi pekkosk,
Thank you for your comments,
Indeed, I used the old code. The newest version works smoothly.
Best,
Geng

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