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

Initial guess length mismatch when eps_a is of type list #3

Open
Andrew-S-Rosen opened this issue Jun 22, 2022 · 2 comments
Open

Initial guess length mismatch when eps_a is of type list #3

Andrew-S-Rosen opened this issue Jun 22, 2022 · 2 comments

Comments

@Andrew-S-Rosen
Copy link

Andrew-S-Rosen commented Jun 22, 2022

When running run_model.py, I get the following traceback. It seems to be that the initial guess list has length 5, but when this is unpacked in CatChemi, it's expecting a length of 3. Changing EPS_A_VALUES to a List[float] rather than List[List[float]] resolves the issue, so it's just related to when one wants to use multiple values for eps_a for a given adsorbate.

Fitting parameters for adsorbate ['CO'] with eps_a [[-7, 2.5]]
Fitting parameters for adsorbate CO with eps_a [-7, 2.5]
Initial guess:  [0.01, 0.01, 1.8849555921538759, 1.8849555921538759, 0.1, 0.1]
Traceback (most recent call last):
  File "run_model.py", line 176, in <module>
    fitting_odr = odr.ODR(data, fitting_model, initial_guess)
  File "/home/arosen/anaconda3/envs/na/lib/python3.8/site-packages/scipy/odr/_odrpack.py", line 784, in __init__
    self._check()
  File "/home/arosen/anaconda3/envs/na/lib/python3.8/site-packages/scipy/odr/_odrpack.py", line 845, in _check
    res = self.model.fcn(*arglist)
  File "/home/arosen/anaconda3/envs/na/lib/python3.8/site-packages/catchemi/NewnsAndersonRepulsion.py", line 72, in fit_parameters
    alpha, beta, constant_offset = args
ValueError: too many values to unpack (expected 3)
@sudarshanv01
Copy link
Owner

Hi @arosen93 ! My guess is that the error comes from the fact that I updated CatChemi over the weekend sometime with the commits that allow running adsorbates like CO, with two different $\epsilon_a$ values. If you pulled the latest version of CatChemi does it work?

For reference here are the CO parameters I get:

{"alpha": [2.1901565682765116, 0.030158212016204583], "beta": [0.10287271431680009, 8.475571101032806], "delta0": 0.1, "constant_offset": [2.8384770534608363, 2.7340421739193794], "eps_a": [-7, 2.5]

@Andrew-S-Rosen
Copy link
Author

Hi @sudarshanv01! Odd! Yup, I just tried again and git clone'd the current main branch of CatChemi but still get the ValueError: too many values to unpack. This is with just doing python run_model.py for clarity. If it seems like this shouldn't be happening in the main branch, we can chat in person about it too.

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