Conversation
… PTA solvers - Add solve_at_potential_fugacity_single for single-component systems using ForwardDiff - Change volume calls from :stable to :unknown for better convergence - Add comprehensive tests comparing ChemPotentialMethod vs FugacityCoefficientMethod - Set default time_limit to 20.0 seconds in DEIsothermFittingSolver
- Modify fit() to accept optional fittable parameter vector - Update IsothermFittingProblem to track fittable parameters - Add to_vec_fittable() and from_vec_fittable() helper functions - Simplify @with_metadata macro (remove hardcoded fittable flags) - Update Freundlich model to estimate β from temperature dependence - Users can now control which parameters to fit without modifying source code Example usage: fit(Freundlich, data) # fit all parameters fit(Freundlich, data, fittable=[true, true, false, true]) # fix β
Sips model fixes: - Add safeguard for division by zero when f0 (defaults to f=1) - Fix energy sign convention: use -1/(R*T) in regression for correct E sign - Remove double negation in return statement (was causing positive E) - Add default E value for single temperature case - Add NaN/Inf checks for all parameters with sensible defaults Quadratic model fixes: - Replace complex 5-parameter regression with Langmuir-based initial guess - Use same K and E for both Ka and Kb parameters - Set Kb=0.1*Ka (quadratic term as small correction) - Preserve original implementation as commented block for reference - Provides more stable and robust initial values Test additions: - Add fittable parameters test using LangmuirS1 model - Test that non-fittable parameters preserve initial guess values - Test that fittable parameters are actually optimized - Verify loss improvement with selective fitting These changes improve numerical stability and provide better starting points for the optimization algorithms, reducing NaN/Inf issues during fitting.
Documentation updates: - Simplified tutorial examples to use new IsothermFittingProblem API - Removed manual bounds and x0 specification from tutorials - Fixed pressure units in documentation (bar instead of Pa) - Updated bestisotherm tutorial with cleaner examples - Added isotherm_data convenience method for scalar temperature Model bounds improvements: - Changed Toth parameter bounds from (-Inf, Inf) to finite ranges - Changed ThermodynamicLangmuir Bᵢᵩ bounds to (-1e3, 1e3) - Prevents logspace transformation issues with infinite bounds - Makes optimization more stable and predictable Minor fixes: - Fixed whitespace in isotherm_methods.jl - Updated x0_guess_fit for ThermodynamicLangmuir to use nextfloat - Updated x0_guess_fit for Toth to use cleaner default values These changes improve user experience by simplifying the API usage in tutorials and preventing numerical issues with infinite bounds.
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.
This pull request introduces several improvements and simplifications to the adsorption isotherm fitting workflow, focusing on easier usage, new solver support, and improved flexibility for parameter fitting. The main changes include a new interface for partial parameter fitting, addition of a local deterministic optimizer, and updates to tutorials and data handling for clarity and correctness.
Key changes:
Isotherm Fitting Infrastructure
fittablevector toIsothermFittingProblem, allowing users to specify which model parameters should be optimized and which should remain fixed. The simplified constructor now automatically guesses initial parameters and bounds, with validation for thefittablevector.NLSolversIsothermFittingSolverstruct and correspondingsolvemethod, enabling local deterministic optimization (e.g., L-BFGS) via the NLSolvers package. This provides an alternative to the existing global stochastic Differential Evolution solver. [1] [2]fitfunction interface to support the newfittableparameter and to allow selection between solvers. Comprehensive docstring and usage examples were added.Tutorial and Documentation Updates
IsothermFittingProblemin the tutorials, removing the need for manual initial guesses and bounds in most cases, and reflecting the new default behavior. Updated plotting and pressure unit handling for clarity and correctness. [1] [2] [3] [4] [5] [6] [7]Data Handling and Utilities
isotherm_datathat accepts a scalar temperature and broadcasts it to a vector, simplifying data preparation for fixed-temperature isotherms.Other Fixes