NutMEG.reaction package

Submodules

NutMEG.reaction.reaction module

This is the reaction module. First initialise reagents and then initialise a basic reaction. If further specialties are required such as redox, import one of those submodules (if included).

Most recent changes: Thermodynamics management December 2019

@author P M Higgins @version 0.1.0

class NutMEG.reaction.reaction.reaction(reactants, products, env, frequency_factor=0.0, molar_activation_E=0.0, equilibrium=False)

Bases: object

Generalised reaction class for unclassified chemical interactions.

General thermodynamic calculations, and can be used as a basis for child modules. Primarily this is for standard conditions only, but for ideal fluids discretion for temperature is included, using the reaktoro package. If reagents are in the SUPCRT07 database, then free energies can be calculated if the reaction proceeds purely thermochemically.

activity_finder()

Return True if we have the activities for all of the reagents.

all_activities = False
bool_rate_constants()

Returns bool showing if we have any rate constants.

calculate_rate()

Update the rate constant using the arrhenius equation.

env = None

INITIALISATION

equation = ''
equationbuilder(r, mr)

Return reagent as it would appear in an equation.

Parameters
  • r (NutMEG.reaction.reagent) – reactant to show

  • mr (float) – molar ratio in the reaction

equilibrium = False
frequency_factor = None
get_equation()

Return the equation as a string.

lnK = None
mass_activation_E = None
mass_gibbs = None
molar_activation_E = None
molar_gibbs = None
products = None
quotient = None
quotient_calculator(attr)

Return the reaction quotient based on the reactant attribute passed.

Parameters

attr (str) – activity-like attribute of reagent

Notes

Recognised attrs include: “conc”, “molal”, “activity”.

rate_constant_RTP = None
rate_constant_env = None
react(n)

Perform a reaction, consuming unit n moles of reactants.

Notes

n is the number of moles of the reaction occuring, so if both reactants had a molar ratio of 4, and n=1 was passed, 4 moles of each reactant would be consumed.

reactants = None
reagents_name()

Get the reactants and products dictionaries with the names as keys rather than the reagent object.

rto_current_env()

Get useful energetic parameters (standard molar Gibbs and lnK) for the current state of this reaction.

rto_reagents()

Update the energetic parameters of the reagents using reaktoro.

set_products(pr)

Redefine dictionary of products as pr.

set_reactants(re)

Redefine dictionary of reactants as re.

std_molar_enthalpy = None
std_molar_entropy = None
std_molar_gibbs = None
thermo_finder()

Return True if data is available for all reagents in the SUPCRT07 Database.

update_molar_gibbs_from_quotient(Q_qconc=False, Q_qmolal=False, updatestdGibbs=True)

Update Gibbs free energy of reaction at temperature T, using the expression: \(\Delta G_{T} = \Delta G_{T}^{0} + RT\ln{Q}\)

Should demonstrate dG=0 at equilibrium. Again, be cautious of dG0’s dependence on T.

update_quotient(qconc=False, qmolal=False)

Update the reaction quotient for this reaction.

Parameters
  • qconc (bool, optional) – If True, calculate using molarity (default is False).

  • qmolal (bool, optional) – If True, calculate using molality (default is False).

Notes

The default is to use activities, but if needed the optional arguments may be switched for using concentrations or molalities with activity coefficients. Valid for gaseous and aqueous reagents as conc is defined as equivalent to gas pressure in the reagent object. Molarity takes precedence over molality.

update_reagents()

Update the parameters of the reagents e.g. when the environ- ment has changed, new conc. etc.

update_std_molar_enthalpy_of_reaction()

Update the standard molar enthalpy of reaction from the enthalpies of formation of the reagents in the current environment.

update_std_molar_entropy_of_reaction()

Update the standard molar entropy of reaction from the entropies of formation of the reagents in the current environment.

update_std_molar_gibbs_G()

Update the standard molar gibbs free energy of reaction using the Gibbs free energy of formation of the reagents in the current environment, if available.

