Skip to main content

pyequion

Aqueous equilibrium calculation.

Documentation Status PyPi Version PyPI pyversions Coverage Status Build Status

PyEquIon

A pure python implementation for electrolytes chemical equilibrium.

A simplified version is provided with a web based user interface: https://caiofcm.github.io/pyequion-onl/

Repository: https://github.com/caiofcm/pyequion

Features

  • Pure python package: hence it is easy to install in any platform
  • Calculation of equilibrium of inorganic salts in water solution with precipitation
  • Automatic determination of reactions
  • Provides information as: Ionic Strength, pH, Electric Conductivity and the concentrations of each species as well their activity coefficient
  • A modular approach for the activity coefficient calculation allows the usage of new thermodynamic models
  • Just in time compilation capabilities with numba
  • Automatic differentiation with sympy
  • Code generation for exporting the residual function for a giving system to other environments: suitable for kinetic simulations (e.g python or C)
  • Automatic determination of the mean activity coefficient (often used in comparison with experiments)

Installation

The package can be installed with pip install pyequion or pip install <folder>

Basic Usage

    import pyequion
    sol = pyequion.solve_solution({'NaHCO3': 50, 'CaCl2': 10})
    pyequion.print_solution(sol)
    >> Solution Results:
    >>    pH = 7.86640
    >>    sc = 6602.68061 uS/cm
    >>    I = 73.74077 mmol/L
    >>    DIC = 50.00000 mmol/L
    >> Saturation Index:
    >>    Halite: -4.77905928064043
    >>    Calcite: 2.083610139715626
    >>    Aragonite: 1.9398402923233906
    >>    Vaterite: 1.5171786455013265

Documentation

https://pyequion.readthedocs.io/en/latest/

Running Tests

To run unit tests:

pytest ./tests

To create the test report:

pytest --cov=pyequion ./tests/test_reactions_species_builder.py --cov-report=html

Contributing

The code is formatted with black following flack8 specifications. Run black . to format the code.

Helpers

  • Code can be JIT compiled with numba calling the function: pyequion.jit_compile_functions()
  • When using JIT, running the code in jupyter becomes unstable, prefer regular python script.

Contributors

  • Caio Curitiba Marcellos
  • Gerson Francisco da Silva Junior
  • Elvis do Amaral Soares
  • Fabio Ramos
  • Amaro G. Barreto Jr
  • Danilo Naiff

Folder Structure

.
├── api # Application Programming Interface for web service
├── data # Parameters database file (was replaced by python dictionaries in pyequion/data)
├── docs # Documentation generation (sphinx)
├── LICENSE.md #License file
├── pyequion
│   ├── activity_coefficients.py # Built-in thermodynamic models
│   ├── conductivity.py # Conductivity function
│   ├── core.py # Core functionalities
│   ├── data # Parameters database as python files
│   │   ├── __init__.py
│   │   ├── reactions_solids.py
│   │   ├── reactions_solutions.py
│   │   └── species.py
│   ├── __init__.py # Auxiliary
│   ├── jit_helper.py # Auxiliary
│   ├── PengRobinson.py # EOS for pure gas
│   ├── pitzer.py # Pitzer model
│   ├── properties_utils.py # Auxiliary
│   ├── pyequion.py # Application Programming Interface for python call
│   ├── reactions_species_builder.py # Creation of equilibrium system
│   ├── read_from_phreeqc_db.py # Auxiliary
│   ├── symbolic_computations.py # Symbolic Computation with sympy
│   ├── utils_api.py # Auxiliary
│   ├── utils_for_numba.py # Auxiliary
│   ├── utils.py # Auxiliary
│   └── wateractivity.py # Auxiliary for water activity in pitzer
├── pyproject.toml #Linting configuration
├── README.md # General guide
├── requirements-dev.txt # Development Requirements
├── requirements.txt # Main Requirements
├── samples #Some samples using pyequion
├── setup.py #Installation file
└── tests # Automatic Unit tests folder (pytest based)

Metadata

Release files for pyequion 0.0.5.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyequion 0.0.5.5
File Size Uploaded Provenance Actions
pyequion-0.0.5.5.tar.gz 425.0 kB Without provenance Details for pyequion-0.0.5.5.tar.gz

Release files / pyequion-0.0.5.5.tar.gz

Download URL pyequion-0.0.5.5.tar.gz
Size 425.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ab4fa22de00d73b68993b9f1c9d672ba5fec7c731a5c0bd98e1a23b68cc6fa20
BLAKE2b-256 checksum
How to use checksums
569b33a51603614c06c141477efa5c524beb4d56302161e8dd94960463c659d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/0.18 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.3

Security for pyequion 0.0.5.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page