KingsburyLab / pyEQL

A Python library for solution chemistry
Other
65 stars 17 forks source link

Feature: Enable solid-liquid equilibrium via phreeqpython #186

Open rkingsbury opened 6 days ago

rkingsbury commented 6 days ago

phreeqpython contains an equalize method demonstrated in this tutorial that exposes PHREEQC's solid-liquid equilibrium calculations.

A method to access this could be added to Solution. The best way to do so is probably as a keyword argument to equilibrate. For example, one could write

from pyEQL import Solution
s1 = Solution({"Ca+2": "10 mM", "Cl-": "20 mM"})
s1.equilibrate(solids=['Calcite'])

Using the same paradigm, it would be easy to add equilibration with atmospheric gases as another kwarg, e.g.

s1.equilibrate(solids=['Calcite'], gases=['CO2'])

Inside equlibrate, the contents of solids and gases would simply be combined into a single list and passed to equalize of the underlying phreeqpython object (accessible via the s1.engine.pp attribute)