pycalphad.mapping package

Subpackages

Submodules

pycalphad.mapping.compat_api module

pycalphad.mapping.compat_api.binplot(database, components, phases, conditions, return_strategy=False, plot_kwargs=None, **map_kwargs)[source]

Calculate the binary isobaric phase diagram.

Parameters:
  • database (Database) – Thermodynamic database containing the relevant parameters.

  • components (Sequence[str]) – Names of components to consider in the calculation.

  • phases (Sequence[str]) – Names of phases to consider in the calculation.

  • conditions (Mapping[v.StateVariable, Union[float, Tuple[float, float, float]]]) – Maps StateVariables to values and/or iterables of values. For binplot only one changing composition and one potential coordinate each is supported.

  • return_strategy (bool, optional) – Return the BinaryStrategy object in addition to the Axes. Defaults to False.

  • map_kwargs (dict, optional) – Additional keyword arguments to BinaryStrategy().

  • plot_kwargs (dict, optional) –

    Keyword arguments to plot_binary() Possible key,val pairs in plot_kwargs

    label_nodesbool

    Whether to plot points for phases on three-phase regions Default = False

    tieline_colortuple

    Color for tielines Default = (0,1,0,1)

    tie_triangle_colortuple

    Color for tie triangles Default = (1,0,0,1)

Returns:

  • Axes – Matplotlib Axes of the phase diagram

  • (Axes, BinaryStrategy) – If return_strategy is True.

pycalphad.mapping.compat_api.ternplot(dbf, comps, phases, conds, x=None, y=None, return_strategy=False, map_kwargs=None, **plot_kwargs)[source]

Calculate the ternary isothermal, isobaric phase diagram.

Parameters:
  • dbf (Database) – Thermodynamic database containing the relevant parameters.

  • comps (Sequence[str]) – Names of components to consider in the calculation.

  • phases (Sequence[str]) – Names of phases to consider in the calculation.

  • conds (Mapping[v.StateVariable, Union[float, Tuple[float, float, float]]]) – Maps StateVariables to values and/or iterables of values. For ternplot only two changing composition coordinates is supported.

  • x (v.MoleFraction) – instance of a pycalphad.variables.composition to plot on the x-axis. Must correspond to an independent condition.

  • y (v.MoleFraction) – instance of a pycalphad.variables.composition to plot on the y-axis. Must correspond to an independent condition.

  • return_strategy (bool, optional) – Return the TernaryStrategy object in addition to the Axes. Defaults to False.

  • label_nodes (bool (optional)) – Whether to plot points for phases on three-phase regions Default = False

  • tieline_color (tuple (optional)) – Color for tielines Default = (0,1,0,1)

  • tie_triangle_color (tuple (optional)) – Color for tie triangles Default = (1,0,0,1)

  • map_kwargs (dict, optional) – Additional keyword arguments to TernaryStrategy().

  • plot_kwargs (dict, optional) – Keyword arguments to plot_ternary().

Returns:

  • Axes – Matplotlib Axes of the phase diagram

  • (Axes, TernaryStrategy) – If return_strategy is True.

pycalphad.mapping.plotting module

pycalphad.mapping.plotting.get_label(var: StateVariable)[source]
pycalphad.mapping.plotting.plot_binary(strategy: ~pycalphad.mapping.strategy.binary_strategy.BinaryStrategy, x: ~pycalphad.variables.StateVariable | None = None, y: ~pycalphad.variables.StateVariable | None = None, ax=None, tielines=1, label_nodes=False, legend_generator=<function phase_legend>, tieline_color=(0, 1, 0, 1), tie_triangle_color=(1, 0, 0, 1), *args, **kwargs)[source]

Plots binary map using matplotlib

Parameters:
  • strategy (BinaryStrategy or TernaryStrategy)

  • x (v.StateVariable)

  • y (v.StateVariable)

  • ax (matplotlib axes (optional)) – A new axis object will be made if not supplied

  • tielines (int or False (optional)) – Default = 1 int - plots every n tieline False - only plots phase boundaries

  • label_node (bool (optional)) – Default = False Plots points on nodes for each phase if true

  • legend_generator (function that creates legend handles and colors for list of phases)

  • tieline_color (color)

  • tie_triangle_color (color)

Return type:

Matplotlib axis

