Reference
Contents
Index
ChemistryLab.extract_primary_speciesChemistryLab.get_aqueous_speciesChemistryLab.issubscriptChemistryLab.issuperscriptChemistryLab.merge_jsonChemistryLab.merge_reactionsChemistryLab.normal_to_subChemistryLab.normal_to_superChemistryLab.parse_float_arrayChemistryLab.parse_phasesChemistryLab.parse_reaction_stoich_cemdataChemistryLab.read_thermofunChemistryLab.sub_to_normalChemistryLab.super_to_normalChemistryLab.write_reaction
ChemistryLab.extract_primary_species — Methodextract_primary_species(file_path)Extract primary species from a Cemdata .dat file, returning a DataFrame.
Arguments
file_path: Path to the Cemdata .dat file.
Returns
- DataFrame of primary species.
ChemistryLab.get_aqueous_species — Methodget_aqueous_species(json_data)Extract the set of aqueous species from a ThermoFun JSON data structure.
Arguments
json_data: Parsed JSON object containing a "substances" field.
Returns
Set{String}: Set of aqueous species symbols.
ChemistryLab.issubscript — MethodReturn whether c is a numeric subscript.
ChemistryLab.issuperscript — MethodReturn whether c is a numeric superscript or ⁺/⁻.
ChemistryLab.merge_json — Methodmerge_json(json_path, dat_path, output_path)Merge a Cemdata .dat file into a ThermoFun JSON, preserving field order.
Arguments
json_path: Path to the original JSON file.dat_path: Path to the Cemdata .dat file.output_path: Path to write the merged JSON.
Returns
- Nothing. Writes the merged JSON to
output_path.
ChemistryLab.merge_reactions — Methodmerge_reactions(json_data, new_reactions)Merge new reactions into a ThermoFun JSON structure, skipping duplicates.
Arguments
json_data: The parsed JSON object containing a "reactions" field.new_reactions: Dictionary of new reactions to add.
Returns
- The updated JSON object with merged reactions.
ChemistryLab.normal_to_sub — MethodConvert all normal characters in s to numeric subscripts .
ChemistryLab.normal_to_super — MethodConvert all normal characters or +/- in s to numeric superscripts.
ChemistryLab.parse_float_array — Methodparse_float_array(line)Parse a line containing a float array (e.g., -analytical_expression) and return the array of Float64 values.
Arguments
line: The line to parse.
Returns
Vector{Float64}: Array of parsed float values.
ChemistryLab.parse_phases — Methodparse_phases(dat_content, aqueous_species)Parse the PHASES section of a Cemdata .dat file, extracting phase info and reactions.
Arguments
dat_content: The content of the Cemdata .dat file as a string.aqueous_species: Set of aqueous species symbols.
Returns
Dict{String, Any}: Dictionary of phase names to their data.
ChemistryLab.parse_reaction_stoich_cemdata — Functionparse_reaction_stoich_cemdata(reaction_line::AbstractString, aqueous_species, gaseous=false)Parse a Cemdata/Phreeqc reaction line, adding "@" for aqueous species as needed.
Arguments
reaction_line::AbstractString: The reaction line from a Cemdata .dat file.aqueous_species: Set of aqueous species symbols.gaseous: Boolean indicating if the phase is gaseous.
Returns
reactants: Array of Dicts with "symbol" and "coefficient" for each reactant/product.modified_equation: The formatted equation string.comment: Any comment found on the line.
ChemistryLab.read_thermofun — Methodread_thermofun(filename)Read a ThermoFun JSON file and return DataFrames for elements, substances, and reactions.
Arguments
filename: Path to the ThermoFun JSON file.
Returns
df_elements: DataFrame of elements.df_substances: DataFrame of substances.df_reactions: DataFrame of reactions.
ChemistryLab.sub_to_normal — MethodConvert all numeric subscripts in s to normal line.
ChemistryLab.super_to_normal — MethodConvert all numeric superscripts or ⁺/⁻ in s to normal line.
ChemistryLab.write_reaction — Methodwrite_reaction(f, reaction)Write a reaction Dict as JSON to a file (used for custom JSON output).
Arguments
f: An open IO stream to write to.reaction: The reaction dictionary to write.
Returns
- Nothing. Writes directly to the file.