It is preferable to do this using reaktoro, (rto_current_env) if the thermodynamic data is available in the standard databases.

update_std_molar_gibbs_HS()

Update the standard molar gibbs free energy of reaction using the standard enthalpies and entropies of formation of the reagents, if available.

H has a weak dependence on T, so large extremes will be inresaingly poorly represented. S also has a dependence on T, changing with heat capacity, latent heat of fusion etc.

If you do not have the non-RTP values of H or S — or they are not, avaliable in the SUPCRT07 database — consider using the Tdep reaction type (special/Tdep)

update_std_molar_gibbs_from_quotient(Q_qconc=False, Q_qmolal=False)

Calculate the standard molar gibbs free energy of reaction.

Parameters
  • Q_qconc (bool, optional) – If True, calculate the quotient using molarity (default is False).

  • Q_qmolal (bool, optional) – If True, calculate the quotient using molality (default is False).

Notes

Uses the expression: \(\Delta G_{T}^{0} = -RT\ln{K}\)

This can only be done at equilibrium.

NutMEG.reaction.reagent module

This is the reagent submodule. reagent stores parameters of individual molecules in a given environment, to be used in the rector and reaction modules. Thermodynamic properties are calculated using reaktoro if available.

Most recent changes: Thermodynamics management December 2019

@author P M Higgins @version 0.0.3

class NutMEG.reaction.reagent.reagent(name, env, thermo=True, conc=None, activity=None, molal=None, charge=0, gamma=1.0, radius=None, phase='aq', phase_ss=False, Cp_T_poly=None, new=True)

Bases: object

Class for storing and calculating individual reagent properties such as concentrations, activities, etc.

name

name of the reagent

Type

str

conc

molarity in mol/L. If gaseous, conc describes pressure in bar. Can be None if molal or activity are known

Type

float

gamma

activity coefficient

Type

float

activity

Activity. If None, estimate using gamma and conc.

Type

float

molal

molality in mol/kg. Can be None is conc or activity are known

Type

float

charge

Charge of reagent. Default 0.

Type

float

Cp_RTP = None
Cp_T_poly = None
Cp_env = None
GetThermoParams()

Import the reagent’s thermal parameters at both RTP and in the current environment.

activity = None
charge = 0
conc = None
env = <NutMEG.environment.environment.environment object>
gamma = 1.0
static get_phase_str(namestr)

Return the phase of a reagent from its name: eg ‘aq’ from Al(aq)

import_RTP_params()

Import thermodynamic RTP data from the SQLite database data/TPdb. If the data doesn’t exist, calculate it using reaktoro.

Updates std formation gibbs, enthalpy, entropy at RTP.

import_params_db()

Import thermodynamic data from the SQLite database data/TPdb. If the data doesn’t exist, calculate it using reaktoro.

Updates std formation gibbs, enthalpy, entropy in current environment.

molal = None
phase = None
phase_ss = False
radius = None
redefine(re)

re-initialisethis reagent as a new or updated reagent

set_activitycoefficient(newg)

Update the activity coefficients.

Parameters

newg (float) – New activity coefficient to set.

set_concentration(newconc)

Update reagent concentration to be newconc in mol/L.

Parameters

newconc (float) – New molarity to set in mol/L

set_molality(newmolal)

Update molality in mol/kg solvent.

Parameters

newmolal (float) – New molality to set.

set_phase(newphase)

Change the reagent’s phase, and update thermodynamic parameters accordingly.

Parameters

newphase (str) – New phase to set. Must be one of ‘aq’. ‘s’, ‘g’, ‘l’

std_formation_enthalpy_RTP = None
std_formation_enthalpy_env = None
std_formation_entropy_RTP = None
std_formation_entropy_env = None
std_formation_gibbs_RTP = 0.0
std_formation_gibbs_env = None
thermo = True
update_reagent()

Update the reagent’s parameters based on a changing environment.

For now, it just updates the thermodynamic data.

Module contents