pycalphad.mapping.plotting.plot_invariants(ax, strategy: BinaryStrategy | TernaryStrategy, x: StateVariable, y: StateVariable, phase_colors, label_end_points: bool = False, tie_triangle_color=(1, 0, 0, 1))[source]

Plots node data from BinaryStrategy or TernaryStrategy onto matplotlib axis

Parameters:
  • ax (matplotlib axis)

  • strategy (BinaryStrategy or TernaryStrategy)

  • x (v.StateVariable)

  • y (v.StateVariable)

  • phase_colors (dict[str, color]) – Color to plot end points if set

  • label_end_points (bool)

  • tie_triangle_color (color) – Color to plot node

pycalphad.mapping.plotting.plot_isopleth(strategy: ~pycalphad.mapping.strategy.isopleth_strategy.IsoplethStrategy, x: ~pycalphad.variables.StateVariable | None = None, y: ~pycalphad.variables.StateVariable | None = None, ax=None, legend_generator=<function phase_legend>, tie_triangle_color=(1, 0, 0, 1), *args, **kwargs)[source]

Plots isopleth map using matplotlib

Parameters:
  • strategy (IsoplethStrategy)

  • x (v.StateVariable)

  • y (v.StateVariable)

  • ax (matplotlib axes (optional)) – A new axis object will be made if not supplied

  • legend_generator (function that creates legend handles and colors for list of phases)

  • tie_triangle_color (color)

Return type:

Matplotlib axis

pycalphad.mapping.plotting.plot_step(strategy: ~pycalphad.mapping.strategy.step_strategy.StepStrategy, x: ~pycalphad.variables.StateVariable | None = None, y: ~pycalphad.variables.StateVariable | None = None, ax=None, legend_generator=<function phase_legend>, set_nan_to_zero=True, *args, **kwargs)[source]

Plots step map using matplotlib

Parameters:
  • strategy (StepStrategy)

  • x (v.StateVariable)

  • y (v.StateVariable)

  • ax (matplotlib axes (optional)) – A new axis object will be made if not supplied

  • legend_generator (function that creates legend handles and colors for list of phases)

Return type:

Matplotlib axis

pycalphad.mapping.plotting.plot_ternary(strategy: ~pycalphad.mapping.strategy.ternary_strategy.TernaryStrategy, x: ~pycalphad.variables.StateVariable | None = None, y: ~pycalphad.variables.StateVariable | None = None, ax=None, tielines=1, label_nodes=False, legend_generator=<function phase_legend>, tieline_color=(0, 1, 0, 1), tie_triangle_color=(1, 0, 0, 1), *args, **kwargs)[source]

Plots ternary map using matplotlib

Pretty much the same as binary mapping but some extra stuff to create defualt triangular axis, limit axis limits to (0,1) and set y label position if axis is triangular

Parameters:
  • strategy (Ternary strategy)

  • x (v.StateVariable)

  • y (v.StateVariable)

  • ax (matplotlib axes (optional)) – A new axis object will be made if not supplied

  • tielines (int or False (optional)) – Default = 1 int - plots every n tieline False - only plots phase boundaries

  • label_node (bool (optional)) – Default = False Plots points on nodes for each phase if true

  • legend_generator (function that creates legend handles and colors for list of phases)

  • tieline_color (color)

  • tie_triangle_color (color)

Return type:

Matplotlib axis

pycalphad.mapping.plotting.plot_tielines(ax, strategy: BinaryStrategy | TernaryStrategy, x: StateVariable, y: StateVariable, phase_colors, tielines=1, tieline_color=(0, 1, 0, 1))[source]

Plots tieline data from BinaryStrategy or TernaryStrategy onto matplotlib axis

Parameters:
  • ax (matplotlib axis)

  • strategy (BinaryStrategy or TernaryStrategy)

  • x (v.StateVariable)

  • y (v.StateVariable)

  • phase_colors (dict[str, color]) – Color to plot end points if set

  • tielines (int or False) – int - plots every n tielines False - only plots phase boundaries

  • tieline_color (color)

pycalphad.mapping.primitives module

class pycalphad.mapping.primitives.Direction(value)[source]

Bases: Enum

An enumeration.

NEGATIVE = -1
POSITIVE = 1
class pycalphad.mapping.primitives.ExitHint(value)[source]

Bases: Enum

Exit rules

NORMAL - will search for all viable exits from node

ignores the exit that corresponds to the ZPF line that found the node

POINT_IS_EXIT - will use the point composition sets as the exit

