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

Br(None) species - oxidation state error #116

Closed
jaichanders opened this issue Mar 13, 2024 · 4 comments · Fixed by #117
Closed

Br(None) species - oxidation state error #116

jaichanders opened this issue Mar 13, 2024 · 4 comments · Fixed by #117
Labels
fix Bug Fixes

Comments

@jaichanders
Copy link

I get the following error when attempting to calculate activities after speciation of solutions containing Bromide:

File ...\lib\site-packages\pyEQL\solution.py:1147 in get_total_amount
ox = float(element.split("(")[-1].split(")")[0])
ValueError: could not convert string to float: 'None'

The species ['Br (aq)'] with the key 'Br(None)' seems to be responsible.

If I manually override this step by changing the key to Br(0) in debug mode, I get the following error from a few lines below

TypeError: argument of type 'NoneType' is not iterable

The minimum code for reproduction is:

from pyEQL import Solution

s = Solution({'Na+':'0.5 mol/kg','Br-':'0.5 mol/kg'}, pH=7, balance_charge='Br-')
s.equilibrate()
act = s.list_activities()

Though this is related to issue #60 (speciation followed by activity calculation), that one seems to be about the theoretical implications of using different models for speciation and activity calculation. Hence, I have opened a separate issue.

@rkingsbury
Copy link
Member

Thank you for reporting and for trying to troubleshoot @jaichanders ! I think this will be straightforward to address. Just to confirm, are you using the latest version (0.14.0)?

@rkingsbury rkingsbury added the fix Bug Fixes label Mar 13, 2024
@jaichanders
Copy link
Author

Yes, METADATA says Version: 0.14.0. Thank you for the quick response!

@rkingsbury
Copy link
Member

This is partly related to a recent change #106 and ultimately due to a bug in the underlying pymatgen package. See
materialsproject/pymatgen#3687

@rkingsbury
Copy link
Member

Fixed as of v0.15.0, which I've just uploaded to PyPI

Also FYI, list_activities has been deprecated from some time, and will be removed soon. I suggest using print or a list comprehension instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug Fixes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants