edu.davidson.chm.equilibria
Class Reaction

java.lang.Object
  extended by edu.davidson.chm.equilibria.Reaction

public class Reaction
extends java.lang.Object

This class contains the stoichiometric description of a chemical reaction. Each reaction includes two or more species, at least one of which is a reactant and at least one of which is a product. A stoichiometric coefficient is associated with each species. A negative stoichiometric coefficient indicates the species is a reactant; a positive stoichiometric coefficient indicates the species is a product. An equilibrium constant must be supplied for each reaction.

Copyright (c) David N. Blauch

Version:
2.2
Author:
David N. Blauch

Constructor Summary
Reaction()
          This constructor should never be used.
Reaction(Species[] _species, double[] _coef, double _K)
          Constructs a Reaction based upon a list of species and their stoichiometric coefficients.
Reaction(java.lang.String _label, Species[] _species, double[] _coef, double _K)
          Constructs a Reaction based upon a list of species and their stoichiometric coefficients.
 
Method Summary
 Reaction copyOf(ChemSystem _chemSystem)
          Returns a copy of the Reaction.
 double getCoefficient(Species _species)
          Returns the stoichiometric coefficient of the given species.
 double getCoefficient(java.lang.String _label)
          Returns the stoichiometric coefficient of the species with the given label.
 double[] getCoefficients()
          Returns an array of the stoichiometric coefficients for the species in the reaction
 java.lang.String getEquation()
          Returns a string representation of the reaction.
 java.lang.String getInfo()
          Returns information about this class
 boolean getIsAuto()
          Returns the isAuto property, which indicates whether this reaction is an autodissociation reaction
 boolean getIsHomogeneous()
          Returns the isHomogeneous property, which indicates whether all reactants and products in the reaction exist in the same phase.
 double getK()
          Returns the thermodynamic equilibrium constant at the reference temperature
 double getK(double _temperature)
          Returns the equilibrium constant at the indicated temperature.
 java.lang.String getLabel()
          Returns the label of the reaction
 int getNbrSpecies()
          Returns the number of different species in the reaction
 Phase getPhase()
          Returns the phase in which the reaction occurs.
 double getpK()
          Returns pK for the reaction at the reference temperature
 double getpK(double _temperature)
          Returns pK for the reaction at _temperature
 double getReferenceTemperature()
          Returns the reference temperature for the equilibrium constant
 Species[] getSpecies()
          Returns an array of the species involved in the reaction
 double[] getTemperatureDependence()
          Returns an array containing the parameters a and b characterizing the temperature dependence of the Reaction
 boolean isEquivalent(Reaction _rxn)
          Returns true if all ChemSpecies and stoichiometric coefficients and the equilibrium constant of the user-supplied Reaction are the same as this Reaction.
 void setIsAuto(boolean _isAuto)
          Sets the isAuto property to identify autodissociation reactions
 void setK(double _K)
          Sets the thermodynamic equilibrium constant at the reference temperature
 void setLabel(java.lang.String _label)
          Sets the descriptive label for the reaction
 void setReferenceTemperature(double _temperature)
          Sets the reference temperature, which is used to calculate the equilibrium constant at temperatures other than the reference temperature.
 void setTemperatureDependence(double _a, double _b)
          Sets the parameters controlling the temperature-dependence of the equilibrium constant.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reaction

public Reaction()
This constructor should never be used. The reactants, products, stoichiometric coefficients, and the equilibrium constant must be explicitly defined.


Reaction

public Reaction(Species[] _species,
                double[] _coef,
                double _K)
Constructs a Reaction based upon a list of species and their stoichiometric coefficients.

Parameters:
_species - array of species involved in reaction
_coef - array of stoichiometric coefficients, negative for reactants and positive for products
_K - reaction equilibrium constant at 298.15 K

Reaction

public Reaction(java.lang.String _label,
                Species[] _species,
                double[] _coef,
                double _K)
Constructs a Reaction based upon a list of species and their stoichiometric coefficients.

