Adsorption isotherm (Langmuir, Freundlich)
Overview
Adsorption isotherm (Langmuir, Freundlich) fits nonlinear adsorption isotherms to equilibrium batch concentration and uptake data. Adsorption isotherms describe the relationship between the equilibrium concentration of an adsorbate in solution (\(C_e\), mg/L) and the amount adsorbed onto the solid surface at equilibrium (\(q_e\), mg/g) at constant temperature. This template fits both the Langmuir and Freundlich equations using nonlinear least squares (NLLS), computes standard errors and confidence intervals, evaluates the dimensionless separation factor (\(R_L\)) and heterogeneity parameter (\(1/n\)), and provides an automated side-by-side model comparison using the corrected Akaike Information Criterion (\(\text{AICc}\)) to identify the preferred isotherm.
The workbook ships pre-populated with illustrative batch equilibrium measurements representative of organic dye or contaminant adsorption onto granular activated carbon (with maximum capacity near 45 mg/g and affinity constant near 0.10 L/mg), a configurable Defaults sheet, a dedicated fit curve grid feeding a native Excel scatter chart, a Validation sheet of reference checks (scipy cross-checks, a closed-form \(R_L\) check and synthetic noise-free recovery), and an in-workbook modification guide.
Before you start
Requirements. Microsoft Excel with Python for Excel enabled. The template operates entirely within the workbook environment without requiring external software installations or command-line scripting.
Core adsorption concepts. - Equilibrium concentration (\(C_e\)): The concentration of solute remaining in solution after adsorption reaches dynamic equilibrium, expressed in \(\text{mg/L}\). - Adsorption capacity / uptake (\(q_e\)): The mass of adsorbate retained per unit mass of dry adsorbent at equilibrium, expressed in \(\text{mg/g}\). - Langmuir isotherm: A theoretical model derived from kinetic principles assuming monolayer adsorption onto a finite number of energetically equivalent, identical binding sites without lateral interactions between adsorbed molecules. Key parameters are the maximum monolayer adsorption capacity (\(q_{\max}\), mg/g) and the Langmuir bonding affinity constant (\(K_L\), L/mg). - Dimensionless separation factor (\(R_L\)): Defined as \(R_L = 1 / (1 + K_L C_{0,\max})\), where \(C_{0,\max}\) is the maximum initial liquid-phase concentration tested. \(R_L\) characterizes isotherm favourability: \(R_L > 1\) represents unfavourable adsorption, \(R_L = 1\) is linear partitioning, \(0 < R_L < 1\) is favourable adsorption, and \(R_L = 0\) is irreversible adsorption. - Freundlich isotherm: An empirical power-law equation \(q_e = K_F C_e^{1/n}\) applicable to multilayer adsorption on energetically heterogeneous surfaces with non-uniform adsorption heats. \(K_F\) is the Freundlich capacity factor, and \(1/n\) is the adsorption intensity / surface heterogeneity factor. Values of \(1/n < 1\) denote normal favourable chemisorption or physisorption, whereas \(1/n > 1\) indicates cooperative adsorption. - Model selection by AICc: The corrected Akaike Information Criterion (\(\text{AICc}\)) balances goodness of fit against parameter parsimony for finite sample sizes. When comparing two-parameter models on the same dataset, the model with the lower \(\text{AICc}\) provides the superior description.
Physical and statistical assumptions. 1. Isothermal equilibrium: Batch equilibrium experiments are assumed to have reached dynamic steady state at constant temperature and pH. 2. Independent observations: Each row represents an independent batch test vial prepared with known adsorbent mass and solution volume. 3. Nonlinear optimization: Parameters are estimated directly in physical coordinates by nonlinear least squares using bounded nonlinear least squares (scipy curve_fit with parameter bounds, which uses the Trust Region Reflective method), avoiding distortion introduced by linear transformation plots (such as Scatchard, Lineweaver-Burk, or log-log linearization).
Workbook tour
| Sheet and range | What it holds | Kind |
|---|---|---|
| Isotherm data, A4:B104 | Batch equilibrium measurements: Equilibrium concentration Ce (mg/L) and uptake qe (mg/g). | Editable input |
| Defaults, A4:D24 | Analysis settings: Isotherm model selection dropdown (Langmuir / Freundlich), Confidence level, Initial conc. C0max, R² minimum, Outlier threshold. | Editable input |
| Results, A4:E7 | Parameter estimates with standard errors and two-sided confidence bounds for the selected model. | Output |
| Results, A10:E12 | Side-by-side model comparison table: R², Residual SD (s_y.x), AICc, and preferred model identification. | Output |
| Results, A15:B18 | Automated acceptance checks: R² threshold, residual SD limit, and parameter physical positivity. | Output |
| Results, A21:B32 | Fit statistics: model name, data source, points fitted (n), degrees of freedom, R², residual SD, AICc, confidence level, adsorption nature (RL or 1/n), outlier count, and diagnostic flags. | Output |
| Results, A34 | Native Excel scatter chart plotting observations, fitted isotherm curve, and confidence envelope. | Output |
| Curve, A4:D54 | Grid of 50 concentration values from 80% of the lowest to 105% of the highest entered concentration, with fitted uptake and confidence bounds. | Output |
| Validation, A4:G16 | Twelve reference checks (scipy curve_fit cross-checks, closed-form RL, and synthetic noise-free recovery through the engine) with Expected, Calculated, Tolerance, PASS/FAIL and source columns. | Output |
| Guide, A4:B10 | Step-by-step instructions for adapting the workbook to laboratory data and SOPs. | Authored reference |
Using the template
1. Enter equilibrium batch data
- Open the Isotherm data sheet.
- Paste or type your equilibrium measurements starting at row 5:
- Column A: Equilibrium concentration \(C_e\) in \(\text{mg/L}\).
- Column B: Amount adsorbed \(q_e\) in \(\text{mg/g}\).
- Up to 100 observations (rows 5 to 104) are read automatically. Non-numeric text and blank rows are skipped without error.
2. Configure defaults and model selection
- Navigate to the Defaults sheet.
- Set Isotherm model in cell B5 by choosing Langmuir or Freundlich from the dropdown menu. The selection determines which model appears in the main parameter block and on the Results chart.
- Verify or adjust the analysis settings:
- Confidence level: Default 0.95 (\(95\%\)).
- Initial conc. \(C_{0,\max}\) (mg/L): Highest initial concentration used in your batch tests, required to evaluate the separation factor \(R_L\).
- R-squared minimum: Floor for the automated goodness-of-fit acceptance check (default 0.95).
- Outlier threshold (SD): Raw residual / residual SD threshold (default 3.0 SD) used to flag candidate anomalous points.
3. Review fit results and model comparison
- Switch to the Results sheet.
- The Selected isotherm parameters block shows the estimate, standard error, and confidence bounds:
- For Langmuir: \(q_{\max}\) (\(\text{mg/g}\)), \(K_L\) (\(\text{L/mg}\)), and the separation factor \(R_L\).
- For Freundlich: \(K_F\) (\((\text{mg/g})(\text{L/mg})^{1/n}\)), heterogeneity factor \(1/n\), and intensity \(n\).
- The Model comparison table displays \(R^2\), residual standard deviation (\(s_{y.x}\)), and \(\text{AICc}\) for both isotherms side-by-side, indicating which model provides the statistically preferred fit.
Inputs and settings
Isotherm data (A5:B104): - Equilibrium concentration Ce (mg/L): Liquid-phase solute concentration measured at equilibrium (\(C_e\)). Values must be positive numbers. - Amount adsorbed qe (mg/g): Solid-phase adsorbate uptake (\(q_e\)), typically calculated as \((C_0 - C_e) V / m\), where \(C_0\) is initial concentration, \(V\) is solution volume, and \(m\) is adsorbent dry mass.
Defaults (A5:D9): - Isotherm model (B5): Active model for main reporting and plotting. Allowed values: Langmuir or Freundlich. Default: Langmuir. - Confidence level (B6): Two-sided Student \(t\) confidence level for parameter uncertainty intervals. Allowed values: 0.50 or more and below 1.0. Default 0.95 (\(95\%\)). - Initial conc. C0max (mg/L) (B7): Maximum initial concentration tested across the batch series. Used in the denominator of the dimensionless separation factor \(R_L = 1 / (1 + K_L C_{0,\max})\). Default 150.0. - R-squared minimum (B8): Quality threshold for automated acceptance check. Allowed values: 0.50 or more and below 1.0. Default 0.95. - Outlier threshold (SD) (B9): Residual multiplier threshold (in units of residual standard deviation \(s_{y.x}\)) for identifying candidate outlier points. Default 3.0.
How results are calculated
- Data filtering: Rows with non-numeric entries, blanks, non-positive \(C_e \le 0\), or negative uptake \(q_e < 0\) are excluded. A minimum of 5 usable observations is enforced.
- Nonlinear optimization:
- Langmuir isotherm: Fits \(q_e = q_{\max} K_L C_e / (1 + K_L C_e)\) using bounded
curve_fit(trust-region reflective), with the covariance computed from the analytic Jacobian. - Freundlich isotherm: Fits \(q_e = K_F C_e^{1/n}\) using bounded
curve_fit(trust-region reflective), with the covariance computed from the analytic Jacobian.
- Langmuir isotherm: Fits \(q_e = q_{\max} K_L C_e / (1 + K_L C_e)\) using bounded
- Parameter covariance and intervals: Parameter covariance is estimated as \(V = s_{y.x}^2 (J^T J)^{-1}\), where \(J\) is the analytic design matrix and \(s_{y.x} = \sqrt{\text{RSS} / (n - 2)}\). Standard errors are the square root of diagonal covariance elements. Two-sided Wald confidence bounds are evaluated at the configured confidence level: \(\hat{\theta} \pm t_{\text{crit}} \cdot \text{SE}(\hat{\theta})\).
- Derived quantities via delta method:
- Separation factor \(R_L = 1 / (1 + K_L C_{0,\max})\) with gradient \(\partial R_L / \partial K_L = -C_{0,\max} / (1 + K_L C_{0,\max})^2\).
- Freundlich heterogeneity factor \(1/n\) with gradient \(\partial (1/n) / \partial n = -1/n^2\).
- Model selection via AICc: Both models are evaluated on the identical dataset: \[\text{AICc} = n \ln\left(\frac{\text{RSS}}{n}\right) + 2k + \frac{2k(k + 1)}{n - k - 1}\] where \(k=2\). The model with lower \(\text{AICc}\) is designated as preferred, with \(\Delta\text{AICc} = \text{AICc} - \min(\text{AICc})\).
Reading the results
Selected isotherm parameters (Results!A4:E7): - Langmuir parameters: Monolayer capacity \(q_{\max}\) (\(\text{mg/g}\)), bonding affinity constant \(K_L\) (\(\text{L/mg}\)), and dimensionless separation factor \(R_L\). - Freundlich parameters: Capacity coefficient \(K_F\) (\((\text{mg/g})(\text{L/mg})^{1/n}\)), heterogeneity factor \(1/n\), and adsorption intensity \(n\). - Columns display the point estimate, asymptotic standard error, lower confidence bound, and upper confidence bound.
Model comparison (Results!A10:E12): - Compares Langmuir and Freundlich side-by-side on \(R^2\), residual standard deviation (\(s_{y.x}\)), and \(\text{AICc}\). - The Preferred by AICc column indicates whether the isotherm provides the better statistical compromise between fit fidelity and parsimony (\(\Delta\text{AICc} = 0.0\) for preferred model). - As a conventional rule of thumb (not a threshold derived for this workbook), a \(\Delta\text{AICc}\) above 2 is read as positive evidence for the lower-AICc model and above 6 as strong evidence.
Acceptance checks (Results!A15:B18): - R-squared at least the minimum (default 0.95): Confirms the selected model explains at least the configured share of experimental variance (Defaults B8). - Residual SD below the limit (default 1.0 mg/g): Confirms typical prediction error (\(s_{y.x}\)) is within the limit (set by MAX_RESIDUAL_SD in the notebook rules). - Parameters positive: Confirms fitted parameters stay within physically admissible positive bounds.
Fit statistics (Results!A21:B32): - Displays points fitted (\(n\)), degrees of freedom, \(R^2\), residual SD, \(\text{AICc}\), confidence level, favourability classification (e.g. Favourable (0 < RL = 0.063 < 1)), candidate outlier count, and diagnostic flags.
Saving, sharing and App mode
- Saving: Save the workbook normally as
.xlsx. Excel stores all input cells, configuration defaults, and published Python outputs directly in the file. - Sharing: Distribute the workbook to team members or laboratory collaborators. When opened in an Excel session with Python for Excel active, the embedded Marimo reactive DAG evaluates automatically.
- App mode: In App mode, users interact strictly with spreadsheet input tables on Isotherm data and Defaults while viewing graphical and numerical results on Results without touching Python code.
Errors, empty states and limits
- Empty state: The workbook ships pre-loaded with illustrative batch measurements. If the data sheet is cleared, the notebook alerts that observations are required.
- Minimum observations: Nonlinear estimation of 2-parameter isotherms requires at least 5 usable data rows. If fewer than 5 rows are entered, acceptance checks display
FAILand fit statistics report insufficient observations. - Non-positive values: Equilibrium concentrations \(C_e \le 0\) and negative uptakes \(q_e < 0\) are automatically excluded from regression.
- Row limits: Up to 100 observations (rows 5 to 104) are read. An overflow sentinel at
Isotherm data!A105warns if data paste extends past row 104.
Limitations and when to use this
- Two-parameter isotherms only: This template focuses on the foundational Langmuir and Freundlich models. Three-parameter isotherms (such as Sips, Redlich-Peterson, or Temkin) require broader dynamic ranges and are excluded to avoid parameter over-specification on standard batch sequences.
- Illustrative shipped dataset: The pre-populated data points are illustrative synthetic values reflecting typical activated carbon adsorption curves (\(q_{\max} \approx 45\ \text{mg/g}\), \(K_L \approx 0.10\ \text{L/mg}\)), not a certified reference standard.
- Outlier handling: Outlier points whose raw residual exceeds the outlier threshold (default 3.0 SD, set on Defaults B9) are flagged in the statistics table and diagnostic list, but are not discarded automatically. Analysts should verify experimental conditions before manually clearing suspicious rows.
Free alternatives
Free alternative: Excel trendlines fit only linearized Langmuir forms (1/q against 1/C), which bias the parameters; Solver can fit the nonlinear form directly. This workbook fits the nonlinear form with confidence intervals and a closed-form RL check.
Developer reference
This workbook covers both the Langmuir and Freundlich isotherms. Freundlich is a model option selected on Defaults, not a separate workbook, and this template supersedes the former freundlich-adsorption template, which is being retired under issue #236.
Notebook implementation
The Marimo reactive notebook binds the input ranges using bf.inputs:
inputs = bf.inputs(
isotherm_data=bf.ref("Isotherm data!A4:B104", headers=True),
defaults=bf.ref("Defaults!A4:B24", headers=True),
overflow="Isotherm data!A105",
)Both models are evaluated concurrently using the curve-fitting engine’s fit_model function:
langmuir_fit = fit_model(LANGMUIR, ce_arr, qe_arr, confidence=confidence, outlier_sd=outlier_threshold)
freundlich_fit = fit_model(FREUNDLICH, ce_arr, qe_arr, confidence=confidence, outlier_sd=outlier_threshold)The publication block outputs six structured tables to their designated Excel anchors:
publication = bf.publish(
outputs={
"results": results_table,
"comparison": comparison_table,
"checks": checks_table,
"statistics": statistics_table,
"curve": curve_table,
"validation": validation_table,
}
)How the calculation/model works
Langmuir equation: \[q_e = \frac{q_{\max} K_L C_e}{1 + K_L C_e}\]
Analytic Jacobian with respect to \([q_{\max}, K_L]^T\): \[J = \left[ \frac{K_L C_e}{1 + K_L C_e}, \quad \frac{q_{\max} C_e}{(1 + K_L C_e)^2} \right]\]
Freundlich equation: \[q_e = K_F C_e^{1/n}\]
Analytic Jacobian with respect to \([K_F, n]^T\): \[J = \left[ C_e^{1/n}, \quad -\frac{K_F C_e^{1/n} \ln(C_e)}{n^2} \right]\]
Separation factor (\(R_L\)): \[R_L = \frac{1}{1 + K_L C_{0,\max}}\]
The standard error of \(R_L\) is computed via the delta method: \[\mathrm{SE}(R_L) = \frac{C_{0,\max}}{(1 + K_L C_{0,\max})^2} \mathrm{SE}(K_L)\]
Goodness of fit and model selection: \[s_{y.x} = \sqrt{\frac{\sum (q_e - \hat{q}_e)^2}{n - 2}}\] \[R^2 = 1 - \frac{\sum (q_e - \hat{q}_e)^2}{\sum (q_e - \bar{q}_e)^2}\] \[\text{AICc} = n \ln\left(\frac{\text{RSS}}{n}\right) + 2k + \frac{2k(k + 1)}{n - k - 1}\] where \(n\) is the number of usable observations and \(k=2\) is the number of fitted parameters.
Validation / expected results
Baseline evaluation on the shipped illustrative data produces: - Langmuir fit: - \(q_{\max} = 45.0721\ \text{mg/g}\) (\(\text{SE} = 0.1290\), \(95\%\ \text{CI}: 44.7802\text{ to } 45.3640\)) - \(K_L = 0.0993\ \text{L/mg}\) (\(\text{SE} = 0.0012\), \(95\%\ \text{CI}: 0.0966\text{ to } 0.1021\)) - \(R_L = 0.0629\) at \(C_{0,\max} = 150\ \text{mg/L}\) (\(\text{SE} = 0.0007\), \(95\%\ \text{CI}: 0.0613\text{ to } 0.0645\), indicating favourable adsorption) - \(R^2 = 0.9998\), \(s_{y.x} = 0.1977\ \text{mg/g}\), \(\text{AICc} = -32.37\) - Freundlich fit: - \(K_F = 10.7416\ (\text{mg/g})(\text{L/mg})^{1/n}\) (\(\text{SE} = 1.6663\), \(95\%\ \text{CI}: 6.9722\text{ to } 14.5110\)) - \(1/n = 0.2919\) (\(\text{SE} = 0.0365\), \(95\%\ \text{CI}: 0.2093\text{ to } 0.3745\)) - \(n = 3.4258\) (\(\text{SE} = 0.4284\), \(95\%\ \text{CI}: 2.4567\text{ to } 4.3948\)) - \(R^2 = 0.9197\), \(s_{y.x} = 3.9679\ \text{mg/g}\), \(\text{AICc} = 33.61\) - Model selection: Langmuir is decisively preferred (\(\Delta\text{AICc} = 66.0\)). - Validation sheet: All 12 reference checks report PASS, verifying agreement with scipy curve_fit cross-checks, the closed-form \(R_L\), and recovery of noise-free synthetic isotherms through the engine. The Freundlich pins in the scenario tests are engine regression values, not independent results, because the Freundlich \(K_F\)/\(n\) solution surface is flat enough that scipy solvers differ slightly.
Changelog
2026-10-26 (Round 3 review update)
- Clarified Validation wording: checks are scipy cross-checks, a closed-form \(R_L\) check and synthetic recovery, not all independent implementations; the 1/n row is derived from the scipy-fitted \(n\).
- Validation checks now share one helper for Expected, Calculated, Tolerance and Status; synthetic ground-truth values are named constants.
- Defaults allowed-value text for confidence level and R-squared minimum now reads “0.50 or more and below 1.0”, matching the guard and warning messages.
- Corrected the optimizer description to bounded
curve_fit(Trust Region Reflective) and documented the AICc \(\Delta\) thresholds as a conventional rule of thumb. - Acceptance check and outlier wording now refers to the configurable defaults rather than fixed numbers.
- Freundlich scenario pins documented as engine regression values.
2026-10-26 (Round 2 review update)
- Made the Defaults sheet the single source of truth for analysis configuration and clarified notebook-level rules in documentation.
- Corrected outlier threshold terminology to raw residual / residual SD across workbook and documentation.
- Relabeled validation R-squared checks to scipy curve_fit cross-check and computed from scipy prediction residuals.
- Configured residual SD acceptance threshold as a notebook rule (MAX_RESIDUAL_SD).
- Added user-facing status pane notifications when invalid Defaults entries trigger private fallbacks.
- Dynamicized outlier threshold references in notebook accordion and workbook defaults.
- Noted replacement of separate freundlich-adsorption template in Developer reference.
- Pinned Freundlich scenario expectations for R-squared and residual SD acceptance checks.
2026-10-26 (Issue #236)
- Rebuilt template as a hand-crafted field workbook (
tier: field-workbook), replacing the skeleton generator model. - Added support for both Langmuir and Freundlich isotherms with user selection via Defaults dropdown.
- Implemented side-by-side model comparison table computing \(R^2\), residual standard deviation (\(s_{y.x}\)), and \(\text{AICc}\) for both isotherms.
- Added dimensionless separation factor \(R_L\) with delta-method uncertainty and favourability classification.
- Added Freundlich heterogeneity factor \(1/n\) and intensity parameter \(n\).
- Created Validation sheet with 12 reference checks verifying mathematical precision against independent scipy fits and synthetic benchmarks.
- Added in-workbook modification guide for laboratory SOP adaptation.