Skip to content

Commit

Permalink
Merge branch 'release-0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan S. Kingsbury authored and Ryan S. Kingsbury committed Jan 16, 2016
2 parents fed9321 + 59368b5 commit e715ead
Show file tree
Hide file tree
Showing 30 changed files with 2,150 additions and 206 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
pyEQL Changelog
===============

0.3.0 (2015-01-15)
------------------

- Add method to calculate the total concentration of an element in a solution
- Add method to automatically generate certain solutions (like seawater)
- Add method to calculate the hardness of a solution
- Add method to calculate the alkalinity of a solution
- Add method to calculate the charge balance of a solution
- Add method to calculate the Bjerrum length
- Add database entries for hydrated and ionic radii of common ions
- Add database entries for the 'B' parameter in the Jones-Dole viscosity equation for common ions
- Add test suites for solute property methods, hardness, osmotic coefficient, and Debye length
- Improve logging system to work better when using pyEQL interactively
- Improved README with graphics and rich formatting
- Fix bug related to activity and osmotic coefficients for multivalent salts
- Fix bug related to retreival of water properties
- Documentation enhancements and fixes

0.2.2 (2015-08-28)
------------------

Expand Down
3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2013-2015 Ryan S. Kingsbury
Copyright (c) 2013-2016 Ryan S. Kingsbury

pyEQL is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Expand All @@ -22,4 +22,3 @@ This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

32 changes: 16 additions & 16 deletions README → README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
pyEQL: A Python library for solution chemistry
==============================================
![](pyeql-logo.png)

A Python library for solution chemistry
=======================================

pyEQL is a Python library that provides tools for modeling aqueous electrolyte
solutions. It allows the user to manipulate solutions as Python
objects, providing methods to populate them with solutes, calculate
species-specific properties (such as activity and diffusion coefficients),
and retreive bulk properties (such as density, conductivity, or volume).

It aspires to provide flexibilty, transparency, and extensibility.
It is designed to be customizable and easy to integrate into projects
![](pyeql-demo.png)
---

pyEQL is designed to be customizable and easy to integrate into projects
that require modeling of chemical thermodyanmics of aqueous solutions.
It aspires to provide a flexible, extensible framework for the user, with a
high level of transparency about data sources and calculation methods.

pyEQL runs on Python 3.0+ and is licensed under LGPL.

Expand All @@ -25,23 +31,17 @@ Key Features
- Not limited to dilute solutions. pyEQL contains out of the box support for
the Pitzer Model and other methods for modeling concentrated solutions.

- Extensible database system that facilitates integrating supplemental
parameter values with pyEQL's defaults.
- Extensible database system that allows one to supplement pyEQL's default
parameters with project-specific data.

- Units-aware calculations (by means of the pint library)

