Species
ChemistryLab.AbstractSpeciesChemistryLab.AggregateStateChemistryLab.CemSpeciesChemistryLab.ClassChemistryLab.SpeciesBase.isequalChemistryLab.aggregate_stateChemistryLab.applyChemistryLab.atomsChemistryLab.atoms_chargeChemistryLab.cemformulaChemistryLab.chargeChemistryLab.check_mendeleevChemistryLab.classChemistryLab.formulaChemistryLab.nameChemistryLab.oxidesChemistryLab.oxides_chargeChemistryLab.propertiesChemistryLab.symbol
ChemistryLab.AbstractSpecies — Type
abstract type AbstractSpecies endAbstract base type for all chemical species representations.
All concrete species types (Species, CemSpecies) inherit from this type.
ChemistryLab.AggregateState — Type
@enum AggregateStateEnumeration for species aggregate states.
Values
AS_UNDEF: undefined state.AS_AQUEOUS: aqueous solution.AS_CRYSTAL: crystalline solid.AS_GAS: gas phase.
ChemistryLab.Class — Type
@enum ClassEnumeration for species chemical classes.
Values
SC_UNDEF: undefined class.SC_AQSOLVENT: aqueous solvent.SC_AQSOLUTE: aqueous solute.SC_COMPONENT: component.SC_GASFLUID: gas or fluid.
ChemistryLab.Species — Type
struct Species{T<:Number} <: AbstractSpeciesStandard chemical species representation using atomic composition.
Fields
name::String: human-readable name.symbol::String: species symbol.formula::Formula{T}: chemical formula with stoichiometric coefficients.aggregate_state::AggregateState: physical state.class::Class: chemical class.properties::OrderedDict{Symbol,PropertyType}: thermodynamic and other properties.
Examples
julia> s = Species("H2O"; name="Water", aggregate_state=AS_AQUEOUS);
julia> atoms(s)
OrderedDict{Symbol, Int64} with 2 entries:
:H => 2
:O => 1Base.isequal — Method
Base.isequal(s1::AbstractSpecies, s2::AbstractSpecies) -> BoolCompare two species for equality based on formula, aggregate state, and class.
Examples
julia> s1 = Species("H2O"; aggregate_state=AS_AQUEOUS);
julia> s2 = Species("H₂O"; aggregate_state=AS_AQUEOUS);
julia> s1 == s2
trueChemistryLab.charge — Method
charge(s::AbstractSpecies) -> Int8Return the formal charge of the species.
Examples
julia> s1 = Species("Ca(HSiO3)+");
julia> charge(s1) == 1
trueChemistryLab.CemSpecies — Type
struct CemSpecies{T<:Number,S<:Number} <: AbstractSpeciesCement chemistry species representation using oxide notation.
Fields
name::String: human-readable name.symbol::String: species symbol.formula::Formula{T}: atomic composition formula.cemformula::Formula{S}: oxide notation formula.aggregate_state::AggregateState: physical state.class::Class: chemical class.properties::OrderedDict{Symbol,PropertyType}: thermodynamic and other properties.
Examples
julia> s = CemSpecies("C3A"; name="Tricalcium aluminate");
julia> oxides(s)
OrderedDict{Symbol, Int64} with 2 entries:
:C => 3
:A => 1ChemistryLab.name — Method
name(s::AbstractSpecies) -> StringReturn the name of the species.
Examples
julia> s1 = Species("H2O"; aggregate_state=AS_AQUEOUS);
julia> s1.name == "H2O"
trueChemistryLab.symbol — Method
symbol(s::AbstractSpecies) -> StringReturn the symbol of the species.
ChemistryLab.formula — Method
formula(s::AbstractSpecies) -> FormulaReturn the Formula object associated with the species.
Examples
julia> s1 = Species("H2O"; aggregate_state=AS_AQUEOUS);
julia> formula(s1) == Formula("H2O")
trueChemistryLab.cemformula — Function
cemformula(s::CemSpecies) -> FormulaReturn the oxide notation formula of the cement species.
ChemistryLab.atoms — Method
atoms(s::AbstractSpecies) -> OrderedDict{Symbol,Number}Return the atomic composition (element => coefficient) of the species.
ChemistryLab.atoms_charge — Method
atoms_charge(s::AbstractSpecies) -> OrderedDict{Symbol,Number}Return atomic composition including the charge as a :Zz key if non-zero.
Examples
julia> s = Species("Ca+2");
julia> atoms_charge(s)
OrderedDict{Symbol, Int64} with 2 entries:
:Ca => 1
:Zz => 2ChemistryLab.oxides — Function
oxides(s::CemSpecies) -> OrderedDict{Symbol,Number}Return the oxide composition of the cement species.
ChemistryLab.oxides_charge — Function
oxides_charge(s::CemSpecies) -> OrderedDict{Symbol,Number}Return oxide composition including the charge as a :Zz key if non-zero.
ChemistryLab.aggregate_state — Method
aggregate_state(s::AbstractSpecies) -> AggregateStateReturn the aggregate state of the species.
Examples
julia> s1 = Species("H2O"; aggregate_state=AS_AQUEOUS);
julia> aggregate_state(s1) == AS_AQUEOUS
trueChemistryLab.class — Method
class(s::AbstractSpecies) -> ClassReturn the chemical class of the species.
ChemistryLab.properties — Method
properties(s::AbstractSpecies) -> OrderedDict{Symbol,PropertyType}Return the properties dictionary of the species.
ChemistryLab.check_mendeleev — Method
check_mendeleev(s::AbstractSpecies) -> BoolValidate that all element symbols in the species exist in the periodic table.
ChemistryLab.apply — Method
apply(func::Function, s::S, args...; kwargs...) where {S<:AbstractSpecies} -> SApply a function element-wise to all numeric components and properties of a species.
Arguments
func: function to apply.s: source species.args...: additional arguments for func.kwargs...: keyword arguments (including potential overrides for name, symbol, etc.).
Returns
- New species with transformed values.
Handles Quantity types, attempting to preserve dimensions when possible.