Jhsmit commited on
Commit
0f61c92
·
1 Parent(s): 97e477f

style: spelling

Browse files
Files changed (1) hide show
  1. monomer_dimer.ipynb +17 -216
monomer_dimer.ipynb CHANGED
@@ -24,7 +24,7 @@
24
  "M + M <-> D\n",
25
  "$$\n",
26
  "\n",
27
- "From the kinetic scheme above, we can write down the differential equations discribing this system. These differential equations tell us how the concentrations of the reaction (in this case dimerization) change in time. \n",
28
  "\n",
29
  "$$\n",
30
  "\\frac{\\partial [M]}{\\partial t} = - 2 k_{on} [M][M] + 2 k_{off} [D]\n",
@@ -48,7 +48,7 @@
48
  "\n",
49
  "First, we are looking for the concentration of the monomer and dimer at _steady-state_: the system has reached equillibrium and no more changes in the concentration of either the monomer or the dimer occur. This means we can set both differential equations to zero. \n",
50
  "\n",
51
- "Second, we realize that the total amount of monomer in the tube never goes up or down; its either monomor or as a protomer in a dimer. The starting amount of monomer is thus:\n",
52
  "\n",
53
  "$$\n",
54
  "[M_0] = [M] + 2[D]\n",
@@ -74,7 +74,7 @@
74
  },
