# RuntimeWarning in optimisation

**URL:** <https://forum.cadet-web.de/t/runtimewarning-in-optimisation/1124>\
**Category:** CADET Troubleshooting\
**Tags:** modeling\
**Created:** [December 12, 2024, 3:09pm UTC](https://forum.cadet-web.de/t/runtimewarning-in-optimisation/1124 "2024-12-12T15:09:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mao](https://forum.cadet-web.de/letter_avatar_proxy/v4/letter/m/eb9ed0/32.png) [@mao](https://forum.cadet-web.de/u/mao)\
**Post date:** [December 12, 2024, 3:09pm UTC](https://forum.cadet-web.de/t/runtimewarning-in-optimisation/1124/1 "2024-12-12T15:09:21Z")

</div>

Hi,  
I am looking for help with inverse fitting of SMA parameters, specifically equilibrium constant, kinetic constant and characteristic charge. I ran the optimisation overnight, unfortunately no results were obtained and runtime warnings were generated. Here are the warnings. How can I fix this?

 ![image](https://forum.cadet-web.de/uploads/default/original/2X/9/96cdc4cf343e3fb1bfbfc5113d4d7203d46b1a8e.png)

Also, this system has two proteins, a and cyto, so I expect 10 x0 (are x0 the initial guess of optimimzation?) as I need to define equilibrium constant, kinetic constant, characteristic charge, desorption rate, adsorption rate for each protein. However, I am allowed to define 5 x0 values. What am I missing?  
Also, I am afraid that my cadet process is not the latest version. Is there an ‘update cadet process’ command?  
Thanks in advance.My code and experiment data are available in drive.

> **[Google Drive: Sign-in](https://accounts.google.com/v3/signin/identifier?continue=https%3A%2F%2Fdrive.google.com%2Fdrive%2Ffolders%2F1gak49pMYdFy3zDhU3-hSkT4jOErSRTCU%3Fusp%3Dsharing&followup=https%3A%2F%2Fdrive.google.com%2Fdrive%2Ffolders%2F1gak49pMYdFy3zDhU3-hSkT4jOErSRTCU%3Fusp%3Dsharing&ifkv=AeZLP98NOMFq3mmrY7F-mVV2fci3tjEj6AfqeGKzKnVQcK4yib0ZzmyKQNdRx_FG5ajAPBixLS2W9Q&osid=1&passive=1209600&service=wise&flowName=GlifWebSignIn&flowEntry=ServiceLogin&dsh=S1157833251%3A1733998418472647&ddm=1)**
>
> Access Google Drive with a Google account (for personal use) or Google Workspace account (for business use).

Your help is greatly appreciated.

---

<div class="post-metadata">

**Author:** ![ronald.jaepel](https://forum.cadet-web.de/user_avatar/forum.cadet-web.de/ronald.jaepel/32/986_2.png) [@ronald.jaepel](https://forum.cadet-web.de/u/ronald.jaepel)\
**Post date:** [December 19, 2024, 4:47pm UTC](https://forum.cadet-web.de/t/runtimewarning-in-optimisation/1124/2 "2024-12-19T16:47:58Z")

</div>

Hi Mao,

it looks like the simulations get stuck. This can be caused by a high capacity in the SMA system without reference concentrations or a high characteristic charge, (charge wasn’t a problem for you). If I activate reference concentrations with

```auto
    binding_model.capacity = capacity
    binding_model.reference_solid_phase_conc = capacity
    binding_model.reference_liquid_phase_conc = capacity

```

the simulations run quickly and we get some fitting results.

They are however all bad, mostly because we observe a break-through during the loading phase. That is due to the parameters you used to set up the model. Most notably the total porosity of 0.97, which means your column only contains 3 % stationary phase and only has `1e-6 m³ * 0.03 * 680 mol / m³ = 2e-5 mol` of total ionic binding sites. You load `643 mM * 1e-6 / 60 m³ / s * 30 s = 3.2e-4 mol` of cyto onto the column, with a characteristic charge of 10 and a steric factor of 10, so it needs `6.4e-3` binding sites in total. So you’ll need to look over your parameters. The porosity as well as the concentration of your proteins look a bit off.

> Also, this system has two proteins, a and cyto, so I expect 10 x0 (are x0 the initial guess of optimimzation?) as I need to define equilibrium constant, kinetic constant, characteristic charge, desorption rate, adsorption rate for each protein. However, I am allowed to define 5 x0 values. What am I missing?

You define the parameters (e.g. the adsorption rate) like this:

```python
optimization_problem.add_variable(
    name='adsorption_rate',
    parameter_path='flow_sheet.column.binding_model.adsorption_rate',
    lb=1e-10, ub=1e10,
    transform='auto',
    indices=[1]  
)

```

with `indices=[1]`. This means, that this ‘adsorption\_rate’ parameter is only going to affect the component at index 1, so “a”. To also modify “cyto” you need to add another variable with e.g.

```python
optimization_problem.add_variable(
    name='adsorption_rate_cyto',
    parameter_path='flow_sheet.column.binding_model.adsorption_rate',
    lb=1e-10, ub=1e10,
    transform='auto',
    indices=[2]  
)

```

You’ll need to do this for all parameters as well as the parameter dependencies. I recommend setting up a function that adds the variables for a given index and then calling that function twice with index=1 and index=2.

> Also, I am afraid that my cadet process is not the latest version. Is there an ‘update cadet process’ command?

That command is `pip install CADET-Process --upgrade` executed in your cadet\_workshop conda environment. When you do that, also update CADET-Core and CADET-Python with  
`pip install CADET-Python --upgrade` and `conda update CADET`

---

<div class="post-metadata">

**Author:** ![mao](https://forum.cadet-web.de/letter_avatar_proxy/v4/letter/m/eb9ed0/32.png) [@mao](https://forum.cadet-web.de/u/mao)\
**Post date:** [December 24, 2024, 4:16pm UTC](https://forum.cadet-web.de/t/runtimewarning-in-optimisation/1124/3 "2024-12-24T16:16:21Z")

</div>

Hi Ronald,  
Thanks for your helpful reply! I really appreciate your input！  
I’ve added the reference concentration and redefined the parameters as you showed me. I also realised that I made a mistake when converting the loaded protein concentration from mg/ml (from my experiments) to mM (Cadet’s unit). The code is running smoothly and I expect good results.  
Your guidance is fantastic! Thanks again for making everything clearer for me.  
Cheers,  
Mao

---

<div class="post-metadata">

**Author:** ![h.lanzrath](https://forum.cadet-web.de/user_avatar/forum.cadet-web.de/h.lanzrath/32/1186_2.png) [@h.lanzrath](https://forum.cadet-web.de/u/h.lanzrath)\
**Post date:** [January 27, 2026, 11:40am UTC](https://forum.cadet-web.de/t/runtimewarning-in-optimisation/1124/4 "2026-01-27T11:40:33Z")

</div>


