Feature: Wall clock timers for RunWhile, Relax, Minimize#388
Merged
Conversation
adds wallclocktimer function.
Added Wallclocktimer function
JonathanMaes
requested changes
Mar 24, 2026
moves CurrentMag to config.go folds MinimizeForSeconds and RelaxForSeconds into minimize and relax respectively RunSequence was not necessarily- this can now be accomplished in an mx3 script, and with more flexibility RunForSeconds can also be done in an mx3 script, as Runwhile already accepts a bool condition
Contributor
Author
|
This should be a bit cleaner implementation, I think.
|
In principle, there is a rare condition where you hit convergence in the loop just barely before the wallclock time, but by the time you hit the final MinimizeConverged check, the wallclock time is exceeded and returns false. So instead, just check the physical convergence condition at the end instead of WallClockTimer, since this doesn't change with time, only loop iterations. In practice this likely never happens, but may as well be safe fixed left over reference to wallclock variable
JonathanMaes
requested changes
Mar 30, 2026
JonathanMaes
approved these changes
Apr 2, 2026
ilateur
reviewed
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a function that allows the user to add some noise, then Run/Relax/Minimize for a specified amount of wallclock time or (for Relax/Minimize) if the solver converges. This is useful for stiff problems where one particular solver gets stuck (In my experience, this can happen with e.g. hysteresis loops at small external fields), to help jiggle out of a local minimum.