Parameters:
_species - array of species involved in reaction
_coef - array of stoichiometric coefficients, negative for reactants and positive for products
_K - reaction equilibrium constant at 298.15 K
Method Detail

copyOf

public Reaction copyOf(ChemSystem _chemSystem)
Returns a copy of the Reaction. The method examines each Species in the Reaction and searches for a Phase in the new ChemSystem with the same label that contains the relevant ChemSpecies. If corresponding Species cannot be found, the method returns null. This method should be called after the composition of the new ChemSystem has been defined. The new Reaction returned by this method is NOT added to the ChemSystem. The user must add the Reaction to the ChemSystem, if desired.


getCoefficient

public double getCoefficient(Species _species)
Returns the stoichiometric coefficient of the given species. If the species does not participate in the reaction, zero is returned.


getCoefficient

public double getCoefficient(java.lang.String _label)
Returns the stoichiometric coefficient of the species with the given label. If the species does not participate in the reaction, zero is returned.


getCoefficients

public double[] getCoefficients()
Returns an array of the stoichiometric coefficients for the species in the reaction


getEquation

public java.lang.String getEquation()
Returns a string representation of the reaction.


getInfo

public java.lang.String getInfo()
Returns information about this class


getIsAuto

public boolean getIsAuto()
Returns the isAuto property, which indicates whether this reaction is an autodissociation reaction


getIsHomogeneous

public boolean getIsHomogeneous()
Returns the isHomogeneous property, which indicates whether all reactants and products in the reaction exist in the same phase.


getK

public double getK()
Returns the thermodynamic equilibrium constant at the reference temperature


getK

public double getK(double _temperature)
Returns the equilibrium constant at the indicated temperature. This value is corrected using the standard enthalpy of reaction at 298.15 K and the heat capacity change at 298.15 K. If a more sophistocated temperature dependence is desired, the user should manually change the equilibrium constant when the temperature is changed.

Parameters:
_temperature - temperature in Kelvin

getNbrSpecies

public int getNbrSpecies()
Returns the number of different species in the reaction


getPhase

public Phase getPhase()
Returns the phase in which the reaction occurs. This object is only valid if the reaction is homogeneous.

See Also:
getIsHomogeneous()

getpK

public double getpK()
Returns pK for the reaction at the reference temperature


getpK

public double getpK(double _temperature)
Returns pK for the reaction at _temperature

Parameters:
_temperature - absolute temperature

getLabel

public java.lang.String getLabel()
Returns the label of the reaction


getReferenceTemperature

public double getReferenceTemperature()
Returns the reference temperature for the equilibrium constant


getSpecies

public Species[] getSpecies()
Returns an array of the species involved in the reaction


setReferenceTemperature

public void setReferenceTemperature(double _temperature)
Sets the reference temperature, which is used to calculate the equilibrium constant at temperatures other than the reference temperature.


setTemperatureDependence

public void setTemperatureDependence(double _a,
                                     double _b)
Sets the parameters controlling the temperature-dependence of the equilibrium constant. The equilibrium constant at temperature T is K(T), which is given by

ln[K(T)/K] = a(1/T - 1/Tref) + b ln[T/Tref]

Tref is the reference temperature, which is 298.15 K by default

By default, a = b = 0, which produces a temperature-independent equilibrium constant.


getTemperatureDependence

public double[] getTemperatureDependence()
Returns an array containing the parameters a and b characterizing the temperature dependence of the Reaction


isEquivalent

public boolean isEquivalent(Reaction _rxn)
Returns true if all ChemSpecies and stoichiometric coefficients and the equilibrium constant of the user-supplied Reaction are the same as this Reaction. For solutes, the solvent ChemSpecies must be the same. Both reactions must employ the same reference temperature, equilibrium constant at the reference temperature, and temperature-dependence.


setIsAuto

public void setIsAuto(boolean _isAuto)
Sets the isAuto property to identify autodissociation reactions


setK

public void setK(double _K)
Sets the thermodynamic equilibrium constant at the reference temperature


setLabel

public void setLabel(java.lang.String _label)
Sets the descriptive label for the reaction