this is mainly used for starting points since the point may not necessary fit the conditions for a “node” (0 DOF)

NORMAL = 0
POINT_IS_EXIT = 1
class pycalphad.mapping.primitives.Node(global_conditions: Mapping[StateVariable, float], chemical_potentials: List[float], _fixed_composition_sets: List[CompositionSet], _free_composition_sets: List[CompositionSet], parent: Point, axis_var: StateVariable | None = None, axis_direction: Direction | None = None, exit_hint: ExitHint = ExitHint.NORMAL)[source]

Bases: Point

A Node is a special case of a Point that indicates a set of conditions corresponding to a phase change.

It also keeps track of the parent Point that it was created from, so that users of the class can determine which exits from the node are novel.

Compared to its parent, the set of conditions should be the same (both keys and values) and the set of stable phases should differ by exactly one phase.

We’ll keep track of the axis variable and direction as well

By default, they will be None and the direction will be decided later

Parameters:
  • parent (Point) – Point where Node conditions were found from

  • axis_var (v.StateVariable) – Axis variable that parent was stepping in to find node

  • axis_direction (Direction) – Axis direction that parent was steppig in to find node

  • exit_hint (ExitHint) – Hints for how exits should be found from this node

axis_direction: Direction = None
axis_var: StateVariable = None
exit_hint: ExitHint = 0
has_point_been_encountered(point: Point, test_fixed=False)[source]
parent: Point
class pycalphad.mapping.primitives.NodeQueue[source]

Bases: object

Not exactly a queue, but functions as a queue with adding and getting node in FIFO order

If we were to use a Queue, we would have to compare the current Node with a buffer stored in the mapper to check for repeating nodes So using a List allows the Node checking implementation to be here instead

When getting a node, it will return the node at the current node index and increase the index counter

Queue is empty once the index counter points to the last node As we don’t remove any nodes from the list (partly because we have to check for repeated nodes), we’ll assume this will be small enough to not cause memory issues

add_node(candidate_node: Node, force=False) bool[source]
Checks candidate_node to see if it has been added before

If it has been added before, add parent to the encountered points list in the node When we have multiple start points, we have the chance of encountering a node from multiple ZPF lines By keeping a list of all points that lead to this node, we can reduce the number of exits to avoid double calculating ZPF lines

Force will force add candidate_node, this is useful for starting the zpf line within a two-phase field

get_next_node()[source]
is_empty()[source]

Since this isn”t a true queue, we can track if the node queue is “empty” by check if the current node index reaches the length of the node list

This is just so we don”t have to raise an exception when the queue is empty

size()[source]

Length of the node queue will be how many nodes are left

exception pycalphad.mapping.primitives.NodesExhaustedError[source]

Bases: Exception

class pycalphad.mapping.primitives.Point(global_conditions: Mapping[StateVariable, float], chemical_potentials: List[float], _fixed_composition_sets: List[CompositionSet], _free_composition_sets: List[CompositionSet])[source]

Bases: object

Stores data for a single point on the map This will include everything needed to compute any property within the Workspace API. Fixed and free composition sets are split for easy accounting.

Parameters:
  • global_conditions (dict[v.StateVariable, float]) – List of conditions that point was found at NOTE: generally, Point in mapping is solved from stepping, which frees up a variable, but the freed variable will be included in global_conditions for bookkeeping

  • chemical_potentials ([float])

  • _fixed_composition_sets ([CompositionSet])

  • _free_composition_sets ([CompositionSet])

chemical_potentials: List[float]
compare_consider_fixed_cs(other)[source]

This equality accounts for fixed composition sets so we can check if two points are exactly the same This also ignores phase fraction

create_copy()[source]
property fixed_composition_sets: List[CompositionSet]
property fixed_phases
property fixed_phases_with_multiplicity
property free_composition_sets: List[CompositionSet]
property free_phases
property free_phases_with_multiplicity
get_local_property(comp_set: CompositionSet, var: StateVariable)[source]

Another wrapper around compute property, this time, it is applied to a single composition set

We take the assumption here that NP = 1, so we have to correct for v.X and v.NP

get_property(var: StateVariable)[source]

Wrapper around compute property so I don’t have long lines of code getting composition sets, conditions and chemical potentials everywhere We will also squeeze the results since v.MoleFraction seems to return an array

