Closed xiaoxiaozhu123 closed 6 months ago
Hi @xiaoxiaozhu123 , thank you for reporting! The TODO comment is related, and now that pymatgen has been updated the first part of the if
statement can probably be removed. (see https://github.com/materialsproject/pymatgen/issues/3324)
However, I think there may still be a separate issue here (e.g., what happens when we cannot get an oxi state guess?).
I ran your code snippet and am able to equiilbrate
the solution; it's only when trying to get the conductivity that the error occurs (as you noted). To troubleshoot further, I called [k for k,v in s.components.items()]
to get the names of all the solutes, which are
['H2O(aq)', 'Br[-1]', 'Na[+1]', 'NaBr(aq)', 'H[+1]', 'OH[-1]', 'NaOH(aq)', 'O2(aq)', 'HBrO(aq)', 'BrO[-1]', 'Br(aq)', 'Br[-0.33333333]', 'H2(aq)', 'BrO3[-1]', 'BrO4[-1]']
The next steps would be 1) to figure out which of these solutes fails when you call oxi_state_guesses()
on it and 2) develop a fix for pyEQL
so that Solute.from_formula
returns correctly even if oxi_state_guesses fails
I can work on these but I can't promise a fast turnaround; I'd welcome any assistance you're comfortable providing!
I encountered an IndexError when attempting to calculate conductivity of solutions from the pyEQL library. The error occurs in the Solute.from_formula method.
my script for test:
An exception occured:
Environment:
pyEQL Version: 0.12.0 pymatgen Version: 2024.2.8 Python Version: 3.11 Operating System: MacOS 14.0 (23A344)
It seems that the problem lies with the if-else statement, Line 121-124, solute.py.
When pmg_ion.oxi_state_guesses fails to get any oxidate state of the element, it returns an empty tuple rather than a empty list. So I guess the if statement should be
I am new to this project and I noticed the the TODO comment above. Are these issue relavant?