75
  {
76
  "cell_type": "code",
77
- "execution_count": 1,
78
  "metadata": {},
79
  "outputs": [],
80
  "source": [
@@ -92,22 +92,9 @@
92
  },
93
  {
94
  "cell_type": "code",
95
- "execution_count": 2,
96
  "metadata": {},
97
- "outputs": [
98
- {
99
- "data": {
100
- "text/plain": [
101
- "[{D: M0/2 - sqrt(k_D)*sqrt(8*M0 + k_D)/8 + k_D/8,\n",
102
- " M: sqrt(k_D)*sqrt(8*M0 + k_D)/4 - k_D/4,\n",
103
- " k_off: k_D*k_on}]"
104
- ]
105
- },
106
- "execution_count": 2,
107
- "metadata": {},
108
- "output_type": "execute_result"
109
- }
110
- ],
111
  "source": [
112
  "sol = sp.solve(\n",
113
  " [\n",
@@ -130,23 +117,9 @@
130
  },
131
  {
132
  "cell_type": "code",
133
- "execution_count": 3,
134
  "metadata": {},
135
- "outputs": [
136
- {
137
- "data": {
138
- "text/latex": [
139
- "$\\displaystyle \\frac{M_{0}}{2} - \\frac{\\sqrt{k_{D}} \\sqrt{8 M_{0} + k_{D}}}{8} + \\frac{k_{D}}{8}$"
140
- ],
141
- "text/plain": [
142
- "M0/2 - sqrt(k_D)*sqrt(8*M0 + k_D)/8 + k_D/8"
143
- ]
144
- },
145
- "execution_count": 3,
146
- "metadata": {},
147
- "output_type": "execute_result"
148
- }
149
- ],
150
  "source": [
151
  "sol[0][D]"
152
  ]
@@ -155,7 +128,7 @@
155
  "cell_type": "markdown",
156
  "metadata": {},
157
  "source": [
158
- "We can see that indeed the solution only depends on the dissocation constant $K_D$, and not the individual rates and indeed the 'mass balance' equation still holds ($M + 2D = M_0$), excercise for the reader."
159
  ]
160
  },
161
  {
@@ -169,7 +142,7 @@
169
  },
170
  {
171
  "cell_type": "code",
172
- "execution_count": 4,
173
  "metadata": {},
174
  "outputs": [],
175
  "source": [
@@ -188,27 +161,9 @@
188
  },
189
  {
190
  "cell_type": "code",
191
- "execution_count": 5,
192
  "metadata": {},
193
- "outputs": [
194
- {
195
- "data": {
196
- "application/vnd.jupyter.widget-view+json": {
197
- "model_id": "e88900b4bfae4f1c82b4ca7f489cb87c",
198
- "version_major": 2,
199
- "version_minor": 0
200
- },
201
- "text/html": [
202
- "Cannot show widget. You probably want to rerun the code cell above (<i>Click in the code cell, and press Shift+Enter <kbd>⇧</kbd>+<kbd>↩</kbd></i>)."
203
- ],
204
- "text/plain": [
205
- "Cannot show ipywidgets in text"
206
- ]
207
- },
208
- "metadata": {},
209
- "output_type": "display_data"
210
- }
211
- ],
212
  "source": [
213
  "import solara\n",
214
  "\n",
@@ -234,7 +189,7 @@
234
  "source": [
235
  "Note that the values are all unitless, so if we enter a dissociation constant of 1 $\\mu \\underline{M}$, the concentration $M_0$ should also be given in $\\mu \\underline{M}$, and the outputs are then $\\mu \\underline{M}$ as well. \n",
236
  "\n",
237
- "This litltle widget now tells us that if the monomer concentration if 10 times over the value of $k_D$, in the steady-state equillibrium one out of three species is still a monomer!"
238
  ]
239
  },
240
  {
@@ -246,84 +201,9 @@
246
  },
247
  {
248
  "cell_type": "code",
249
- "execution_count": 13,
250
  "metadata": {},
251
- "outputs": [
252
- {
253
- "data": {
254
- "text/html": [
255
- "<div>\n",
256
- "<style scoped>\n",
257
- " .dataframe tbody tr th:only-of-type {\n",
258
- " vertical-align: middle;\n",
259
- " }\n",
260
- "\n",
261
- " .dataframe tbody tr th {\n",
262
- " vertical-align: top;\n",
263
- " }\n",
264
- "\n",
265
- " .dataframe thead th {\n",
266
- " text-align: right;\n",
267
- " }\n",
268
- "</style>\n",
269
- "<table border=\"1\" class=\"dataframe\">\n",
270
- " <thead>\n",
271
- " <tr style=\"text-align: right;\">\n",
272
- " <th></th>\n",
273
- " <th>M0</th>\n",
274
- " <th>M</th>\n",
275
- " <th>D</th>\n",
276
- " </tr>\n",
277
- " </thead>\n",
278
- " <tbody>\n",
279
- " <tr>\n",
280
- " <th>0</th>\n",
281
- " <td>0.100000</td>\n",
282
- " <td>0.921311</td>\n",
283
- " <td>0.078689</td>\n",
284
- " </tr>\n",
285
- " <tr>\n",
286
- " <th>1</th>\n",
287
- " <td>0.109750</td>\n",
288
- " <td>0.915248</td>\n",
289
- " <td>0.084752</td>\n",
290
- " </tr>\n",
291
- " <tr>\n",
292
- " <th>2</th>\n",
293
- " <td>0.120450</td>\n",
294
- " <td>0.908825</td>\n",
295
- " <td>0.091175</td>\n",
296
- " </tr>\n",
297
- " <tr>\n",
298
- " <th>3</th>\n",
299
- " <td>0.132194</td>\n",
300
- " <td>0.902035</td>\n",
301
- " <td>0.097965</td>\n",
302
- " </tr>\n",
303
- " <tr>\n",
304
- " <th>4</th>\n",
305
- " <td>0.145083</td>\n",
306
- " <td>0.894871</td>\n",
307
- " <td>0.105129</td>\n",
308
- " </tr>\n",
309
- " </tbody>\n",
310
- "</table>\n",
311
- "</div>"
312
- ],
313
- "text/plain": [
314
- " M0 M D\n",
315
- "0 0.100000 0.921311 0.078689\n",
316
- "1 0.109750 0.915248 0.084752\n",
317
- "2 0.120450 0.908825 0.091175\n",
318
- "3 0.132194 0.902035 0.097965\n",
319
- "4 0.145083 0.894871 0.105129"
320
- ]
321
- },
322
- "execution_count": 13,
323
- "metadata": {},
324
- "output_type": "execute_result"
325
- }
326
- ],
327
  "source": [
328
  "import numpy as np\n",
329
  "import pandas as pd\n",
@@ -351,88 +231,9 @@
351
  },
352
  {
353
  "cell_type": "code",
354
- "execution_count": 14,
355
  "metadata": {},
356
- "outputs": [
357
- {
358
- "data": {
359
- "text/html": [
360
- "\n",
361
- "<style>\n",
362
- " #altair-viz-5c4f57a4e2c64d4eb3fa1e441e4e6725.vega-embed {\n",
363
- " width: 100%;\n",
364
- " display: flex;\n",
365
- " }\n",
366
- "\n",
367
- " #altair-viz-5c4f57a4e2c64d4eb3fa1e441e4e6725.vega-embed details,\n",
368
- " #altair-viz-5c4f57a4e2c64d4eb3fa1e441e4e6725.vega-embed details summary {\n",
369
- " position: relative;\n",
370
- " }\n",
371
- "</style>\n",
372
- "<div id=\"altair-viz-5c4f57a4e2c64d4eb3fa1e441e4e6725\"></div>\n",
373
- "<script type=\"text/javascript\">\n",
374
- " var VEGA_DEBUG = (typeof VEGA_DEBUG == \"undefined\") ? {} : VEGA_DEBUG;\n",
375
- " (function(spec, embedOpt){\n",
376
- " let outputDiv = document.currentScript.previousElementSibling;\n",
377
- " if (outputDiv.id !== \"altair-viz-5c4f57a4e2c64d4eb3fa1e441e4e6725\") {\n",
378
- " outputDiv = document.getElementById(\"altair-viz-5c4f57a4e2c64d4eb3fa1e441e4e6725\");\n",
379
- " }\n",
380
- " const paths = {\n",
381
- " \"vega\": \"https://cdn.jsdelivr.net/npm/vega@5?noext\",\n",
382
- " \"vega-lib\": \"https://cdn.jsdelivr.net/npm/vega-lib?noext\",\n",
383
- " \"vega-lite\": \"https://cdn.jsdelivr.net/npm/[email protected]?noext\",\n",
384
- " \"vega-embed\": \"https://cdn.jsdelivr.net/npm/vega-embed@6?noext\",\n",
385
- " };\n",
386
- "\n",
387
- " function maybeLoadScript(lib, version) {\n",
388
- " var key = `${lib.replace(\"-\", \"\")}_version`;\n",
389
- " return (VEGA_DEBUG[key] == version) ?\n",
390
- " Promise.resolve(paths[lib]) :\n",
391
- " new Promise(function(resolve, reject) {\n",
392
- " var s = document.createElement('script');\n",
393
- " document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
394
- " s.async = true;\n",
395
- " s.onload = () => {\n",
396
- " VEGA_DEBUG[key] = version;\n",
397
- " return resolve(paths[lib]);\n",
398
- " };\n",
399
- " s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
400
- " s.src = paths[lib];\n",
401
- " });\n",
402
- " }\n",
403
- "\n",
404
- " function showError(err) {\n",
405
- " outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
406
- " throw err;\n",
407
- " }\n",
408
- "\n",
409
- " function displayChart(vegaEmbed) {\n",
410
- " vegaEmbed(outputDiv, spec, embedOpt)\n",
411
- " .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
412
- " }\n",
413
- "\n",
414
- " if(typeof define === \"function\" && define.amd) {\n",
415
- " requirejs.config({paths});\n",
416
- " require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
417
- " } else {\n",
418
- " maybeLoadScript(\"vega\", \"5\")\n",
419
- " .then(() => maybeLoadScript(\"vega-lite\", \"5.17.0\"))\n",
420
- " .then(() => maybeLoadScript(\"vega-embed\", \"6\"))\n",
421
- " .catch(showError)\n",
422
- " .then(() => displayChart(vegaEmbed));\n",
423
- " }\n",
424
- " })({\"config\": {\"view\": {\"continuousWidth\": 300, \"continuousHeight\": 300}}, \"layer\": [{\"mark\": {\"type\": \"line\", \"interpolate\": \"basis\"}, \"encoding\": {\"color\": {\"field\": \"species\", \"type\": \"nominal\"}, \"x\": {\"field\": \"M0\", \"scale\": {\"type\": \"log\"}, \"title\": \"Ratio M0/kD\", \"type\": \"quantitative\"}, \"y\": {\"field\": \"y\", \"title\": \"Fraction of total\", \"type\": \"quantitative\"}}}, {\"mark\": {\"type\": \"point\"}, \"encoding\": {\"color\": {\"field\": \"species\", \"type\": \"nominal\"}, \"opacity\": {\"condition\": {\"param\": \"param_5\", \"value\": 1, \"empty\": false}, \"value\": 0}, \"x\": {\"field\": \"M0\", \"scale\": {\"type\": \"log\"}, \"title\": \"Ratio M0/kD\", \"type\": \"quantitative\"}, \"y\": {\"field\": \"y\", \"title\": \"Fraction of total\", \"type\": \"quantitative\"}}}, {\"mark\": {\"type\": \"rule\", \"color\": \"black\"}, \"encoding\": {\"opacity\": {\"condition\": {\"param\": \"param_5\", \"value\": 0.3, \"empty\": false}, \"value\": 0}, \"tooltip\": [{\"field\": \"M0\", \"format\": \".2f\", \"type\": \"quantitative\"}, {\"field\": \"M\", \"format\": \".2f\", \"type\": \"quantitative\"}, {\"field\": \"D\", \"format\": \".2f\", \"type\": \"quantitative\"}], \"x\": {\"field\": \"M0\", \"type\": \"quantitative\"}}, \"name\": \"view_5\", \"transform\": [{\"pivot\": \"species\", \"value\": \"y\", \"groupby\": [\"M0\"]}]}], \"data\": {\"name\": \"data-8452c92cacf7efa00b398135ad1f4bc6\"}, \"height\": 300, \"params\": [{\"name\": \"param_5\", \"select\": {\"type\": \"point\", \"fields\": [\"M0\"], \"nearest\": true, \"on\": \"pointerover\"}, \"views\": [\"view_5\"]}], \"width\": 600, \"$schema\": \"https://vega.github.io/schema/vega-lite/v5.17.0.json\", \"datasets\": {\"data-8452c92cacf7efa00b398135ad1f4bc6\": [{\"M0\": 0.1, \"species\": \"M\", \"y\": 0.9213106741667366}, {\"M0\": 0.10974987654930562, \"species\": \"M\", \"y\": 0.9152478142703887}, {\"M0\": 0.12045035402587821, \"species\": \"M\", \"y\": 0.9088252563655043}, {\"M0\": 0.1321941148466029, \"species\": \"M\", \"y\": 0.9020350932162419}, {\"M0\": 0.14508287784959398, \"species\": \"M\", \"y\": 0.8948707231715299}, {\"M0\": 0.1592282793341092, \"species\": \"M\", \"y\": 0.887326964051884}, {\"M0\": 0.17475284000076838, \"species\": \"M\", \"y\": 0.8794001529111963}, {\"M0\": 0.19179102616724888, \"species\": \"M\", \"y\": 0.8710882296412226}, {\"M0\": 0.2104904144512021, \"species\": \"M\", \"y\": 0.8623908028192255}, {\"M0\": 0.23101297000831597, \"species\": \"M\", \"y\": 0.8533091966764864}, {\"M0\": 0.2535364493970112, \"species\": \"M\", \"y\": 0.8438464785616561}, {\"M0\": 0.2782559402207124, \"species\": \"M\", \"y\": 0.8340074667631514}, {\"M0\": 0.30538555088334157, \"species\": \"M\", \"y\": 0.8237987190163906}, {\"M0\": 0.33516026509388425, \"species\": \"M\", \"y\": 0.813228502436007}, {\"M0\": 0.36783797718286343, \"species\": \"M\", \"y\": 0.8023067459666666}, {\"M0\": 0.40370172585965547, \"species\": \"M\", \"y\": 0.791044976730576}, {\"M0\": 0.4430621457583881, \"species\": \"M\", \"y\": 0.7794562418623244}, {\"M0\": 0.4862601580065355, \"species\": \"M\", \"y\": 0.7675550175641289}, {\"M0\": 0.533669923120631, \"species\": \"M\", \"y\": 0.7553571071923714}, {\"M0\": 0.5857020818056667, \"species\": \"M\", \"y\": 0.742879530207701}, {\"M0\": 0.6428073117284322, \"species\": \"M\", \"y\": 0.7301404037955845}, {\"M0\": 0.7054802310718644, \"species\": \"M\", \"y\": 0.7171588189022171}, {\"M0\": 0.7742636826811272, \"species\": \"M\", \"y\": 0.7039547123419793}, {\"M0\": 0.8497534359086445, \"species\": \"M\", \"y\": 0.6905487365260083}, {\"M0\": 0.9326033468832199, \"species\": \"M\", \"y\": 0.6769621282444622}, {\"M0\": 1.0235310218990263, \"species\": \"M\", \"y\": 0.6632165778136448}, {\"M0\": 1.1233240329780276, \"species\": \"M\", \"y\": 0.6493340997777712}, {\"M0\": 1.2328467394420666, \"species\": \"M\", \"y\": 0.6353369062367451}, {\"M0\": 1.3530477745798075, \"species\": \"M\", \"y\": 0.6212472837576913}, {\"M0\": 1.484968262254465, \"species\": \"M\", \"y\": 0.6070874747199139}, {\"M0\": 1.6297508346206444, \"species\": \"M\", \"y\": 0.5928795638405217}, {\"M0\": 1.7886495290574351, \"species\": \"M\", \"y\": 0.5786453705308084}, {\"M0\": 1.9630406500402715, \"species\": \"M\", \"y\": 0.5644063476409491}, {\"M0\": 2.1544346900318843, \"species\": \"M\", \"y\": 0.5501834870619822}, {\"M0\": 2.3644894126454084, \"species\": \"M\", \"y\": 0.5359972325687437}, {\"M0\": 2.5950242113997373, \"species\": \"M\", \"y\": 0.5218674002048792}, {\"M0\": 2.848035868435802, \"species\": \"M\", \"y\": 0.5078131064309908}, {\"M0\": 3.1257158496882367, \"species\": \"M\", \"y\": 0.493852704179271}, {\"M0\": 3.4304692863149193, \"species\": \"M\", \"y\": 0.48000372688273857}, {\"M0\": 3.764935806792469, \"species\": \"M\", \"y\": 0.4662828404747031}, {\"M0\": 4.132012400115339, \"species\": \"M\", \"y\": 0.45270580328479026}, {\"M0\": 4.5348785081285845, \"species\": \"M\", \"y\": 0.43928743369225387}, {\"M0\": 4.977023564332112, \"species\": \"M\", \"y\": 0.42604158533598346}, {\"M0\": 5.462277217684343, \"species\": \"M\", \"y\": 0.41298112962415334}, {\"M0\": 5.994842503189412, \"species\": \"M\", \"y\": 0.4001179452353983}, {\"M0\": 6.5793322465756825, \"species\": \"M\", \"y\": 0.3874629142582253}, {\"M0\": 7.220809018385467, \"species\": \"M\", \"y\": 0.3750259245764573}, {\"M0\": 7.924828983539178, \"species\": \"M\", \"y\": 0.3628158780761266}, {\"M0\": 8.697490026177835, \"species\": \"M\", \"y\": 0.3508407042235381}, {\"M0\": 9.545484566618342, \"species\": \"M\", \"y\": 0.33910737854522055}, {\"M0\": 10.476157527896651, \"species\": \"M\", \"y\": 0.32762194552806667}, {\"M0\": 11.497569953977369, \"species\": \"M\", \"y\": 0.3163895454519114}, {\"M0\": 12.61856883066021, \"species\": \"M\", \"y\": 0.30541444466676376}, {\"M0\": 13.848863713938732, \"species\": \"M\", \"y\": 0.2947000688324766}, {\"M0\": 15.199110829529348, \"species\": \"M\", \"y\": 0.28424903864930695}, {\"M0\": 16.68100537200059, \"species\": \"M\", \"y\": 0.27406320762302827}, {\"M0\": 18.307382802953697, \"species\": \"M\", \"y\": 0.2641437014274086}, {\"M0\": 20.09233002565048, \"species\": \"M\", \"y\": 0.2544909584493632}, {\"M0\": 22.051307399030456, \"species\": \"M\", \"y\": 0.24510477112727974}, {\"M0\": 24.201282647943835, \"species\": \"M\", \"y\": 0.2359843277203209}, {\"M0\": 26.560877829466868, \"species\": \"M\", \"y\": 0.2271282541753208}, {\"M0\": 29.150530628251786, \"species\": \"M\", \"y\": 0.21853465578766545}, {\"M0\": 31.992671377973846, \"species\": \"M\", \"y\": 0.2102011583827801}, {\"M0\": 35.111917342151344, \"species\": \"M\", \"y\": 0.20212494877505027}, {\"M0\": 38.535285937105314, \"species\": \"M\", \"y\": 0.1943028142908023}, {\"M0\": 42.29242874389499, \"species\": \"M\", \"y\": 0.1867311811709695}, {\"M0\": 46.41588833612782, \"species\": \"M\", \"y\": 0.17940615169700316}, {\"M0\": 50.9413801481638, \"species\": \"M\", \"y\": 0.17232353991018073}, {\"M0\": 55.90810182512229, \"species\": \"M\", \"y\": 0.16547890581953636}, {\"M0\": 61.35907273413176, \"species\": \"M\", \"y\": 0.15886758801703976}, {\"M0\": 67.34150657750828, \"species\": \"M\", \"y\": 0.1524847346402729}, {\"M0\": 73.90722033525783, \"species\": \"M\", \"y\": 0.14632533264264772}, {\"M0\": 81.11308307896873, \"species\": \"M\", \"y\": 0.14038423534913913}, {\"M0\": 89.02150854450393, \"species\": \"M\", \"y\": 0.1346561882915889}, {\"M0\": 97.70099572992257, \"species\": \"M\", \"y\": 0.12913585333189967}, {\"M0\": 107.22672220103243, \"species\": \"M\", \"y\": 0.12381783109393958}, {\"M0\": 117.68119524349991, \"species\": \"M\", \"y\": 0.11869668173579613}, {\"M0\": 129.1549665014884, \"species\": \"M\", \"y\": 0.11376694410323461}, {\"M0\": 141.7474162926806, \"species\": \"M\", \"y\": 0.10902315331294034}, {\"M0\": 155.56761439304722, \"species\": \"M\", \"y\": 0.10445985682045184}, {\"M0\": 170.7352647470692, \"species\": \"M\", \"y\": 0.10007162903274308}, {\"M0\": 187.3817422860385, \"species\": \"M\", \"y\": 0.09585308452929588}, {\"M0\": 205.65123083486534, \"species\": \"M\", \"y\": 0.0917988899583294}, {\"M0\": 225.70197196339214, \"species\": \"M\", \"y\": 0.08790377467673861}, {\"M0\": 247.70763559917114, \"species\": \"M\", \"y\": 0.08416254020333655}, {\"M0\": 271.85882427329426, \"species\": \"M\", \"y\": 0.0805700685553064}, {\"M0\": 298.364724028334, \"species\": \"M\", \"y\": 0.07712132953743882}, {\"M0\": 327.4549162877732, \"species\": \"M\", \"y\": 0.07381138705285176}, {\"M0\": 359.3813663804629, \"species\": \"M\", \"y\": 0.07063540450254992}, {\"M0\": 394.420605943766, \"species\": \"M\", \"y\": 0.06758864933944884}, {\"M0\": 432.87612810830615, \"species\": \"M\", \"y\": 0.06466649684044665}, {\"M0\": 475.0810162102798, \"species\": \"M\", \"y\": 0.061864433157825666}, {\"M0\": 521.400828799969, \"species\": \"M\", \"y\": 0.05917805770877593}, {\"M0\": 572.236765935022, \"species\": \"M\", \"y\": 0.0566030849591937}, {\"M0\": 628.029144183426, \"species\": \"M\", \"y\": 0.05413534565517292}, {\"M0\": 689.2612104349702, \"species\": \"M\", \"y\": 0.05177078755281282}, {\"M0\": 756.463327554629, \"species\": \"M\", \"y\": 0.04950547569414219}, {\"M0\": 830.2175681319752, \"species\": \"M\", \"y\": 0.04733559227414581}, {\"M0\": 911.1627561154896, \"species\": \"M\", \"y\": 0.045257436141088785}, {\"M0\": 1000.0, \"species\": \"M\", \"y\": 0.04326742196959632}, {\"M0\": 0.1, \"species\": \"D\", \"y\": 0.07868932583326321}, {\"M0\": 0.10974987654930562, \"species\": \"D\", \"y\": 0.08475218572961124}, {\"M0\": 0.12045035402587821, \"species\": \"D\", \"y\": 0.09117474363449568}, {\"M0\": 0.1321941148466029, \"species\": \"D\", \"y\": 0.09796490678375804}, {\"M0\": 0.14508287784959398, \"species\": \"D\", \"y\": 0.10512927682846993}, {\"M0\": 0.1592282793341092, \"species\": \"D\", \"y\": 0.11267303594811592}, {\"M0\": 0.17475284000076838, \"species\": \"D\", \"y\": 0.12059984708880354}, {\"M0\": 0.19179102616724888, \"species\": \"D\", \"y\": 0.12891177035877757}, {\"M0\": 0.2104904144512021, \"species\": \"D\", \"y\": 0.1376091971807744}, {\"M0\": 0.23101297000831597, \"species\": \"D\", \"y\": 0.14669080332351347}, {\"M0\": 0.2535364493970112, \"species\": \"D\", \"y\": 0.1561535214383439}, {\"M0\": 0.2782559402207124, \"species\": \"D\", \"y\": 0.1659925332368486}, {\"M0\": 0.30538555088334157, \"species\": \"D\", \"y\": 0.17620128098360954}, {\"M0\": 0.33516026509388425, \"species\": \"D\", \"y\": 0.18677149756399297}, {\"M0\": 0.36783797718286343, \"species\": \"D\", \"y\": 0.19769325403333335}, {\"M0\": 0.40370172585965547, \"species\": \"D\", \"y\": 0.20895502326942395}, {\"M0\": 0.4430621457583881, \"species\": \"D\", \"y\": 0.22054375813767554}, {\"M0\": 0.4862601580065355, \"species\": \"D\", \"y\": 0.2324449824358711}, {\"M0\": 0.533669923120631, \"species\": \"D\", \"y\": 0.24464289280762855}, {\"M0\": 0.5857020818056667, \"species\": \"D\", \"y\": 0.257120469792299}, {\"M0\": 0.6428073117284322, \"species\": \"D\", \"y\": 0.26985959620441546}, {\"M0\": 0.7054802310718644, \"species\": \"D\", \"y\": 0.2828411810977828}, {\"M0\": 0.7742636826811272, \"species\": \"D\", \"y\": 0.2960452876580207}, {\"M0\": 0.8497534359086445, \"species\": \"D\", \"y\": 0.3094512634739916}, {\"M0\": 0.9326033468832199, \"species\": \"D\", \"y\": 0.3230378717555378}, {\"M0\": 1.0235310218990263, \"species\": \"D\", \"y\": 0.33678342218635515}, {\"M0\": 1.1233240329780276, \"species\": \"D\", \"y\": 0.3506659002222288}, {\"M0\": 1.2328467394420666, \"species\": \"D\", \"y\": 0.36466309376325495}, {\"M0\": 1.3530477745798075, \"species\": \"D\", \"y\": 0.37875271624230866}, {\"M0\": 1.484968262254465, \"species\": \"D\", \"y\": 0.39291252528008624}, {\"M0\": 1.6297508346206444, \"species\": \"D\", \"y\": 0.40712043615947846}, {\"M0\": 1.7886495290574351, \"species\": \"D\", \"y\": 0.42135462946919144}, {\"M0\": 1.9630406500402715, \"species\": \"D\", \"y\": 0.4355936523590508}, {\"M0\": 2.1544346900318843, \"species\": \"D\", \"y\": 0.4498165129380179}, {\"M0\": 2.3644894126454084, \"species\": \"D\", \"y\": 0.4640027674312564}, {\"M0\": 2.5950242113997373, \"species\": \"D\", \"y\": 0.4781325997951208}, {\"M0\": 2.848035868435802, \"species\": \"D\", \"y\": 0.49218689356900924}, {\"M0\": 3.1257158496882367, \"species\": \"D\", \"y\": 0.5061472958207289}, {\"M0\": 3.4304692863149193, \"species\": \"D\", \"y\": 0.5199962731172615}, {\"M0\": 3.764935806792469, \"species\": \"D\", \"y\": 0.533717159525297}, {\"M0\": 4.132012400115339, \"species\": \"D\", \"y\": 0.5472941967152098}, {\"M0\": 4.5348785081285845, \"species\": \"D\", \"y\": 0.5607125663077462}, {\"M0\": 4.977023564332112, \"species\": \"D\", \"y\": 0.5739584146640166}, {\"M0\": 5.462277217684343, \"species\": \"D\", \"y\": 0.5870188703758467}, {\"M0\": 5.994842503189412, \"species\": \"D\", \"y\": 0.5998820547646017}, {\"M0\": 6.5793322465756825, \"species\": \"D\", \"y\": 0.6125370857417747}, {\"M0\": 7.220809018385467, \"species\": \"D\", \"y\": 0.6249740754235427}, {\"M0\": 7.924828983539178, \"species\": \"D\", \"y\": 0.6371841219238735}, {\"M0\": 8.697490026177835, \"species\": \"D\", \"y\": 0.6491592957764619}, {\"M0\": 9.545484566618342, \"species\": \"D\", \"y\": 0.6608926214547796}, {\"M0\": 10.476157527896651, \"species\": \"D\", \"y\": 0.6723780544719333}, {\"M0\": 11.497569953977369, \"species\": \"D\", \"y\": 0.6836104545480887}, {\"M0\": 12.61856883066021, \"species\": \"D\", \"y\": 0.6945855553332363}, {\"M0\": 13.848863713938732, \"species\": \"D\", \"y\": 0.7052999311675234}, {\"M0\": 15.199110829529348, \"species\": \"D\", \"y\": 0.7157509613506929}, {\"M0\": 16.68100537200059, \"species\": \"D\", \"y\": 0.7259367923769716}, {\"M0\": 18.307382802953697, \"species\": \"D\", \"y\": 0.7358562985725914}, {\"M0\": 20.09233002565048, \"species\": \"D\", \"y\": 0.7455090415506367}, {\"M0\": 22.051307399030456, \"species\": \"D\", \"y\": 0.7548952288727201}, {\"M0\": 24.201282647943835, \"species\": \"D\", \"y\": 0.7640156722796789}, {\"M0\": 26.560877829466868, \"species\": \"D\", \"y\": 0.7728717458246792}, {\"M0\": 29.150530628251786, \"species\": \"D\", \"y\": 0.7814653442123345}, {\"M0\": 31.992671377973846, \"species\": \"D\", \"y\": 0.7897988416172199}, {\"M0\": 35.111917342151344, \"species\": \"D\", \"y\": 0.7978750512249496}, {\"M0\": 38.535285937105314, \"species\": \"D\", \"y\": 0.8056971857091976}, {\"M0\": 42.29242874389499, \"species\": \"D\", \"y\": 0.8132688188290305}, {\"M0\": 46.41588833612782, \"species\": \"D\", \"y\": 0.8205938483029968}, {\"M0\": 50.9413801481638, \"species\": \"D\", \"y\": 0.8276764600898192}, {\"M0\": 55.90810182512229, \"species\": \"D\", \"y\": 0.8345210941804637}, {\"M0\": 61.35907273413176, \"species\": \"D\", \"y\": 0.8411324119829602}, {\"M0\": 67.34150657750828, \"species\": \"D\", \"y\": 0.8475152653597271}, {\"M0\": 73.90722033525783, \"species\": \"D\", \"y\": 0.8536746673573522}, {\"M0\": 81.11308307896873, \"species\": \"D\", \"y\": 0.8596157646508609}, {\"M0\": 89.02150854450393, \"species\": \"D\", \"y\": 0.8653438117084111}, {\"M0\": 97.70099572992257, \"species\": \"D\", \"y\": 0.8708641466681002}, {\"M0\": 107.22672220103243, \"species\": \"D\", \"y\": 0.8761821689060604}, {\"M0\": 117.68119524349991, \"species\": \"D\", \"y\": 0.8813033182642038}, {\"M0\": 129.1549665014884, \"species\": \"D\", \"y\": 0.8862330558967654}, {\"M0\": 141.7474162926806, \"species\": \"D\", \"y\": 0.8909768466870598}, {\"M0\": 155.56761439304722, \"species\": \"D\", \"y\": 0.8955401431795483}, {\"M0\": 170.7352647470692, \"species\": \"D\", \"y\": 0.8999283709672571}, {\"M0\": 187.3817422860385, \"species\": \"D\", \"y\": 0.9041469154707042}, {\"M0\": 205.65123083486534, \"species\": \"D\", \"y\": 0.9082011100416706}, {\"M0\": 225.70197196339214, \"species\": \"D\", \"y\": 0.9120962253232613}, {\"M0\": 247.70763559917114, \"species\": \"D\", \"y\": 0.9158374597966633}, {\"M0\": 271.85882427329426, \"species\": \"D\", \"y\": 0.9194299314446935}, {\"M0\": 298.364724028334, \"species\": \"D\", \"y\": 0.9228786704625612}, {\"M0\": 327.4549162877732, \"species\": \"D\", \"y\": 0.9261886129471482}, {\"M0\": 359.3813663804629, \"species\": \"D\", \"y\": 0.9293645954974501}, {\"M0\": 394.420605943766, \"species\": \"D\", \"y\": 0.932411350660551}, {\"M0\": 432.87612810830615, \"species\": \"D\", \"y\": 0.9353335031595534}, {\"M0\": 475.0810162102798, \"species\": \"D\", \"y\": 0.9381355668421743}, {\"M0\": 521.400828799969, \"species\": \"D\", \"y\": 0.9408219422912241}, {\"M0\": 572.236765935022, \"species\": \"D\", \"y\": 0.9433969150408062}, {\"M0\": 628.029144183426, \"species\": \"D\", \"y\": 0.9458646543448271}, {\"M0\": 689.2612104349702, \"species\": \"D\", \"y\": 0.9482292124471873}, {\"M0\": 756.463327554629, \"species\": \"D\", \"y\": 0.9504945243058579}, {\"M0\": 830.2175681319752, \"species\": \"D\", \"y\": 0.9526644077258541}, {\"M0\": 911.1627561154896, \"species\": \"D\", \"y\": 0.9547425638589112}, {\"M0\": 1000.0, \"species\": \"D\", \"y\": 0.9567325780304037}]}}, {\"mode\": \"vega-lite\"});\n",
425
- "</script>"
426
- ],
427
- "text/plain": [
428
- "alt.LayerChart(...)"
429
- ]
430
- },
431
- "execution_count": 14,
432
- "metadata": {},
433
- "output_type": "execute_result"
434
- }
435
- ],
436
  "source": [
437
  "import altair as alt\n",
438
  "\n",
@@ -487,7 +288,7 @@
487
  "cell_type": "markdown",
488
  "metadata": {},
489
  "source": [
490
- "Meanwhile, we can think about _why_ its so hard to reach full dimerization even if concentrations used are far higher than the dissocation constant. If we think about the reaction from an maximum entropy point of view, out intuition might tell us that the entropic equivalent of making all promomers into a dimer is the equivalent of putting all 'air molecules' into one corner of the room: it has a vanishingly low probability of happing because its so far away from the maximium entropy state of the system. \n",
491
  "\n",
492
  "Second, a closer look at the differential equation describing the change of $[D]$ also tells us the answer. There are two terms in this equation: one is positive and depends on $[M]$, the second is negative and depends on $[D]$. Therefore, even when there is a lot of initial monomer $[M_0]$ compared to the $k_D$, as more and more dimer is formed $[M]$ will go down while $[D]$ goes up. Thus the positive term becomes smaller while the negative term becomes bigger, slowing down the formation of dimer, and equillibrium is reached at a point with still a large fraction of $M$ in solution. "
493
  ]
 
24
  "M + M <-> D\n",
25
  "$$\n",
26
  "\n",
27
+ "From the kinetic scheme above, we can write down the differential equations describing this system. These differential equations tell us how the concentrations of the reaction (in this case dimerization) change in time. \n",
28
  "\n",
29
  "$$\n",
30
  "\\frac{\\partial [M]}{\\partial t} = - 2 k_{on} [M][M] + 2 k_{off} [D]\n",
 
48
  "\n",
49
  "First, we are looking for the concentration of the monomer and dimer at _steady-state_: the system has reached equillibrium and no more changes in the concentration of either the monomer or the dimer occur. This means we can set both differential equations to zero. \n",
50
  "\n",
51
+ "Second, we realize that the total amount of monomer in the tube never goes up or down; its either monomer or as a protomer in a dimer. The starting amount of monomer is thus:\n",
52
  "\n",
53
  "$$\n",
54
  "[M_0] = [M] + 2[D]\n",
 
74
  },
75
  {
76
  "cell_type": "code",
77
+ "execution_count": null,
78
  "metadata": {},
79
  "outputs": [],
80
  "source": [
 
92
  },
93
  {
94
  "cell_type": "code",
95
+ "execution_count": null,
96
  "metadata": {},
97
+ "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  "source": [
99
  "sol = sp.solve(\n",
100
  " [\n",
 
117
  },
118
  {
119
  "cell_type": "code",
120
+ "execution_count": null,
121
  "metadata": {},
122
+ "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  "source": [
124
  "sol[0][D]"
125
  ]
 
128
  "cell_type": "markdown",
129
  "metadata": {},
130
  "source": [
131
+ "We can see that indeed the solution only depends on the dissociation constant $K_D$, and not the individual rates and indeed the 'mass balance' equation still holds ($M + 2D = M_0$), excercise for the reader."
132
  ]
133
  },
134
  {
 
142
  },
143
  {
144
  "cell_type": "code",
145
+ "execution_count": null,
146
  "metadata": {},
147
  "outputs": [],
148
  "source": [
 
161
  },
162
  {
163
  "cell_type": "code",
164
+ "execution_count": null,
165
  "metadata": {},
166
+ "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  "source": [
168
  "import solara\n",
169
  "\n",
 
189
  "source": [
190
  "Note that the values are all unitless, so if we enter a dissociation constant of 1 $\\mu \\underline{M}$, the concentration $M_0$ should also be given in $\\mu \\underline{M}$, and the outputs are then $\\mu \\underline{M}$ as well. \n",
191
  "\n",
192
+ "This little widget now tells us that if the monomer concentration if 10 times over the value of $k_D$, in the steady-state equillibrium one out of three species is still a monomer!"
193
  ]
194
  },
195
  {
 
201
  },
202
  {
203
  "cell_type": "code",
204
+ "execution_count": null,
205
  "metadata": {},
206
+ "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  "source": [
208
  "import numpy as np\n",
209
  "import pandas as pd\n",
 
231
  },
232
  {
233
  "cell_type": "code",
234
+ "execution_count": null,
235
  "metadata": {},
236
+ "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  "source": [
238
  "import altair as alt\n",
239
  "\n",
 
288
  "cell_type": "markdown",
289
  "metadata": {},
290
  "source": [
291
+ "Meanwhile, we can think about _why_ its so hard to reach full dimerization even if concentrations used are far higher than the dissociation constant. If we think about the reaction from an maximum entropy point of view, out intuition might tell us that the entropic equivalent of making all promomers into a dimer is the equivalent of putting all 'air molecules' into one corner of the room: it has a vanishingly low probability of happing because its so far away from the maximium entropy state of the system. \n",
292
  "\n",
293
  "Second, a closer look at the differential equation describing the change of $[D]$ also tells us the answer. There are two terms in this equation: one is positive and depends on $[M]$, the second is negative and depends on $[D]$. Therefore, even when there is a lot of initial monomer $[M_0]$ compared to the $k_D$, as more and more dimer is formed $[M]$ will go down while $[D]$ goes up. Thus the positive term becomes smaller while the negative term becomes bigger, slowing down the formation of dimer, and equillibrium is reached at a point with still a large fraction of $M$ in solution. "
294
  ]