|
Chemistry AppletsDavid N. Blauch |
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--edu.davidson.chm.equilibria.ChemSystem
Chemical Equilibria Problem Solver
This project contains the files necessary to solve arbitrary equilibrium problems
Copyright: Copyright (c) David N. Blauch
Company: Davidson College
| Constructor Summary | |
ChemSystem()
Creates a chemical system using the default parameters |
|
ChemSystem(java.lang.String _label)
Creates a chemical system using user-defined parameters |
|
ChemSystem(java.lang.String _label,
double _temp,
double _pressure)
Creates a chemical system using user-defined parameters |
|
| Method Summary | |
void |
addHalfReaction(HalfReaction _halfReaction)
Adds a half-reaction to the chemical system |
HalfReaction |
addHalfReaction(java.lang.String _rxn,
java.lang.String _label,
double _Eo)
Creates a new half-reaction and adds the half-reaction to the chemical system The reaction is described by a string in the conventional chemical notation. |
void |
addPhase(Phase _phase)
Adds a existing phase to the chemical system |
void |
addReaction(Reaction _reaction)
Adds an existing reaction to the chemical system |
Reaction |
addReaction(java.lang.String _rxn,
java.lang.String _label,
double _K)
Creates a new reaction and adds the reaction to the chemical system The reaction is described by a string in the conventional chemical notation. |
ChemSystem |
copyOf(java.lang.String _label)
Returns a new ChemSystem with the indicated label. |
Species[] |
createAcidBaseSpecies(Phase _phase,
ChemSpecies[] _chemSpecies,
double[] _moles,
double[] _Ka,
java.lang.String _reactionLabel)
Creates a series of acid-base species and adds the acid-base species to _phase and the acid-base reactions to the chemical system. |
AqueousSolution |
createAqueousPhase(java.lang.String _label,
double _volume)
Creates and adds an aqueous solution to the chemical system. |
Species[] |
createComplexationSpecies(Phase _phase,
ChemSpecies[] _chemSpecies,
double[] _moles,
double[] _Kf,
java.lang.String _reactionLabel)
Creates a series of complex species and adds the complex species to _phase and the complexation reactions to the chemical system. |
Gas |
createGasPhase(java.lang.String _label)
Creates and adds a gas to the chemical system. |
Gas |
createGasPhase(java.lang.String _label,
ChemSpecies _chemSpecies,
double _moles)
Creates and adds a gas to the chemical system. |
Liquid |
createLiquidPhase(ChemSpecies _chemSpecies,
double _mass)
Creates and adds a liquid to the chemical system. |
Liquid |
createLiquidPhase(java.lang.String _label,
ChemSpecies _chemSpecies,
double _mass)
Creates and adds a liquid to the chemical system. |
Solid |
createSolidPhase(ChemSpecies _chemSpecies,
double _moles)
Creates and adds a solid to the chemical system. |
Solid |
createSolidPhase(java.lang.String _label,
ChemSpecies _chemSpecies,
double _moles)
Creates and adds a solid to the chemical system. |
Solution |
createSolutionPhase(java.lang.String _label,
ChemSpecies _solventChemSpecies,
ChemSpecies _acidChemSpecies,
ChemSpecies _baseChemSpecies,
double _Kauto,
double _volume)
Creates and adds a solution to the chemical system. |
Solution |
createSolutionPhase(java.lang.String _label,
ChemSpecies _chemSpecies,
double _volume)
Creates and adds a solution to the chemical system. |
Solution |
createSolutionPhase(java.lang.String _label,
ChemSpecies _chemSpecies,
double _Kauto,
double _volume)
Creates and adds a solution to the chemical system. |
ChemSpecies |
getAnionCounterion()
Returns the generic X- ChemSpecies, which is used to arbitrarily balance charge. |
ChemSpecies |
getCationCounterion()
Returns the generic X+ ChemSpecies, which is used to arbitrarily balance charge. |
protected java.lang.String |
getChar(java.lang.String _str,
int pos)
Returns a string containing character at position pos |
HalfReaction |
getHalfReaction(java.lang.String _label)
Returns the half-reaction with the indicated label |
HalfReaction[] |
getHalfReactions()
Returns an array of the half-reactions in the system |
Hydrogen_Ion |
getHydrogen_Ion()
Returns the Hydrogen_Ion ChemSpecies. |
Hydroxide_Ion |
getHydroxide_Ion()
Returns the Hydroxide_Ion ChemSpecies. |
java.lang.String |
getInfo()
Returns information about this class |
boolean |
getIsIdeal()
Returns the isIdeal property. |
boolean |
getIsIsobaric()
Returns true if the system is isobaric. |
java.lang.String |
getLabel()
Returns the chemical system label |
int |
getNbrPhases()
Returns the number of Phases in the Chemical System |
int |
getNbrReactions()
Returns the number of Reactions in the Chemical System |
Phase |
getPhase(int _index)
Returns the phase at the requested index |
Phase |
getPhase(java.lang.String _label)
Returns the phase with the given label |
Phase[] |
getPhases()
Returns an array of phases in the system |
double |
getPotential(Phase _phase)
Returns the half-cell potential in volts for the indicated electrode at the system temperature. |
double |
getPotential(Phase _phase1,
Phase _phase2)
Returns the cell potential (potential of electrode1 minus that of electrode2) in volts at the system temperature. |
double |
getPotential(java.lang.String _phase)
Returns the half-cell potential in volts for the indicated electrode at the system temperature. |
double |
getPotential(java.lang.String _phase1,
java.lang.String _phase2)
Returns the cell potential (potential of electrode1 minus that of electrode2) in volts at the system temperature. |
double |
getPressure()
Returns the system pressure in atmospheres |
Reaction |
getReaction(int _index)
Returns the reaction at the requested index |
Reaction |
getReaction(java.lang.String _label)
Returns the reaction with the indicated label |
Reaction[] |
getReactions()
Returns an array of the reactions in the system |
Species[] |
getSpecies()
Returns an array of species in the system |
Species |
getSpecies(java.lang.String _label)
Returns the species in the system with the given label. |
Species |
getSpecies(java.lang.String _label,
java.lang.String _phaseLabel)
Returns the species in the system and in the indicated phase with the given label. |
double |
getTemperature()
Returns the system temperature in Kelvin |
Water |
getWater()
Returns the Water chemical species for this chemical system |
protected boolean |
parse(java.lang.String _rxn)
Parses a string describing a reaction. |
boolean |
removeHalfReaction(HalfReaction _halfReaction)
Removes the half-reaction from the chemical system. |
boolean |
removeHalfReaction(java.lang.String _label)
Removes the half-reaction from the chemical system. |
boolean |
removePhase(Phase _phase)
Removes the phase from the chemical system. |
boolean |
removePhase(java.lang.String _label)
Removes the phase with the given label from the chemical system |
boolean |
removeReaction(Reaction _reaction)
Removes the reaction from the chemical system. |
boolean |
removeReaction(java.lang.String _label)
Removes the reaction with the given label from the chemical system |
void |
setIsIdeal(boolean _isIdeal)
Sets the isIdeal property. |
void |
setIsIsobaric(boolean _isIsobaric)
Sets the isIsobaric property. |
void |
setLabel(java.lang.String _label)
Sets the label |
void |
setPressure(double _pressure)
Sets the system pressure. |
void |
setReferenceTemperature(double _temperature)
Sets the reference temperature for all reactions and half-reactions in the chemical system |
void |
setTemperature(double _temp)
Sets the system temperature |
void |
transferSolution(Phase _solution1,
Phase _solution2,
double _volume)
Transfers a volume of _solution1 to _solution2. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public ChemSystem()
public ChemSystem(java.lang.String _label)
_label - identification string
public ChemSystem(java.lang.String _label,
double _temp,
double _pressure)
_label - identification string_temp - temperature in Kelvin_pressure - pressure in atmospheres| Method Detail |
public void addPhase(Phase _phase)
public void addHalfReaction(HalfReaction _halfReaction)
public HalfReaction addHalfReaction(java.lang.String _rxn,
java.lang.String _label,
double _Eo)
O2 (g) + 4 H+ + 4 e- (Pt) = 2 H2O
The string must contain e-. The phase of "e-" is important only if you wish to measure the potential of the phase.
The + separating terms and the = must have a space on each side.
Phases must be enclosed in () with no enclosed spaces. If a phase is specified, the method will search for a phase with the label inside the parentheses.
If a phase is specified, the method will search for a species with the indicated label in the indicated phase. Otherwise the method searches all phases for a species with the indicated label.
To avoid potential confusion, labels should not begin with a number, space, + or =.
If the user-supplied equation is defective, one or more species or phases does not exist, or the equation is not balanced with respect to charge, the method returns null.
_Eo - standard potential in volts at 298.15 K for the half-reaction_label - descriptive label for the reactionpublic void addReaction(Reaction _reaction)
public Reaction addReaction(java.lang.String _rxn,
java.lang.String _label,
double _K)
Fe2O3 + 3 CO = 2 Fe + 3 carbon_monoxide
The + separating terms and the = must have a space on each side.
Phases must be enclosed in () with no enclosed spaces. If a phase is specified, the method will search for a phase with the label inside the parentheses.
If a phase is specified, the method will search for a species with the indicated label in the indicated phase. Otherwise the method searches all phases for a species with the indicated label.
To avoid potential confusion, labels should not begin with a number, space, + or =.
If the user-supplied equation is defective, one or more species or phases does not exist, or the equation is not balanced with respect to charge, the method returns null.
_K - equilibrium constant for the reaction_label - descriptive label for the reactionpublic ChemSystem copyOf(java.lang.String _label)
public Species[] createAcidBaseSpecies(Phase _phase,
ChemSpecies[] _chemSpecies,
double[] _moles,
double[] _Ka,
java.lang.String _reactionLabel)
_moles - array containing amounts of each Species_reactionLabel - base label, the step number is appended
public Species[] createComplexationSpecies(Phase _phase,
ChemSpecies[] _chemSpecies,
double[] _moles,
double[] _Kf,
java.lang.String _reactionLabel)
_moles - array containing amounts of each Species_reactionLabel - base label, the step number is appended
public AqueousSolution createAqueousPhase(java.lang.String _label,
double _volume)
_label - description of the phase_volume - volume in liters of the aqueous phasepublic Gas createGasPhase(java.lang.String _label)
_label - label for the gas phase
public Gas createGasPhase(java.lang.String _label,
ChemSpecies _chemSpecies,
double _moles)
_chemSpecies - ChemSpecies in the gas_label - label for the gas phase_moles - moles of the ChemSpecies in the gas
public Liquid createLiquidPhase(ChemSpecies _chemSpecies,
double _mass)
_chemSpecies - ChemSpecies the constitutes the liquid_mass - mass in grams of the liquid
public Liquid createLiquidPhase(java.lang.String _label,
ChemSpecies _chemSpecies,
double _mass)
_label - descriptive label for the liquid_chemSpecies - ChemSpecies the constitutes the liquid_mass - mass in grams of the liquid
public Solid createSolidPhase(ChemSpecies _chemSpecies,
double _moles)
_chemSpecies - ChemSpecies the constitutes the solid_moles - moles of the solid
public Solid createSolidPhase(java.lang.String _label,
ChemSpecies _chemSpecies,
double _moles)
_label - descriptive label for the solid_chemSpecies - ChemSpecies the constitutes the solid_moles - moles of the solid
public Solution createSolutionPhase(java.lang.String _label,
ChemSpecies _chemSpecies,
double _volume)
_chemSpecies - ChemSpecies for the solvent_label - label for the solution_volume - volume of the solution in liters
public Solution createSolutionPhase(java.lang.String _label,
ChemSpecies _chemSpecies,
double _Kauto,
double _volume)
_chemSpecies - ChemSpecies for the solvent_label - label for the solution_Kauto - autodissociation constant for the solution_volume - volume of the solution in liters
public Solution createSolutionPhase(java.lang.String _label,
ChemSpecies _solventChemSpecies,
ChemSpecies _acidChemSpecies,
ChemSpecies _baseChemSpecies,
double _Kauto,
double _volume)
_solventChemSpecies - ChemSpecies for the solvent_acidChemSpecies - ChemSpecies for the solvent conjugate acid_baseChemSpecies - ChemSpecies for the solvent conjugate base_label - label for the solution_Kauto - autodissociation constant for the solution_volume - volume of the solution in literspublic ChemSpecies getCationCounterion()
public ChemSpecies getAnionCounterion()
public HalfReaction getHalfReaction(java.lang.String _label)
public HalfReaction[] getHalfReactions()
public Hydrogen_Ion getHydrogen_Ion()
public Hydroxide_Ion getHydroxide_Ion()
public boolean getIsIdeal()
public java.lang.String getInfo()
public boolean getIsIsobaric()
public java.lang.String getLabel()
public int getNbrPhases()
public int getNbrReactions()
public Phase getPhase(int _index)
public Phase getPhase(java.lang.String _label)
public Phase[] getPhases()
public double getPotential(Phase _phase)
_phase - electrode phasepublic double getPotential(java.lang.String _phase)
_phase - label for electrode phase
public double getPotential(Phase _phase1,
Phase _phase2)
_phase1 - electrode1 phase_phase2 - electrode2 phase
public double getPotential(java.lang.String _phase1,
java.lang.String _phase2)
_phase1 - label for electrode1 phase_phase2 - label for electrode2 phasepublic double getPressure()
public Reaction getReaction(int _index)
public Reaction getReaction(java.lang.String _label)
public Reaction[] getReactions()
public Species[] getSpecies()
public Species getSpecies(java.lang.String _label)
public Species getSpecies(java.lang.String _label,
java.lang.String _phaseLabel)
public double getTemperature()
public Water getWater()
public boolean removeHalfReaction(HalfReaction _halfReaction)
public boolean removeHalfReaction(java.lang.String _label)
public boolean removePhase(Phase _phase)
public boolean removePhase(java.lang.String _label)
public boolean removeReaction(Reaction _reaction)
public boolean removeReaction(java.lang.String _label)
public void setIsIdeal(boolean _isIdeal)
public void setIsIsobaric(boolean _isIsobaric)
public void setLabel(java.lang.String _label)
public void setPressure(double _pressure)
_pressure - pressure in atmospherespublic void setReferenceTemperature(double _temperature)
public void setTemperature(double _temp)
_temp - temperature in Kelvin
public void transferSolution(Phase _solution1,
Phase _solution2,
double _volume)
The method examines all Reactions that involve only _solution1 solutes (with the exception of the autodissociation reaction). If no corresponding Reaction exists in _solution2, a new Reaction is created.
_volume - volume in liters that is transferredprotected boolean parse(java.lang.String _rxn)
protected java.lang.String getChar(java.lang.String _str,
int pos)
|
Chemistry AppletsDavid N. Blauch |
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||