Skip to content

Conversation

@bocklund
Copy link
Collaborator

@bocklund bocklund commented Jul 14, 2024

This PR adds support for a new mapping system in PyCalphad, in the spirit of the algorithm published by Sundman et al.. This PR is the culmination of significant effort and much of the credit to getting it this close to the finish line goes to @nury12n

Features

  1. The PR adds support for mapping and plotting:
  • 1D stepping in axis variables (e.g. for property diagrams)
  • Binary phase diagrams (to supersede the current binplot based on pycalphad.plot.binary.map)
  • Ternary isothermal phase diagrams (to supersede the current ternplot based on eqplot)
  • Isopleth diagrams
  1. The visual quality of diagrams is significantly improved:
  • Points on phase boundaries are now connected by solid lines
  • Invariant reactions in binary phase diagrams are computed and drawn now
  • Many pathological cases that gave previous algorithms trouble are resolved, including mapping regions that are very narrow with respect to the conditions, e.g. γ-loops and narrow liquidus/solidus regions.
  1. Provides an API to programmatically access phase boundaries and phase equilibria computed by the mapping algorithm.
  2. Provide drop-in replacements to binplot and ternplot through a compatability API. Old versions of binplot and ternplot remain available via their absolute imports, but they will eventually be removed.

Outstanding TODO items

On the current state of this PR (somewhat outdated comments copied from #517):

  • Stepping tends to work well as long as there are no miscibility gaps. With miscibility gaps, mapping can sometimes be flaky or find metastable phase equilibria, especially stepping from 1-phase to 2-phase MG regions.
  • Isopleth support exists in principle, but isn't tested yet.
    • Second order transitions? Ex. BCC_A2->BCC_B2 in Fe-Al and Al-Mn. I think you get a node where the order and disorder composition sets are at the same composition but different constituent site fractions
  • Global min check can fail to detect phases with high internal DOFs. Possible options:
    • Create DormantPhase for multiple phases with high driving force and then grab the phase with the highest driving force. There is a way to do it right now with the GLOBAL_MIN_NUM_CANDIDATE option, but it's a bit unintuitive where it checks the n samples, then creates a DormantPhase for all unique phases in the n samples, rather than testing n phases.
    • Keep all possible phases as a DormantPhase and update them per iteration. This can be slow though if there are a lot of phases
  • Starting point generating using the StepStrategy can be a bit slow, especially for systems with a lot of phases or a lot of complex phases. And occasionally, I've seen it fail for ternaries and isopleths where no starting points can be found.
  • Mapping can be sensitive to the ratio between the two axis variable step size, where the wrong direction will be proposed and the zpf line will not be able to be generated since the wrong direction will lead to an equilibrium failure. This is an unfortunate consequence of the new direction testing for binaries and ternaries where the direction is normalized to the step size. I seem to encounter this on systems with low melting points, where I will set the temperature step size too high. It could be possible to set a maximum step size based off the range of the axis variable, but I also don't want to change user inputs behind the scenes.
  • Ternaries
    • If the fixed composition set leads to a miscibility gap, then it's possible that the node will be missed when we step in the free composition set and step directly over the node, and the fixed composition set will just move to the other side of the miscibility gap rather than being detected as a new global min
    • We should be able to remove the assumption of the user setting the two axis to (0, 1). This will mainly change how we do the starting points on the third axis. A example where a user may not want the entire composition range could be for a carbon containing system where the carbon content only goes up to a few percent.
  • Mapping with a fixed chemical potential/activity/pressure variable?
  • Isopleths
    • I have not tested isopleths where the two axes are composition
    • Mapping with linear combinations can lead to many failed equilibrium calculations.
    • A decent number of the isopleths I tested can miss an exit or two from a node
    • Axis limits should be affected by the additional fixed composition, where the axis variable will be limited between (0, 1-sum(fixed compositions)). Currently, the zpf line will stop when it passes the upper limit due to a failed equilibrium calculation (where sum(x) > 1), but it would be better to stop the zpf line before attempting equilibrium.
  • Unit tests
    • There are unit tests for the checks that are performed after each zpf line iteration
    • I suppose for the strategies, we can pick a simple system for each and make sure it generates the correct zpf lines and nodes, testing only for the phases that are present in each zpf line.
    • I'll have to see if it's possible to set up a strategy at a specific point, such as just before a node, then it would be possible to have unit tests for specific conditions (this could be like finding a node, checking the node exits, reaching an axis limit, etc)
  • (from Mapping #517, maybe outdated) Giving components to Mapper that do not include vacancies seems to produce silent failures where no boundaries are produced.
  • (from Mapping #517, maybe outdated) Automated tests exercising the basic behavior to achieve coverage need to be implemented

@bocklund bocklund self-assigned this Jul 19, 2024
Copy link
Collaborator Author

@bocklund bocklund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the more thorough round. After these comments are addressed, I'll be happy to see this merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mapping Issues related to mapping (line following) capabilities

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants