Currently, it is possible to specify pH by including H+ in the composition dictionary:
>>> initial_conditions = {
'HCO3-': 1.0e-3,
'CO3--': 1.0e-4,
'H+': 1.0e-7 # Note: instead of including H+ here, you could use the pH keyword argument
}
>>> Solution(initial_conditions).pH
4.00
However, this overrides whatever is specified in the pH keyword argument, which is the intended way to set the pH:
>>> Solution(initial_conditions, pH=10).pH
4.000
I think it's OK that the composition dictionary overrides the pH keyword argument, but there should be a warning raised when this happens (at a minimum). Also, I think if a user specifies a non-default pH AND has H+ in their composition dictionary, there should probably be a ValueError since the user's intent is not clear in that case.
Currently, it is possible to specify pH by including
H+
in the composition dictionary:However, this overrides whatever is specified in the
pH
keyword argument, which is the intended way to set thepH
:I think it's OK that the composition dictionary overrides the
pH
keyword argument, but there should be a warning raised when this happens (at a minimum). Also, I think if a user specifies a non-defaultpH
AND hasH+
in their composition dictionary, there should probably be aValueError
since the user's intent is not clear in that case.This should be fixed in
Solution.__init__
here .