global_conditions: Mapping[StateVariable, float]
property stable_composition_sets
property stable_composition_sets_flipped
property stable_phases
property stable_phases_with_multiplicity
classmethod with_copy(*args, **kwargs)[source]
class pycalphad.mapping.primitives.ZPFLine(fixed_phases: List[str], free_phases: List[str])[source]

Bases: object

ZPF line represents a line where a phase change occur (crossing the bounding will add or remove a phase, and that phase is 0 at the boundary) Number of phases is constant along this line Defines a list of fixed phases (the zero phases) and list of free phases and list of Point that represents the line

Parameters:
  • fixed_phases (list[str]) – List of fixed phases on ZPF line

  • free_phases (list[str]) – List of free phases on ZPF line

fixed_phases

List of fixed phases on ZPF line

Type:

list[str]

free_phases

List of free phases on ZPF line

Type:

list[str]

points

List of points found on ZPF line

Type:

list[Point]

status

Current state of ZPF line for whether to continue stepping

Type:

ZPFState

axis_var

Axis variable to step ZPF line in

Type:

v.StateVariable

axis_direction

Direction to set ZPF line in

Type:

Direction

current_delta

Step size of axis variable to step ZPF line in

Type:

float

append(point: Point)[source]
property fixed_phases_with_multiplicity
property free_phases_with_multiplicity
get_var_list(var: StateVariable)[source]

Gets variable along ZPF line and returns list The variables will decipher between local and global variables

num_fixed_phases()[source]
num_free_phases()[source]
property stable_phases
property stable_phases_with_multiplicity
class pycalphad.mapping.primitives.ZPFState(value)[source]

Bases: Enum

NOT_FINISHED - zpf line is not finished NEW_NODE_FOUND - zpf line lead to a new node (either added or removed a composition set) REACHED_LIMIT - zpf line reached an axis limit FAILED - zpf line ended improperly (error in equilibrium calculation, couldn’t find a new node) ATTEMPT_NEW_STEP - zpf line failed, but should try stepping again (case here is when the current_delta needs to be reduced)

This is to track whether a zpf line ends prematurely, and if so, we may attempt to force another starting point

ATTEMPT_NEW_STEP = 4
FAILED = 3
NEW_NODE_FOUND = 1
NOT_FINISHED = 0
REACHED_LIMIT = 2

pycalphad.mapping.starting_points module

pycalphad.mapping.starting_points.point_from_equilibrium(dbf: Database, components: list[str], phases: list[str], conditions: dict[StateVariable, float], **eq_kwargs)[source]

Computes equilibrium to get a starting Point

Parameters:
  • dbf (Database)

  • components ([str])

  • phases ([str])

  • conditions (dict[v.StateVariable, float])

  • eq_kwargs (dict) – Additional arguments for Workspace (models, phase records, etc.)

pycalphad.mapping.utils module

pycalphad.mapping.utils.degrees_of_freedom(point: Point | Node, components: list[str], num_potential_conditions: int)[source]

Degrees of freedom of point defined by Gibbs phase rule

Components + 2 = Phases + DOF

2 is offsetted by the number of potential conditions

Parameters:
  • point (Point or Node)

  • components ([str]) – List of components, VA will be ignored

  • num_potential_conditions (number of variable potential conditions)

Return type:

int - degrees of freedom, 0 represents an invariant point/node

pycalphad.mapping.utils.get_statevars_array(conditions: dict[StateVariable, float], state_variables: list[StateVariable] | None = None)[source]

Creates numpy array of state variables in conditions

Parameters:

conditions (dict[v.StateVariable, float])

Return type:

numpy array of len(state variables)

pycalphad.mapping.utils.is_state_variable(var: StateVariable)[source]

Returns whether var is a state variable or not

pycalphad.mapping.utils.update_cs_phase_frac(comp_set: CompositionSet, phase_frac: float)[source]

Wrapper to update the phase fraction of a composition set This just helps with splitting the cs.dof to state variables and constituents when updating

Parameters:

pycalphad.mapping.zpf_checks module

pycalphad.mapping.zpf_checks.check_axis_values(zpf_line: ZPFLine, step_results: tuple[Point, list[CompositionSet]], axis_data: Mapping, **kwargs)[source]

Checks both if axis values are within axis limits and if the axis values hadn”t moved to far from previous point

The two checks are separated from here so that we can use them in _check_global_min and _check_change_in_phases

3 possible outcomes
  1. Axes are within limits and minimal distance change -> pass

  2. Axes are outside limits -> end zpf line with graceful ending

  3. Distance changed too much -> end zpf line with unexpected ending

Parameters:
  • zpf_line (ZPFLine) – ZPFLine that the point is stepping in

  • step_results ([Point, [CompositionSet]]) – Results from zpf_equilibrium.update_equilibrium_with_new_conditions

  • axis_data (dict) – Axis variable data from a map strategy class

Returns:

  • None - this check does not produce any new nodes

  • This will end zpf_line with FAILED or REACHED_LIMIT depending on test that failed

pycalphad.mapping.zpf_checks.check_change_in_phases(zpf_line: ZPFLine, step_results: tuple[Point, list[CompositionSet]], axis_data: Mapping, **kwargs)[source]
If the number of phases changed upon stepping, then attempt to create a new node

If making the new node was unsuccessful, then we end the zpf line anyways

3 possible outcomes
  1. No change in phases -> pass

  2. Change in phases, node successfully found -> process new node and end zpf line with graceful ending

  3. Change in phases, node not found -> end zpf line with unexpected ending

Parameters:
  • zpf_line (ZPFLine) – ZPFLine that the point is stepping in

  • step_results ([Point, [CompositionSet]]) – Results from zpf_equilibrium.update_equilibrium_with_new_conditions

  • axis_data (dict) – Axis variable data from a map strategy class

Returns:

  • new_node (Node) – Node from step_results if there is a change in phases

  • or

  • None (if step_results does not result in a change in phase) – or new node cannot be found (zpf_line will be ended)

pycalphad.mapping.zpf_checks.check_global_min(zpf_line: ZPFLine, step_results: tuple[Point, list[CompositionSet]], axis_data: Mapping, **kwargs)[source]

Check if the point is global minimum 1. Check if a new composition set can be added that can lower free energy 2. Create a new node with the additional composition set 3. Check that the new node is valid

3 possible outcomes
  1. No change in phases -> pass

  2. Change in phases, node successfully found -> process new node and end zpf line with graceful ending

  3. Change in phases, node not found -> end zpf line with unexpected ending

Parameters:
  • zpf_line (ZPFLine) – ZPFLine that the point is stepping in

  • step_results ([Point, [CompositionSet]]) – Results from zpf_equilibrium.update_equilibrium_with_new_conditions

  • axis_data (dict) – Axis variable data from a map strategy class

Returns:

  • new_node (Node) – Node from step_results if global min is found

  • or

  • None (if step_results is still global min) – or new node cannot be found (zpf_line will be ended)

pycalphad.mapping.zpf_checks.check_similar_phase_composition(zpf_line: ZPFLine, step_results: tuple[Point, list[CompositionSet]], axis_data: Mapping, **kwargs)[source]

If two composition sets are close in composition, then we stop zpf line pre-maturely so that they don”t go on top of each other

If the composition are the same, it can result in ill-defined matrices in the solver

2 possible outcomes
  1. Composition sets are separate -> pass

  2. Composition sets are similar -> end zpf line with unexpected ending

Parameters:
  • zpf_line (ZPFLine) – ZPFLine that the point is stepping in

  • step_results ([Point, [CompositionSet]]) – Results from zpf_equilibrium.update_equilibrium_with_new_conditions

  • axis_data (dict) – Axis variable data from a map strategy class

Returns:

  • None (this check does not attempt to make a new node)

  • However, the zpf line will end if this check fails

pycalphad.mapping.zpf_checks.check_valid_point(zpf_line: ZPFLine, step_results: tuple[Point, list[CompositionSet]], axis_data: Mapping, **kwargs)[source]
3 possible outcomes
  1. Converged equilibrium -> pass

  2. Failed equilibrium, reduce axis delta -> don”t add point and attempt stepping again

  3. Failed equilibrium and axis delta reached minimum -> end zpf line with unexpected ending

Parameters:
  • zpf_line (ZPFLine) – ZPFLine that the point is stepping in

  • step_results ([Point, [CompositionSet]]) – Results from zpf_equilibrium.update_equilibrium_with_new_conditions

  • axis_data (dict) – Axis variable data from a map strategy class

Returns:

  • None - this check does not produce any new nodes

  • However, this will end zpf_line if step_result is invalid

pycalphad.mapping.zpf_checks.simple_check_change_in_phases(step_results: tuple[Point, list[CompositionSet]], **kwargs)[source]

Returns True or False for whether step result resulted in same number of phases

Parameters:

