The Ion Class

class ionize.Ion(name, valence, reference_pKa, reference_mobility, reference_temperature=None, enthalpy=None, heat_capacity=None, nightingale_data=None, molecular_weight=None, alias=None)[source]

An Ion describes a charged species in solution.

Ion is the most commonly used subclass of BaseIon. It is used to represent small ions that have a set of known valence states with distinct pKas. Ions are immutable.

Example:

acid = ionize.Ion('acid', [-1], [3], [30e-9], molecular_weight=19)
acid.mobility(pH=7)
acid.diffusivity(pH=7)
Parameters:
  • name – The name of the ion.
  • valence – An iterable of the integer valence states.
  • reference_pKa – An iterable of the pKas associated with the valence states at the reference temperature.
  • reference_mobility – An iterable of the fully ionized mobility of each valence state at infinite dilution in m^2/V/s at the reference temperature.
  • reference_temperature – The temperature at which other parameters are measured. Defaults to 25 degrees C.
  • enthalpy – The enthalpy change on dissociation for each valence state. This is optional, but allows more accurate models for calculating temperature-dependance of properties.
  • heat_capacity – The change in heat capacity on dissociation for each valence state. This optional parameter further improves the accuracy of temperature-dependant property calculation.
  • nightingale_data – Mobiliity correction data for small ions where hydration shell dynamics are important.
  • molecular_weight – The molecular weight of uncharged species, in Daltons.
  • alias – An iterable of alias strings that can be used to refer to the ion.
absolute_mobility(temperature=None)

Return the mobility of each charge state at infinite dilution.

:param temperature

acidity(ionic_strength=None, temperature=None)

Return the effective acidity constant, Ka, for each valence state.

The value is corrected for ionic strength and temperature using the Debye-Huckel approximation.

acidity_product(ionic_strength=None, temperature=None)

Return the products of the acidity.

This vector, commonly referred to as L, is useful in computing the equilibrium pH in a solution, and to compute the ionization fraction of an ion.

actual_mobility(ionic_strength=None, temperature=None)

Return the mobility for each charge state.

Uses the Onsager-Fuoss correction if a context solution is available, otherwise uses the Robinson-Stokes mobility.

:param ionic_strength :param temperature

alias

Alternative chemical names.

charge(pH=None, ionic_strength=None, temperature=None, moment=1)

Return the time-averaged charge of the ion.

Parameters:moment – Control which moment average is returned. Default is 1.
context(context=False)

Control the context in which ion properties are calculated.

The context is used as a convenience to specify what values of pH, ionic strength, and temperature are used to compute ion properties.

Example::

``water = ionize.Solution()

my_ion.mobility() # Raises without a pH for calculation

with my_ion.context(water):
my_ion.mobility() # Uses water pH

my_ion.context(water) my_ion.mobility() # Uses water pH my_ion.context() # Returns water my_ion.context(None)``

There are multiple sources from which pH, ionic strength, and temperature can be drawn. They are, in order of priority:

Method parameters. Manually setting a value when calling an ion
method always has the highest priority.

Context.

Default values. The default temperature is the package reference
temperature, 25 degrees C. This is assumed throughout the package
if temperature is not specified. The default ionic strength is the
solvent ionic strength. This ionic strength is calculated from the
pH if available. Otherwise, it is calculated as the minimum ionic
strength associated with the solvent dissociation constant. There
is no default value for the pH.
Parameters:context – The new context to use for ion calculations. If context

is False, the current context is returned. Context can be None (to erase the current context) or a Solution object.

diffusivity(pH=None, ionic_strength=None, temperature=None)

Return the diffusivity of the ion in m^2/s.

:param pH :param ionic_strength :param temperature

enthalpy

The change in enthalpy on ionization.

heat_capacity

The change in heat capacity on ionization.

ionization_fraction(pH=None, ionic_strength=None, temperature=None)

Return the fraction of time the ion is in each valence state.

Value is returned as a numpy array. This array will not sum to 1 due to the fraction of ion in the uncharged state.

mobility(pH=None, ionic_strength=None, temperature=None)

Return the effective mobility of the ion in m^2/V/s.

If a context solution is available, mobility uses the full Onsager-Fuoss correction to mobility. Otherwise, the Robinson-Stokes model is used.

:param pH :param ionic_strength :param temperature

molar_conductivity(pH=None, ionic_strength=None, temperature=None)

Retun the molar conductivity of the ion in S/m/M

:param pH :param ionic_strength :param temperature

molecular_weight

The ion molecular weight

name

The ion name.

nightingale_data

Temperature dependance data for small ions.

onsager_fuoss_mobility()

Return the Onsager-Fuoss corrected mobility of each charge state.

pKa(ionic_strength=None, temperature=None)

Return the effective pKa for the ion.

reference_mobility

The mobility of each ionization at the reference state.

reference_pKa

The pKas of each ionization state at the reference state.

reference_temperature

The temperature at whcih properties were measured.

robinson_stokes_mobility(ionic_strength=None, temperature=None)

Return the Robinson-Stokes correction to fully ionized mobility.

This correction is appropriate if a generic ionic strength is known, but the specific ions in solution are unknown.

save(filename)

Save a serialized Ion to a file.

separability(other, pH=None, ionic_strength=None, temperature=None)

Return the separability between this ion and the other ion.

Separabillity is a normalized difference between this ion and the other ion, defined as:

abs((self.mobility - other.mobility)/ self.mobility)
Parameters:other – The other ion for comparison. Must have valid context

and mobility methods.

The context from this ion is used to override the context of the other ion.

serialize(nested=False, compact=False)

Returns a JSON serialized string representation of the ion. This representation can be returned to an Ion object using deserialize.

Parameters:nested – If True, skips JSON serialization and returns a python

dictionary.

Parameters:compact – If True, returns a JSON representation with minimal

characters. Otherwise, whitespace is introduced for readability.

valence

The valence of each state.