Skip to content

ENH: Workspace API#432

Merged
richardotis merged 273 commits intopycalphad:developfrom
richardotis:dot_derivatives
Jul 14, 2024
Merged

ENH: Workspace API#432
richardotis merged 273 commits intopycalphad:developfrom
richardotis:dot_derivatives

Conversation

@richardotis
Copy link
Collaborator

@richardotis richardotis commented Oct 23, 2022

  • Adds a new Workspace object and associated imperative API. This object now underlies the equilibrium function, which remains for backwards compatibility. A Workspace object can be mutated after creation. The Workspace.get() function accepts ComputableProperty objects as input and returns arrays. Fixes Develop a wrapper API for plotting properties from calculate and equilibrium #154
  • Adds a new PhaseRecordFactory object and associated connections to PhaseRecord, which enables deferred compilation of symbolically-defined model properties until they are called in the PhaseRecord API. The PhaseRecord object also gains prop and prop_grad functions for computing properties and property gradients of arbitrary symbolic attributes of Model instances.
  • Creates a "Computable Property Framework" (CPF) for calculating properties of the system, individual phases, or some combination of these. It also provides a framework for defining custom properties.
  • Adds support for Jansson derivatives (constrained total derivatives aka "dot" derivatives) of thermodynamic properties (fixes Heat capacities calculated by Model can sometimes be incorrect #261 )
  • Adds support for T0 (tzero) calculation
  • Adds support for driving force calculation, including nucleation driving forces, via the IsolatedPhase and DormantPhase meta-properties. Meta-properties are objects that know how to create new properties (as defined by the CPF). In this case, these meta-properties know how to start sub-calculations . The current way of finding starting points for these calculations is not ideal and prone to failure (basically reuses CompositionSet objects from the workspace equilibrium calculation), but it works well in the typical case.
  • Adds physical units support via pint. All ComputableProperty objects have "implementation units" and "display units." Implementation units are what are assumed by the underlying numerical computation (which is done without units, for performance). The display units are what the user gets when Workspace.get is called. ComputableProperty.__getitem__ allows the display units to be changed for individual calls to Workspace.get, or when setting Workspace.conditions.
  • Also regarding physical units, a special unit conversion context is defined to allow conversions between per-mole properties and per-mass properties. There's room to add per-volume here as well, but that may not make it into this PR.
  • Adds support for specifying linear combinations and ratios of mole fractions as a condition.
  • Adds support for specifying weight fractions as a condition.
  • Closes multiple outputs for calculate() #133 through the multi-valued output from Workspace.get
  • Closes Specifying species as conditions #163 because site fraction conditions can be given now
  • Associated tests for these new features.
  • build_phase_records is removed. Use the PhaseRecord.prop_* API in downstream functions instead.

Documentation

  • Adds several examples for the Computable Property API, including driving force, T0, and isolated energy surfaces. A demo of export-to-DataFrame is also shown.
  • Other examples have been updated to use the new APIs. Examples using the legacy APIs continue to be supported, but have been moved to a new "Advanced Examples" section. These sections will continue to be expanded and reorganized to accommodate our evolving best practices.
  • If any dependencies have changed, the changes are reflected in the
    • setup.py (runtime requirements)

richardotis and others added 22 commits July 14, 2024 12:47
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
@bocklund bocklund modified the milestones: 1.0, 0.11.0 Jul 14, 2024
Co-authored-by: Brandon Bocklund <brandonbocklund@gmail.com>
@richardotis richardotis merged commit 8595b84 into pycalphad:develop Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

4 participants