Skip to content

Commit d323606

Browse files
authored
Merge pull request #344 from SuixiongTay/update_docstring_to_sol_equi
Update `Solution.equilibrate()`'s docstring with `NativeEOS.equilibrate()` docstring
2 parents 7428217 + 541c6db commit d323606

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

src/pyEQL/solution.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,16 +1690,37 @@ def get_salt_dict(self, cutoff: float = 1e-6, use_totals: bool = True) -> dict[s
16901690

16911691
return dict(sorted(salt_dict.items(), key=lambda x: x[1]["mol"], reverse=True))
16921692

1693-
def equilibrate(self, **kwargs) -> None:
1694-
"""
1695-
Update the composition of the Solution using the thermodynamic engine.
1696-
1697-
Any kwargs specified are passed through to self.engine.equilibrate()
1698-
1699-
Returns:
1700-
Nothing. The .components attribute of the Solution is updated.
1693+
def equilibrate(
1694+
self,
1695+
atmosphere: bool = False,
1696+
solids: list[str] | None = None,
1697+
gases: dict[str, str | float] | None = None,
1698+
**kwargs,
1699+
) -> None:
17011700
"""
1702-
self.engine.equilibrate(self, **kwargs)
1701+
This method follows the equilibrate logic used in the NativeEOS engine, adapted as the default behavior for this class.
1702+
1703+
Adjust the speciation of a Solution object to achieve chemical equilibrium.
1704+
1705+
Keyword Args:
1706+
atmosphere:
1707+
Boolean indicating whether to equilibrate the solution
1708+
w.r.t atmospheric gases.
1709+
solids:
1710+
A list of solids used to achieve liquid-solid equilibrium. Each
1711+
solid in this list should be present in the Phreeqc database.
1712+
We assume a target saturation index of 0 and an infinite
1713+
amount of material.
1714+
gases:
1715+
A dictionary of gases used to achieve liquid-gas equilibrium.
1716+
Each key denotes the gas species, and the corresponding value
1717+
denotes its concentration, as a log partial pressure value or
1718+
other interpretable pressure units. For example, the following
1719+
are equivalent (log10(0.000316) = -3.5)
1720+
{"CO2": "0.000316 atm"}
1721+
{"CO2": -3.5}
1722+
"""
1723+
self.engine.equilibrate(self, atmosphere=atmosphere, solids=solids, gases=gases, **kwargs)
17031724

17041725
# Activity-related methods
17051726
def get_activity_coefficient(

0 commit comments

Comments
 (0)