<jupyter_start><jupyter_text>Calcite dissolution as a function of CO2 pressurehttp://hydrochemistry.eu/exmpls/calcite.html<jupyter_code>%pylab inline
import phreeqpython
pp = phreeqpython.PhreeqPython(database='phreeqc.dat')<jupyter_output>Populating the interactive namespace from numpy and matplotlib<jupyter_text>PhreeqPython Calculation<jupyter_code># add solutions
solution0 = pp.add_solution({}) # empty solution
solution1 = pp.add_solution({}).equalize(['Calcite', 'CO2(g)'], [0, -1.7])
solution2 = pp.add_solution({}).equalize(['Calcite', 'CO2(g)'], [0, -3.5])
# create a mixture of solution 1 and 2
solution3 = solution1*0.5 + solution2*0.5

x = []
y = []

for i in range(30):
    solution0.add('CO2', 3.5/30)
    solution0.saturate('Calcite')    
    x.append(solution0.sr('CO2(g)')*100)
    y.append(solution0.total_element('Ca'))<jupyter_output><empty_output><jupyter_text>Plotting the results<jupyter_code>plt.figure(figsize=[7,7])
plt.plot(x,y, 'rs-', label='equilibrium')
plt.plot([solution1.sr('CO2(g)')*1e2, solution2.sr('CO2(g)')*1e2], [solution1.total_element('Ca'),solution2.total_element('Ca')], '-gx', label='mixing_line')
plt.plot(solution3.sr('CO2(g)')*1e2, solution3.total_element('Ca'), '-b^', label='1:1')
plt.xlim([0,3])
plt.ylim([0,3])
plt.grid()
plt.legend()
plt.title('Calcite Equilibrium')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19022945965951146, 'fraction_numerical': 0.043671354552183565, 'mean_word_length': 7.556962025316456, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '562720', 'license': 'Apache-2.0', 'n_tokens_mistral': 573, 'n_tokens_neox': 528, 'n_words': 79, 'path': 'examples/2. Equilibrium Reactions/2. Calcite Dissolution.ipynb', 'repo_name': 'pwn-smart-tech-team/phreeqpython', 'size': '1351'}