ENH: Minimizer: refactor and convergence improvements #373
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains 3 changes to the minimizer:
take_step
function is replaced with two functions to solve the equilibrium matrix and extract the chemical potentials (solve_state
) and to take the step with the corrections in the phase amounts, state variables, and site fractions (advance_state
). Theextract_equilibrium_solution
function is also now a part ofadvance_state
. This refactor keeps the logic for advancing the state separate and contained in one function.These changes (particularly the third change) helps convergence as demonstrated here:
Thanks to @james-saal for sharing the motivating example on our Gitter channel!
Develop
this PR (e57eb04)
Also note that if I run this same script using
phases = list(db.phases.keys())
, thendevelop
has a bunch of output lines containing** On entry to DORMBRP parameter number 13 had an illegal value
, finally ending withterminated by signal SIGSEGV (Address boundary error)
(catastrophic failure). It works well on this PR.