- Logging system provides robust documentation of data sources, assumptions,
and limitations of all calculations
- Units-aware calculations (by means of the [pint](https://github.com/hgrecco/pint) library)

Documentation
-------------
Detailed documentation is available at http://pyeql.readthedocs.org/
Detailed documentation is available at <https://pyeql.readthedocs.org/>

Dependencies
------------
- Python 3
- pint - for units-aware calculations
- scipy - for certain nonlinear equation solvers



- [pint](https://github.com/hgrecco/pint) - for units-aware calculations
- [scipy](https://www.scipy.org/) - for certain nonlinear equation solvers
2 changes: 1 addition & 1 deletion pyEQL/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
pyEQL is a python package for calculating the properties of aqueous solutions
and performing chemical thermodynamics computations.
:copyright: 2013-2015 by Ryan S. Kingsbury
:copyright: 2013-2016 by Ryan S. Kingsbury
:license: LGPL, see LICENSE for more details.
'''
Expand Down
38 changes: 23 additions & 15 deletions pyEQL/activity_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
can be used independently of a pyEQL solution object. Normally, these functions
are called from within the get_activity_coefficient method of the Solution class.
:copyright: 2013-2015 by Ryan S. Kingsbury
:copyright: 2013-2016 by Ryan S. Kingsbury
:license: LGPL, see LICENSE for more details.
'''
Expand All @@ -23,13 +23,21 @@
# logging system
import logging
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())

# add a filter to emit only unique log messages to the handler
import pyEQL.logging_system
unique = pyEQL.logging_system.Unique()
logger.addFilter(unique)

# add a handler for console output, since pyEQL is meant to be used interactively
ch = logging.StreamHandler()

# create formatter for the log
formatter = logging.Formatter('(%(name)s) - %(levelname)s - %(message)s')

# add formatter to the handler
ch.setFormatter(formatter)
logger.addHandler(ch)

def _debye_parameter_B(temperature='25 degC'):
'''
Expand Down Expand Up @@ -223,8 +231,8 @@ def get_activity_coefficient_debyehuckel(ionic_strength,formal_charge=1,temperat
Returns
-------
float
The mean molal (mol/kg) scale ionic activity coefficient of solute
Quantity
The mean molal (mol/kg) scale ionic activity coefficient of solute, dimensionless.
See Also
--------
Expand All @@ -250,7 +258,7 @@ def get_activity_coefficient_debyehuckel(ionic_strength,formal_charge=1,temperat

log_f = - _debye_parameter_activity(temperature) * formal_charge ** 2 * ionic_strength ** 0.5

return math.exp(log_f)
return math.exp(log_f) * unit('1 dimensionless')

def get_activity_coefficient_guntelberg(ionic_strength,formal_charge=1,temperature='25 degC'):
'''
Expand All @@ -267,8 +275,8 @@ def get_activity_coefficient_guntelberg(ionic_strength,formal_charge=1,temperatu
Returns
-------
float
The mean molal (mol/kg) scale ionic activity coefficient of solute
Quantity
The mean molal (mol/kg) scale ionic activity coefficient of solute, dimensionless.
See Also
--------
Expand All @@ -294,7 +302,7 @@ def get_activity_coefficient_guntelberg(ionic_strength,formal_charge=1,temperatu

log_f = - _debye_parameter_activity(temperature) * formal_charge ** 2 * ionic_strength ** 0.5 / (1+ionic_strength.magnitude ** 0.5)

return math.exp(log_f)
return math.exp(log_f) * unit('1 dimensionless')

def get_activity_coefficient_davies(ionic_strength,formal_charge=1,temperature='25 degC'):
'''
Expand All @@ -311,8 +319,8 @@ def get_activity_coefficient_davies(ionic_strength,formal_charge=1,temperature='
Returns
-------
float
The mean molal (mol/kg) scale ionic activity coefficient of solute
Quantity
The mean molal (mol/kg) scale ionic activity coefficient of solute, dimensionless.
See Also
--------
Expand All @@ -339,7 +347,7 @@ def get_activity_coefficient_davies(ionic_strength,formal_charge=1,temperature='
# the units in this empirical equation don't work out, so we must use magnitudes
log_f = - _debye_parameter_activity(temperature).magnitude * formal_charge ** 2 * (ionic_strength.magnitude ** 0.5 / (1+ionic_strength.magnitude ** 0.5) - 0.2 * ionic_strength.magnitude)

return math.exp(log_f)
return math.exp(log_f) * unit('1 dimensionless')

def get_activity_coefficient_pitzer(ionic_strength,molality,alpha1,alpha2,beta0,beta1,beta2,C_phi,z_cation,z_anion,nu_cation,nu_anion,temperature='25 degC',b=1.2):
'''
Expand Down Expand Up @@ -371,7 +379,7 @@ def get_activity_coefficient_pitzer(ionic_strength,molality,alpha1,alpha2,beta0,
Returns
-------
float
Quantity
The mean molal (mol/kg) scale ionic activity coefficient of solute, dimensionless
Examples
Expand Down Expand Up @@ -439,7 +447,7 @@ def get_activity_coefficient_pitzer(ionic_strength,molality,alpha1,alpha2,beta0,

loggamma = _pitzer_log_gamma(ionic_strength,molality,BMX,Bphi,C_phi,z_cation,z_anion,nu_cation,nu_anion,temperature,b)

return math.exp(loggamma)
return math.exp(loggamma) * unit('1 dimensionless')

def get_apparent_volume_pitzer(ionic_strength,molality,alpha1,alpha2,beta0,beta1,beta2,C_phi,V_o,z_cation,z_anion,nu_cation,nu_anion,temperature='25 degC',b=1.2):
'''
Expand Down Expand Up @@ -473,7 +481,7 @@ def get_apparent_volume_pitzer(ionic_strength,molality,alpha1,alpha2,beta0,beta1
Returns
-------
float
Quantity
The apparent molar volume of the solute, cm ** 3 / mol
Examples
Expand Down Expand Up @@ -893,4 +901,4 @@ def get_osmotic_coefficient_pitzer(ionic_strength,molality,alpha1,alpha2,beta0,b

osmotic_coefficient = first_term + second_term + third_term

return osmotic_coefficient
return osmotic_coefficient
Loading

0 comments on commit e715ead

Please sign in to comment.