Python Dictionaries Interface Reference
- class xgems.PyxGEMS.ChemicalEngineDicts
Bases:
pybind11_objectClass for equilibrium computations and thermodynamic analysis using dictionaries. Gems interface in calculator format for easy using dictionaries.
- property IS
the ionic strength of the aqueous phase in molal.
- Return float:
Ionic strength of the aqueous phase.
Example:
print("ionic_strength", engine.ionic_strength)
- Type:
Read-only property
- property P
- Sets and gets the pressure without computing equilibrium.
Property pressure in Pascals (Pa)
Example:
engine.P = 100000.0
- property T
- Sets and gets the temperature without computing equilibrium.
Property temperature in Kelvin (K).
Example:
engine.T = 298.15
- activate_multiple_phases(self: xgems.PyxGEMS.ChemicalEngineDicts, arg0: list[str]) None
Activate multiple suppressed phases given in list.
- Parameters:
phase_name_list (list) – Phase name list.
Example:
engine.activate_multiple_phases(['Dolomite-dis', 'Tin'])
- activate_multiple_species(self: xgems.PyxGEMS.ChemicalEngineDicts, arg0: list[str]) None
Activate multiple suppressed species given in the list.
- Parameters:
species_list (list) – Species name list.
Example:
engine.suppress_multiple_species(['ClO4-', 'Cl-'])
- activate_phase(self: xgems.PyxGEMS.ChemicalEngineDicts, arg0: str) None
Activate suppressed phase in GEM calculation.
- Parameters:
phase_name (str) – Phase name.
Example:
engine.activate_phase('gas_gen')
- activate_species(self: xgems.PyxGEMS.ChemicalEngineDicts, arg0: str) None
Activate a suppressed species in phase.
- Parameters:
species_name (str) – Species name.
Example:
engine.activate_species('Ca(CO3)@')
- add_amt_from_formula(self: xgems.PyxGEMS.ChemicalEngineDicts, formula: dict[str, float], val: float, units: str = 'moles') None
Add multiple elements using user defined formula.
- Parameters:
formula (dict) – User defined formula.
val (float) – Component amount in units.
units (str) – Units of amount (“moles”, “kg”), default “moles”.
Example:
engine.add_amt_from_formula( { 'K':2, 'O':1 }, 4.108*1e-3, "kg")
- add_element_amt(self: xgems.PyxGEMS.ChemicalEngineDicts, element_name: str, val: float, units: str = 'moles') None
Add element amount in the system.
- Parameters:
element_name (str) – Element symbol.
val (float) – Element amount in units.
units (str) – Units of amount (“moles”, “kg”), default “moles”.
Example:
engine.add_element_amt( 'Al', 0.3, "moles")
- add_multiple_elements_amt(self: xgems.PyxGEMS.ChemicalEngineDicts, input_dict: dict[str, float], units: str = 'moles') None
Add multiple elements amount in the system useful for adding aqueous solution composition
- Parameters:
input_dict (dict) – Dictionary of elements amount in units.
units (str) – Units of amount (“moles”, “kg”), default “moles”.
Example:
engine.add_multiple_elements_amt( { 'Na':1.013077, 'Si':1.013077 }, "moles")
- add_multiple_species_amt(self: xgems.PyxGEMS.ChemicalEngineDicts, input_dict: dict[str, float], units: str = 'moles') None
Add multiple species amounts in the system useful for adding aqueous solution composition.
- Parameters:
input_dict (dict) – dictionary of species amount in units.
units (str) – Units of amount (“moles”, “kg”, “m3”), default “moles”.
Example:
engine.add_multiple_species_amt( { 'HCl@':0.01, 'H2@':2 }, "moles")
- add_species_amt(self: xgems.PyxGEMS.ChemicalEngineDicts, species: str, val: float, units: str = 'moles') None
Add species amount in the system useful for adding aqueous solution composition.
- Parameters:
species (str) – Species symbol.
val (float) – Species amount in units.
units (str) – Units of amount (“moles”, “kg”, “m3”), default “moles”.
Example:
engine.add_species_amt( 'H2O@', 0.01, "kg")
- property aq_composition
the dictionary for the aq solution composition in mol/kg H2O of aqueous species (speciation).
- Return dict[str:float]:
The aq solution composition in mol/kg H2O of aqueous species.
Example:
print("aq_species_molality", engine.aq_species_molality)
- Type:
Read-only property
- property aq_el_M
the dictionary for aq elements the aq solution composition in mol/L aq solution.
- Return dict[str:float]:
The aq solution composition in mol/L.
Example:
print("aq_elements_molarity", engine.aq_elements_molarity)
- Type:
Read-only property
- property aq_el_my
the dictionary for aq elements the aq solution elemental composition in mol/kgH2O.
- Return dict[str:float]:
The aq solution elemental composition in mol/kgH2O.
Example:
print("aq_elements_molality", engine.aq_elements_molality)
- Type:
Read-only property
- property aq_elements_amounts
the dictionary of the amounts of each element in the aqueous phase (in mol).
- Return dict[str:float]:
The amounts of each element in the aqueous phase (in mol).
Example:
print("aq_elements_moles", engine.aq_elements_moles)
- Type:
Read-only property
- property aq_elements_molality
the dictionary for aq elements the aq solution elemental composition in mol/kgH2O.
- Return dict[str:float]:
The aq solution elemental composition in mol/kgH2O.
Example:
print("aq_elements_molality", engine.aq_elements_molality)
- Type:
Read-only property
- property aq_elements_molarity
the dictionary for aq elements the aq solution composition in mol/L aq solution.
- Return dict[str:float]:
The aq solution composition in mol/L.
Example:
print("aq_elements_molarity", engine.aq_elements_molarity)
- Type:
Read-only property
- property aq_elements_moles
the dictionary of the amounts of each element in the aqueous phase (in mol).
- Return dict[str:float]:
The amounts of each element in the aqueous phase (in mol).
Example:
print("aq_elements_moles", engine.aq_elements_moles)
- Type:
Read-only property
- property aq_phase_symbol
the aqueous phase name.
- Return str:
Aqueous phase name. If empty, the aqueous phase is not in system.
Example:
print("aq_phase_symbol", engine.aq_phase_symbol)
- Type:
Read-only property
- property aq_sp_M
the dictionary for aq species the aq solution composition in mol/L of aqueous species.
- Return dict[str:float]:
The aq solution composition in mol/L of aqueous species.
Example:
print("aq_species_molarity", engine.aq_species_molarity)
- Type:
Read-only property
- property aq_sp_my
the dictionary for the aq solution composition in mol/kg H2O of aqueous species (speciation).
- Return dict[str:float]:
The aq solution composition in mol/kg H2O of aqueous species.
Example:
print("aq_species_molality", engine.aq_species_molality)
- Type:
Read-only property
- property aq_species_composition
the dictionary for aq elements the aq solution elemental composition in mol/kgH2O.
- Return dict[str:float]:
The aq solution elemental composition in mol/kgH2O.
Example:
print("aq_elements_molality", engine.aq_elements_molality)
- Type:
Read-only property
- property aq_species_molality
the dictionary for the aq solution composition in mol/kg H2O of aqueous species (speciation).
- Return dict[str:float]:
The aq solution composition in mol/kg H2O of aqueous species.
Example:
print("aq_species_molality", engine.aq_species_molality)
- Type:
Read-only property
- property aq_species_molarity
the dictionary for aq species the aq solution composition in mol/L of aqueous species.
- Return dict[str:float]:
The aq solution composition in mol/L of aqueous species.
Example:
print("aq_species_molarity", engine.aq_species_molarity)
- Type:
Read-only property
- property aq_volume_frac
the volume fraction of aqueous phase from total system volume.
- Return float:
The volume fraction of aqueous phase from total system volume.
Example:
print("aq_volume_frac", engine.aq_volume_frac)
- Type:
Read-only property
- property bulk_composition
the dictionary of the amounts of the elements in mol.
- Return dict[str:float]:
The amounts of the elements in mol.
Example:
print("bulk_composition", engine.bulk_composition)
- Type:
Read-only property
- clear(self: xgems.PyxGEMS.ChemicalEngineDicts, min_amount: float = 1e-15) None
Clear the amounts of elements (set the default amount for all components).
- Parameters:
min_amount (float) – min amount of element in mole, default 1e-15.
Example:
engine.clear(1e-12)
- clear_b_aq_part()
reset_aq_composition(self: xgems.PyxGEMS.ChemicalEngineDicts, min_amount: float = 1e-15) -> None
Removes bulk elemental aqueous solution composition from vector b. Be careful as this will also remove water i.e H+ and OH-.
- Parameters:
min_amount (float) – Min amount of element in mol, default 1e-15.
Example:
engine.reset_aq_composition()
- cold_start(self: xgems.PyxGEMS.ChemicalEngineDicts) None
Enables cold start for the ChemicalEngineDicts.
Cold start resets the initial guess to default values for robust convergence.
Example:
engine.cold_start()
- property element_molar_masses
the dictionary of molar masses (kg/mol) for each element.
- Return dict[str:float]:
Molar masses (kg/mol) for each element.
Example:
print("element_molar_masses", engine.element_molar_masses)
- Type:
Read-only property
- property element_names
the names of all elements in the system.
- Return list[str]:
List of elements in the system.
Example:
print("element_names", engine.element_names)
- Type:
Read-only property
- equilibrate(self: xgems.PyxGEMS.ChemicalEngineDicts) str
Computes the equilibrium stateof the current system. Uses current temperature (K), pressure (Pa), and element amounts (in mol) to compute equilibrium.
- Return str:
The string indicating the status.
Example:
engine.T = 298.15 engine.P = 100000.0 bulk_composition = {'C': 1e-08, 'Ca': 1e-08, 'Cl': 0.002, 'H': 111.016746657646, 'Mg': 0.001, 'O': 55.5083933588231, 'Sn': 130.841288437146, 'Zz': 0.0} engine.set_bulk_composition(bulk_composition) engine.equilibrate();
- Return
The function returns the string indicating the status:
No GEM re-calculation needed
Need GEM calculation with LPP (automatic) initial approximation (AIA)
OK after GEM calculation with LPP AIA
Bad (not fully trustful) result after GEM calculation with LPP AIA
Failure (no result) in GEM calculation with LPP AIA
Need GEM calculation with no-LPP (smart) IA, SIA using the previous speciation
OK after GEM calculation with SIA
Bad (not fully trustful) result after GEM calculation with SIA
Failure (no result) in GEM calculation with SIA
Terminal error in GEMS3K (e.g., memory corruption). Restart required.
- property gas_phase_symbol
the gaseous phase name. If empty, the gaseous phase is not in system.
- Return str:
Gaseous phase name. If empty, the aqueous phase is not in system.
Example:
print("gas_phase_symbol", engine.gas_phase_symbol)
- Type:
Read-only property
- get_b_from_formula(self: xgems.PyxGEMS.ChemicalEngineDicts, formula: dict[str, float], val: float = 1, units: str = 'moles', min_amount: float = 1e-15) numpy.ndarray[numpy.float64[m, 1]]
Returns a bulk vector b from user-defined formula (as dict. {“H”:2,”O”:1} ) and amount of the formula [object] in units of ‘moles’ or ‘kg’.
- Parameters:
formula (dict) – User defined formula.
val (float) – Amount of the formula [object] in units, default 1.
units (str) – Units of amount (“moles”, “kg”), default “moles”.
min_amount (float) – min amount of element in mol, default 1e-15.
- Return list[float]:
Vector of element amounts in mol.
Example:
b_from_formula = engine.get_b_from_formula( {"H":2,"O":1}, 1, "kg") print("b_from_formula", b_from_formula)
- property ionic_strength
the ionic strength of the aqueous phase in molal.
- Return float:
Ionic strength of the aqueous phase.
Example:
print("ionic_strength", engine.ionic_strength)
- Type:
Read-only property
- multiple_species_lower_bound()
set_multiple_species_lower_bound(self: xgems.PyxGEMS.ChemicalEngineDicts, input_dict: dict[str, float], units: str = ‘moles’) -> None
Sets an lower bound for multiple species.
- Parameters:
input_dict (dict) – Dictionary of species lower bound.
units (str) – Units of lower bound (“moles”, “kg”, “m3”), default “moles”.
Example:
engine.set_multiple_species_lower_bound( {'Mg(CO3)@':30, 'Mg(HCO3)+':40, 'Mg+2':50})
- multiple_species_upper_bound()
set_multiple_species_upper_bound(self: xgems.PyxGEMS.ChemicalEngineDicts, input_dict: dict[str, float], units: str = ‘moles’) -> None
Sets an upper bounds for multiple species.
- Parameters:
input_dict (dict) – Dictionary of species upper bound.
units (str) – Units of upper bound (“moles”, “kg”, “m3”), default “moles”.
Example:
engine.set_multiple_species_upper_bound( {'Mg(CO3)@':300, 'Mg(HCO3)+':400, 'Mg+2':500})
- property nelements
the number of elements in the system.
- Return int:
Number of elements in the system.
Example:
print("nelements", engine.nelements)
- Type:
Read-only property
- property nphases
the number of phases in the system.
- Return int:
Number of phases in the system.
Example:
print("nphases", engine.nphases)
- Type:
Read-only property
- property nspecies
the number of species in the system.
- Return int:
Number of species in the system.
Example:
print("nspecies", engine.nspecies)
- Type:
Read-only property
- property pE
the pe of the aqueous phase (in the activity scale (-log10 molal)).
- Return float:
pe of the aqueous phase.
Example:
print("pE", engine.pE)
- Type:
Read-only property
- property pH
the pH of the aqueous phase (in the activity scale (-log10 molal)).
- Return float:
pH of the aqueous phase.
Example:
print("pH", engine.pH)
- Type:
Read-only property
- property phase_amounts
the dictionary of the molar amounts of all phases in mol.
- Return dict[str:float]:
The molar amounts of all phases in mol.
Example:
print("phases_moles", engine.phases_moles)
- Type:
Read-only property
- property phase_elements_amounts
the dictionary of dictionaries containing mole amounts of elements for each phase (in mol).
- Return dict[str:dict[str:float]]:
The mole amounts of elements for each phase (in mol).
Example:
print("phases_elements_moles", engine.phases_elements_moles)
- Type:
Read-only property
- property phase_masses
the dictionary of phases masses in kg.
- Return dict[str:float]:
The phases masses in kg.
Example:
print("phases_mass", engine.phases_mass)
- Type:
Read-only property
- property phase_molar_volume
the dictionary of the phases molar volumes in m³/mol.
- Return dict[str:float]:
The phases molar volumes in m³/mol.
Example:
print("phases_molar_volume", engine.phases_molar_volume)
- Type:
Read-only property
- property phase_names
the names of all phases in the system.
- Return list[str]:
List of phases in the system.
Example:
print("species_names", engine.species_names)
- Type:
Read-only property
- property phase_sat_indices
the dictionary of the saturation indices of all phases (log₁₀ units).
- Return dict[str:float]:
The saturation indices of all phases.
Example:
print("phase_sat_indices", engine.phase_sat_indices)
- Type:
Read-only property
- phase_species_amounts()
phase_species_moles(*args, **kwargs) Overloaded function.
phase_species_moles(self: xgems.PyxGEMS.ChemicalEngineDicts) -> dict[str, dict[str, float]]
Get the dictionary of dictionaries containing species amounts in mol for each phase.
- Return dict[str:dict[str:float]]:
The species amounts in mol for each phase.
Example:
out = engine.phase_species_moles() for name in phase_names: print(name, out[name])
phase_species_moles(self: xgems.PyxGEMS.ChemicalEngineDicts, arg0: str) -> dict[str, float]
Get the dictionary of phase species amounts in mol.
- Parameters:
name (str) – Phases name.
- Return dict[str:float]:
The species amounts in mol.
Example:
print("phase_species_moles ('aq_gen')", engine.phase_species_moles('aq_gen'))
- property phase_species_ln_activities
the dictionary of dictionaries containing species ln Activities for each phase.
- Return dict[str:dict[str:float]]:
The species ln Activities for each phase.
Example:
print("phase_species_ln_activities ", engine.phase_species_ln_activities)
- Type:
Read-only property
- property phase_species_ln_activity_coefficients
the dictionary of dictionaries containing species ln Activity coefficients for each phase.
- Return dict[str:dict[str:float]]:
The species ln Activity coefficients for each phase.
Example:
print("phase_species_ln_activity_coefficients") out = engine.phase_species_ln_activity_coefficients for name in phase_names: print(name, out[name])
- Type:
Read-only property
- property phase_species_lower_bounds
the dictionary of dictionaries containing species lower limits in mol for each phase.
- Return dict[str:dict[str:float]]:
The species lower limits in mol for each phase.
Example:
print("phase_species_lower_bounds\n", engine.phase_species_lower_bounds)
- Type:
Read-only property
- phase_species_moles(*args, **kwargs)
Overloaded function.
phase_species_moles(self: xgems.PyxGEMS.ChemicalEngineDicts) -> dict[str, dict[str, float]]
Get the dictionary of dictionaries containing species amounts in mol for each phase.
- Return dict[str:dict[str:float]]:
The species amounts in mol for each phase.
Example:
out = engine.phase_species_moles() for name in phase_names: print(name, out[name])
phase_species_moles(self: xgems.PyxGEMS.ChemicalEngineDicts, arg0: str) -> dict[str, float]
Get the dictionary of phase species amounts in mol.
- Parameters:
name (str) – Phases name.
- Return dict[str:float]:
The species amounts in mol.
Example:
print("phase_species_moles ('aq_gen')", engine.phase_species_moles('aq_gen'))
- property phase_species_upper_bounds
the dictionary of dictionaries containing species upper limits in mol for each phase.
- Return dict[str:dict[str:float]]:
The species upper limits in mol for each phase.
Example:
print("phase_species_upper_bounds\n", engine.phase_species_upper_bounds)
- Type:
Read-only property
- property phase_volume_frac
the dictionary of phases and their volume fractions from total system volume.
- Return dict[str:float]:
The phases volume fractions from total system volume.
Example:
print("phases_volume_frac", engine.phases_volume_frac)
- Type:
Read-only property
- property phase_volumes
the dictionary of phases volumes in m³.
- Return dict[str:float]:
The phases volumes in m³.
Example:
print("phases_volume", engine.phases_volume)
- Type:
Read-only property
- property phases_SI
the dictionary of the saturation indices of all phases (log₁₀ units).
- Return dict[str:float]:
The saturation indices of all phases.
Example:
print("phase_sat_indices", engine.phase_sat_indices)
- Type:
Read-only property
- property phases_elements_moles
the dictionary of dictionaries containing mole amounts of elements for each phase (in mol).
- Return dict[str:dict[str:float]]:
The mole amounts of elements for each phase (in mol).
Example:
print("phases_elements_moles", engine.phases_elements_moles)
- Type:
Read-only property
- property phases_mass
the dictionary of phases masses in kg.
- Return dict[str:float]:
The phases masses in kg.
Example:
print("phases_mass", engine.phases_mass)
- Type:
Read-only property
- property phases_molar_volume
the dictionary of the phases molar volumes in m³/mol.
- Return dict[str:float]:
The phases molar volumes in m³/mol.
Example:
print("phases_molar_volume", engine.phases_molar_volume)
- Type:
Read-only property
- property phases_moles
the dictionary of the molar amounts of all phases in mol.
- Return dict[str:float]:
The molar amounts of all phases in mol.
Example:
print("phases_moles", engine.phases_moles)
- Type:
Read-only property
- property phases_sat_index
the dictionary of the saturation indices of all phases (log₁₀ units).
- Return dict[str:float]:
The saturation indices of all phases.
Example:
print("phase_sat_indices", engine.phase_sat_indices)
- Type:
Read-only property
- property phases_volume
the dictionary of phases volumes in m³.
- Return dict[str:float]:
The phases volumes in m³.
Example:
print("phases_volume", engine.phases_volume)
- Type:
Read-only property
- property phases_volume_frac
the dictionary of phases and their volume fractions from total system volume.
- Return dict[str:float]:
The phases volume fractions from total system volume.
Example:
print("phases_volume_frac", engine.phases_volume_frac)
- Type:
Read-only property
- reset_aq_composition(self: xgems.PyxGEMS.ChemicalEngineDicts, min_amount: float = 1e-15) None
Removes bulk elemental aqueous solution composition from vector b. Be careful as this will also remove water i.e H+ and OH-.
- Parameters:
min_amount (float) – Min amount of element in mol, default 1e-15.
Example:
engine.reset_aq_composition()
- set_bulk_composition(self: xgems.PyxGEMS.ChemicalEngineDicts, b_input: dict[str, float], min_amount: float = 1e-15) None
Sets the amounts of elements (vector b).
- Parameters:
b_input (dict) – Dictionary of elements amounts in mol.
min_amount (float) – Min amount of element in mol, default 1e-15
Example:
bulk_composition = {'C': 1e-08, 'Ca': 1e-08, 'Cl': 0.002, 'H': 111.016746657646, 'Mg': 0.001, 'O': 55.5083933588231, 'Sn': 130.841288437146, 'Zz': 0.0} engine.set_bulk_composition(bulk_composition)
- set_multiple_species_lower_bound(self: xgems.PyxGEMS.ChemicalEngineDicts, input_dict: dict[str, float], units: str = 'moles') None
Sets an lower bound for multiple species.
- Parameters:
input_dict (dict) – Dictionary of species lower bound.
units (str) – Units of lower bound (“moles”, “kg”, “m3”), default “moles”.
Example:
engine.set_multiple_species_lower_bound( {'Mg(CO3)@':30, 'Mg(HCO3)+':40, 'Mg+2':50})
- set_multiple_species_upper_bound(self: xgems.PyxGEMS.ChemicalEngineDicts, input_dict: dict[str, float], units: str = 'moles') None
Sets an upper bounds for multiple species.
- Parameters:
input_dict (dict) – Dictionary of species upper bound.
units (str) – Units of upper bound (“moles”, “kg”, “m3”), default “moles”.
Example:
engine.set_multiple_species_upper_bound( {'Mg(CO3)@':300, 'Mg(HCO3)+':400, 'Mg+2':500})
- set_species_G0(self: xgems.PyxGEMS.ChemicalEngineDicts, arg0: str, arg1: float) None
Sets the standard molar Gibbs energy for a species (J/mol).
- Parameters:
name (str) – Species name.
value (float) – Standard molar Gibbs energy value (J/mol).
Example:
engine.set_species_G0("H2O", -237.13)
- set_species_lower_bound(*args, **kwargs)
Overloaded function.
set_species_lower_bound(self: xgems.PyxGEMS.ChemicalEngineDicts, species: str, val: float, units: str = ‘moles’) -> None
Sets a lower bound for a species identified by name.
- Parameters:
species (str) – Species name.
val (float) – Lower limit in units.
units (str) – Units of amount (“moles”, “kg”, “m3”), default “moles”.
Example:
engine.set_species_lower_bound( 'Ca(HCO3)+', 200, "moles")
set_species_lower_bound(self: xgems.PyxGEMS.ChemicalEngineDicts, ispecies: int, val: float, units: str = ‘moles’) -> None
Sets a lower bound (minimum amount allowed to form) for a species identified by its index (phase depended case).
- Parameters:
ispecies (int) – Index of the species.
val (float) – Lower limit in units.
units (str) – Units of amount (“moles”, “kg”, “m3”), default “moles”.
Example:
engine.set_species_lower_bound( 8, 400, "moles")
- set_species_upper_bound(*args, **kwargs)
Overloaded function.
set_species_upper_bound(self: xgems.PyxGEMS.ChemicalEngineDicts, species: str, val: float, units: str = ‘moles’) -> None
Sets an upper bound for a species identified by name.
- Parameters:
species (str) – Species name.
val (float) – Upper limit in units.
units (str) – Units of amount (“moles”, “kg”, “m3”), default “moles”.
Example:
engine.set_species_upper_bound( 'CaOH+', 500, "kg")
set_species_upper_bound(self: xgems.PyxGEMS.ChemicalEngineDicts, ispecies: int, val: float, units: str = ‘moles’) -> None
Sets an upper bound (maximum amount allowed to form) for a species identified by its index (phase depended case).
- Parameters:
ispecies (int) – Index of the species.
val (float) – Upper limit in units.
units (str) – Units of amount (“moles”, “kg”, “m3”), default “moles”.
Example:
engine.set_species_lower_bound( 8, 400, "moles")
- set_vector_b()
set_bulk_composition(self: xgems.PyxGEMS.ChemicalEngineDicts, b_input: dict[str, float], min_amount: float = 1e-15) -> None
Sets the amounts of elements (vector b).
- Parameters:
b_input (dict) – Dictionary of elements amounts in mol.
min_amount (float) – Min amount of element in mol, default 1e-15
Example:
bulk_composition = {'C': 1e-08, 'Ca': 1e-08, 'Cl': 0.002, 'H': 111.016746657646, 'Mg': 0.001, 'O': 55.5083933588231, 'Sn': 130.841288437146, 'Zz': 0.0} engine.set_bulk_composition(bulk_composition)
- solid_elements_amounts()
solids_elements_moles(self: xgems.PyxGEMS.ChemicalEngineDicts, min_amount_phase: float = 1e-12, min_amount_element: float = 1e-14) -> dict[str, float]
Returns the dictionary of the mole amounts of elements in all solids together.
- Parameters:
min_amount_phase (float) – Min amount of phase in mol, default 1e-12.
min_amount_element (float) – Min amount of element in mol, default 1e-14.
- Return dict[str:float]:
The mole amounts of elements.
Example:
print("solids_elements_moles", engine.solids_elements_moles())
- property solid_mass_frac
the dictionary of the mass(phase)/mass(system) ratios for [solid] phases.
- Return dict[str:float]:
The mass(phase)/mass(system) ratios for [solid] phases.
Example:
print("solids_mass_frac", engine.solids_mass_frac)
- Type:
Read-only property
- property solid_volume_frac
the dictionary of the volume(phase)/volume(total) ratio for solid phases.
- Return dict[str:float]:
The volume(phase)/volume(total) ratio for solid phases.
Example:
print("solids_volume_frac", engine.solids_volume_frac)
- Type:
Read-only property
- solids_elements_moles(self: xgems.PyxGEMS.ChemicalEngineDicts, min_amount_phase: float = 1e-12, min_amount_element: float = 1e-14) dict[str, float]
Returns the dictionary of the mole amounts of elements in all solids together.
- Parameters:
min_amount_phase (float) – Min amount of phase in mol, default 1e-12.
min_amount_element (float) – Min amount of element in mol, default 1e-14.
- Return dict[str:float]:
The mole amounts of elements.
Example:
print("solids_elements_moles", engine.solids_elements_moles())
- property solids_mass_frac
the dictionary of the mass(phase)/mass(system) ratios for [solid] phases.
- Return dict[str:float]:
The mass(phase)/mass(system) ratios for [solid] phases.
Example:
print("solids_mass_frac", engine.solids_mass_frac)
- Type:
Read-only property
- property solids_volume_frac
the dictionary of the volume(phase)/volume(total) ratio for solid phases.
- Return dict[str:float]:
The volume(phase)/volume(total) ratio for solid phases.
Example:
print("solids_volume_frac", engine.solids_volume_frac)
- Type:
Read-only property
- property species_amounts
the dictionary of the amounts of all species in mol.
- Return dict[str:float]:
The amounts of all species in mol.
Example:
print("species_moles", engine.species_moles)
- Type:
Read-only property
- property species_charges
the dictionary of the electrical charge of a species.
- Return dict[str:float]:
The electrical charge of a species.
Example:
out = engine.species_charges for name in engine.species_names: #print fixed order to compare print(name, out[name])
- Type:
Read-only property
- property species_in_phase
the dictionary of the names of all species for each phase in the system.
- Return dict[str:list[str]]:
List of all species for each phase in the system.
Example:
out = engine.species_in_phase for name in engine.phase_names: #print fixed order to compare print(name, out[name])
- Type:
Read-only property
- property species_ln_activities
the dictionary of the ln activities of all species.
- Return dict[str:float]:
The ln activities of all species.
Example:
print("species_ln_activities", engine.species_ln_activities)
- Type:
Read-only property
- property species_ln_activity_coefficients
the dictionary of the ln activity coefficients of all species (mole fraction scale).
- Return dict[str:float]:
The ln activity coefficients of all species.
Example:
print("species_ln_activity_coefficients", engine.species_ln_activity_coefficients)
- Type:
Read-only property
- property species_lower_bounds
the dictionary of the species lower limits in mol.
- Return dict[str:float]:
The species lower limits in mol.
Example:
out = engine.species_lower_bounds for name in species_names: print(name, out[name])
- Type:
Read-only property
- property species_molar_mass
the dictionary of the species molar masses (kg/mol).
- Return dict[str:float]:
The species molar masses (kg/mol).
Example:
out = engine.species_molar_mass for name in engine.species_names: #print fixed order to compare print(name, out[name])
- Type:
Read-only property
- property species_molar_volumes
the dictionary of the species standard molar volumes in m³/mol.
- Return dict[str:float]:
The species standard molar volumes in m³/mol.
Example:
out = engine.species_molar_volumes for name in engine.species_names: #print fixed order to compare print(name, out[name])
- Type:
Read-only property
- property species_moles
the dictionary of the amounts of all species in mol.
- Return dict[str:float]:
The amounts of all species in mol.
Example:
print("species_moles", engine.species_moles)
- Type:
Read-only property
- property species_names
the names of all species in the system.
- Return list[str]:
List of species in the system.
Example:
print("species_names", engine.species_names)
- Type:
Read-only property
- property species_upper_bounds
the dictionary of the species upper limits in mol.
- Return dict[str:float]:
The species upper limits in mol.
Example:
out = engine.species_upper_bounds for name in species_names: print(name, out[name])
- Type:
Read-only property
- suppress_multiple_phases(self: xgems.PyxGEMS.ChemicalEngineDicts, phase_name_list: list[str], min_amount: float = 0, max_amount: float = 1e-15) None
Suppresses multiple phases in calculation as given in phase names list.
- Parameters:
phase_name_list (list) – Phase name list.
min_amount (float) – Lower amount of specie in mol, default 0.
max_amount (float) – Upper amount of specie in mol, default 1e-15.
Example:
engine.suppress_multiple_phases(['Dolomite-dis', 'Tin'])
- suppress_multiple_species(self: xgems.PyxGEMS.ChemicalEngineDicts, species_list: list[str], min_amount: float = 0, max_amount: float = 1e-15) None
Suppresses multiple species in in GEM calculation as given in species name list.
- Parameters:
species_list (list) – Species name list.
min_amount (float) – Lower amount of specie in mol, default 0.
max_amount (float) – Upper amount of specie in mol, default 1e-15.
Example:
engine.suppress_multiple_species(['ClO4-', 'Cl-'])
- suppress_phase(self: xgems.PyxGEMS.ChemicalEngineDicts, phase_name: str, min_amount: float = 0, max_amount: float = 1e-15) None
Suppresses a phase in GEM calculation.
- Parameters:
phase_name (str) – Phase name.
min_amount (float) – Lower amount of specie in mol, default 0.
max_amount (float) – Upper amount of specie in mol, default 1e-15.
Example:
engine.suppress_phase('gas_gen')
- suppress_species(self: xgems.PyxGEMS.ChemicalEngineDicts, species_name: str, min_amount: float = 0, max_amount: float = 1e-15) None
Suppresses a specie in calculation.
- Parameters:
species_name (str) – Species name.
min_amount (float) – Lower amount of specie in mol, default 0.
max_amount (float) – Upper amount of specie in mol, default 1e-15.
Example:
engine.suppress_species('Ca(CO3)@')
- property system_mass
the total mass of the system in kg.
- Return float:
Total mass of the system in kg.
Example:
print("system_mass", engine.system_mass)
- Type:
Read-only property
- property system_volume
the total volume of the system in m³.
- Return float:
Total volume of the system in m³.
Example:
print("system_volume", engine.system_volume)
- Type:
Read-only property
- property vector_b
the dictionary of the amounts of the elements in mol.
- Return dict[str:float]:
The amounts of the elements in mol.
Example:
print("bulk_composition", engine.bulk_composition)
- Type:
Read-only property
- vector_b_from_formula()
get_b_from_formula(self: xgems.PyxGEMS.ChemicalEngineDicts, formula: dict[str, float], val: float = 1, units: str = ‘moles’, min_amount: float = 1e-15) -> numpy.ndarray[numpy.float64[m, 1]]
Returns a bulk vector b from user-defined formula (as dict. {“H”:2,”O”:1} ) and amount of the formula [object] in units of ‘moles’ or ‘kg’.
- Parameters:
formula (dict) – User defined formula.
val (float) – Amount of the formula [object] in units, default 1.
units (str) – Units of amount (“moles”, “kg”), default “moles”.
min_amount (float) – min amount of element in mol, default 1e-15.
- Return list[float]:
Vector of element amounts in mol.
Example:
b_from_formula = engine.get_b_from_formula( {"H":2,"O":1}, 1, "kg") print("b_from_formula", b_from_formula)
- warm_start(self: xgems.PyxGEMS.ChemicalEngineDicts) None
Enables warm start for the ChemicalEngineDicts.
Warm start uses the previous solution as an initial guess for faster convergence.
Example:
engine.warm_start()