Reference

Contents

Index

ChemistryLab.extract_primary_speciesMethod
extract_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.
source
ChemistryLab.get_aqueous_speciesMethod
get_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.
source
ChemistryLab.merge_jsonMethod
merge_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.
source
ChemistryLab.merge_reactionsMethod
merge_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.
source
ChemistryLab.parse_float_arrayMethod
parse_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.
source
ChemistryLab.parse_phasesMethod
parse_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.
source
ChemistryLab.parse_reaction_stoich_cemdataFunction
parse_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.
source
ChemistryLab.read_thermofunMethod
read_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.
source
ChemistryLab.write_reactionMethod
write_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.
source