<jupyter_start><jupyter_text>This is a case-study for the API and not yet a ready demo.<jupyter_code>from __future__ import print_function, division
from collections import defaultdict
from chempy import Species, Equilibrium, Henry
from chempy.equilibria import EqSystem
from chempy.units import default_units as u
species_keys = '<KEY> H2O H2CO3 H+ HCO3- CO3-2 Ca+2 CaCO3(s)'.split()
eq_str = """
CO2(aq) = CO2(g); chempy.henry.HenryWithUnits(3.3e-4 * molar / Pa, 2400 * K)
CO2(aq) + H2O = H2CO3; 1.7e-3/55.4
H2CO3 = H+ + HCO3-; 10**-3.6
HCO3- = H+ + CO3-2; 10**-10.329
CaCO3(s) = Ca+2 + CO3-2; 3.3e-9
"""  # eventually: 55.4 <- [H2O]
species = [Species.from_formula(s) for s in species_keys]
reactions = [Equilibrium.from_string(s, species_keys) for s in eq_str.split('\n')[1:-1]]
print('\n'.join(map(str , reactions)))
#init_conc = defaultdict(lambda: 0*u.molar, {'H2O': 55.5*u.molar, 'CO2(g)': 1*u.atm})
#eqsys = EqSystem(reactions, species)
#eqsys

# Before this works, mass conservation equations must be adjusted to deal with an "inifinte" amount of gas:
#eqsys.root(init_conc, state=298.15*u.K)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15547703180212014, 'fraction_numerical': 0.060954063604240286, 'mean_word_length': 5.091397849462366, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '90149', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 500, 'n_tokens_neox': 468, 'n_words': 118, 'path': 'examples/_carbon_dioxide.ipynb', 'repo_name': 'matecsaj/chempy', 'size': '1141'}