step_results ([Point, [CompositionSet]]) – Results from zpf_equilibrium.update_equilibrium_with_new_conditions

Return type:

bool whether step result resulted in a phase change

pycalphad.mapping.zpf_checks.simple_check_global_min(step_results: tuple[Point, list[CompositionSet]], **kwargs)[source]

Returns True or False for whether step result is still global min

Parameters:

step_results ([Point, [CompositionSet]]) – Results from zpf_equilibrium.update_equilibrium_with_new_conditions

Return type:

bool whether step result is global min or not

pycalphad.mapping.zpf_checks.simple_check_valid_point(step_results: tuple[Point, list[CompositionSet]], **kwargs)[source]

Returns True or False for whether step result was successful equilibria

Parameters:

step_results ([Point, [CompositionSet]]) – Results from zpf_equilibrium.update_equilibrium_with_new_conditions

Return type:

bool whether step result is valid or not (None)

pycalphad.mapping.zpf_equilibrium module

pycalphad.mapping.zpf_equilibrium.compute_derivative(point: Point, v_num: StateVariable, v_den: StateVariable, free_den=True)[source]
Computes dot derivative of d v_num / d v_den, which handles removing the numerator variable

free_den is an unintuitive name, but it refers to the mapping code to state that the denominator variable is the free variable that we plan on stepping in, with the numerator being the dependent variable

Parameters:
  • point (Point) – Point to compure derivative on

  • v_num (v.StateVariable) – Variable in numerator of derivative

  • v_den (v.StateVariable) – Variable in denominator

  • free_den (bool) – Whether to free the numerator variable Name refers to the denominator being the variable we’re stepping in

Returns:

derivative – Note: can be nan if the phase boundary is vertical and the denominator is composition

Return type:

float

pycalphad.mapping.zpf_equilibrium.create_node_from_different_points(new_point: Point, orig_cs: list[CompositionSet], axis_vars: list[StateVariable])[source]

Between two points with different composition sets (only 1 different CS) Compute the node, freeing up the axis var and solving for it The unique CS will be fixed to 0 for the node

Parameters:
  • new_point (Point) – Point to add CS to

  • orig_cs ([CompositionSet]) – List of CS in the previous point This allows us to compare what composition set was added or removed

  • axis_vars ([v.StateVariable]) – Variables to free when node finding One variable per fixed composition set

Returns:

  • new_node (Node) – Node solved with the fixed composition set (either added or removed from previous point)

  • or

  • None - if node could not be found or CS change – is invalid for finding new node (either 0 change in CS or more than 1)

pycalphad.mapping.zpf_equilibrium.find_global_min_point(point: Point, system_info: dict, pdens=500, tol=1e-05, num_candidates=1)[source]

Checks global min on current point and attempts to find a new point with a new composition set if current point is not global min

  1. Find potential new composition set for global min

  2. If no composition set is found, then return

  3. If composition set is found, check that the new CS doesn’t match with a currently stable CS

  4. Hope that this works on miscibility gaps

Parameters:
  • point (Point) – Point to check global min

  • system_info (dict) – Dictionary containing information for pycalphad.calculate

  • pdens (int) – Sampling density

  • tol (float) – Tolerance for whether a new CS is considered stable

  • num_candidates (int) – Number of candidate CS to check driving force To avoid redundant calculations, this will only check driving force for unique phases. So setting this to a high number will not significantly affect performance

Returns:

  • new_point (Point with added composition set)

  • or

  • None (if point is global min or global min was unable to be found)

pycalphad.mapping.zpf_equilibrium.update_equilibrium_with_new_conditions(point: Point, new_conditions: dict[StateVariable, str], free_var: StateVariable | None = None)[source]

Update the point with a new set of conditions.

This function assumes that the new conditions are a small distance away from the current conditions.

Parameters:
  • point (Point) – The point to update.

  • new_conditions (dict[v.StateVariable, str]) – The new set of conditions to apply.

  • free_var (v.StateVariable, optional) – The variable to free when updating conditions. This is typically required if a fixed composition set is specified, ensuring the Gibbs phase rule is conserved.

Returns:

A tuple containing:
  • new_point (Point): The point with updated composition sets and conditions.

  • orig_cs (list): The original list of composition sets. The degrees of freedom in the composition sets will be updated with the new point conditions, including any composition sets that became unstable after the update.

If the equilibrium fails, the function returns None.

Return type:

tuple or None

Module contents