{ "cells": [ { "cell_type": "markdown", "id": "49bcb5b0-f19d-4b96-a5f1-e0ae30f66d8f", "metadata": {}, "source": [ "## `U` (\"Up-regulator\") up-regulates `X` , by sharing a reaction product `D` (\"Drain\") across 2 separate reactions: \n", "### `U <-> 2 D` and `X <-> D` (both mostly forward)\n", "\n", "1st-order kinetics throughout. \n", "\n", "Invoking [Le Chatelier's principle](https://www.chemguide.co.uk/physical/equilibria/lechatelier.html), it can be seen that, starting from equilibrium, when [U] goes up, so does [D]; and when [D] goes up, so does [X]. \n", "Conversely, when [U] goes down, so does [D]; and when [D] goes down, so does [X]. \n", "\n", "LAST REVISED: May 5, 2024" ] }, { "cell_type": "code", "execution_count": 1, "id": "838b9dfc-e3c2-4e9d-bedc-f32a2b6a6dfa", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Added 'D:\\Docs\\- MY CODE\\BioSimulations\\life123-Win7' to sys.path\n" ] } ], "source": [ "import set_path # Importing this module will add the project's home directory to sys.path" ] }, { "cell_type": "code", "execution_count": 2, "id": "16962197", "metadata": { "tags": [] }, "outputs": [], "source": [ "from experiments.get_notebook_info import get_notebook_basename\n", "\n", "from src.modules.chemicals.chem_data import ChemData as chem\n", "from src.modules.reactions.reaction_dynamics import ReactionDynamics\n", "\n", "from src.modules.visualization.graphic_log import GraphicLog" ] }, { "cell_type": "code", "execution_count": 3, "id": "cc53849f-351d-49e0-bfa8-22f8d8e22f8e", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-> Output will be LOGGED into the file 'up_regulate_2.log.htm'\n" ] } ], "source": [ "# Initialize the HTML logging\n", "log_file = get_notebook_basename() + \".log.htm\" # Use the notebook base filename for the log file\n", "\n", "# Set up the use of some specified graphic (Vue) components\n", "GraphicLog.config(filename=log_file,\n", " components=[\"vue_cytoscape_2\"],\n", " extra_js=\"https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.21.2/cytoscape.umd.js\")" ] }, { "cell_type": "markdown", "id": "d6d3ca49-589d-49b7-8424-37c7b01bcacf", "metadata": {}, "source": [ "### Initialize the system" ] }, { "cell_type": "code", "execution_count": 4, "id": "23c15e66-52e4-495b-aa3d-ecddd8d16942", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of reactions: 2 (at temp. 25 C)\n", "0: U <-> 2 D (kF = 8 / kR = 2 / delta_G = -3,436.6 / K = 4) | 1st order in all reactants & products\n", "1: X <-> D (kF = 6 / kR = 3 / delta_G = -1,718.3 / K = 2) | 1st order in all reactants & products\n", "Set of chemicals involved in the above reactions: {'D', 'X', 'U'}\n", "[GRAPHIC ELEMENT SENT TO LOG FILE `up_regulate_2.log.htm`]\n" ] } ], "source": [ "# Initialize the system\n", "chem_data = chem(names=[\"U\", \"X\", \"D\"])\n", "\n", "# Reaction U <-> 2D , with 1st-order kinetics for all species\n", "chem_data.add_reaction(reactants=\"U\", products=[(2, \"D\", 1)],\n", " forward_rate=8., reverse_rate=2.)\n", "\n", "# Reaction X <-> D , with 1st-order kinetics for all species\n", "chem_data.add_reaction(reactants=\"X\", products=\"D\",\n", " forward_rate=6., reverse_rate=3.)\n", "\n", "chem_data.describe_reactions()\n", "\n", "# Send the plot of the reaction network to the HTML log file\n", "chem_data.plot_reaction_network(\"vue_cytoscape_2\")" ] }, { "cell_type": "markdown", "id": "d1d0eabb-b5b1-4e15-846d-5e483a5a24a7", "metadata": {}, "source": [ "### Set the initial concentrations of all the chemicals" ] }, { "cell_type": "code", "execution_count": 5, "id": "e80645d6-eb5b-4c78-8b46-ae126d2cb2cf", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SYSTEM STATE at Time t = 0:\n", "3 species:\n", " Species 0 (U). Conc: 50.0\n", " Species 1 (X). Conc: 100.0\n", " Species 2 (D). Conc: 0.0\n", "Set of chemicals involved in reactions: {'D', 'X', 'U'}\n" ] } ], "source": [ "dynamics = ReactionDynamics(chem_data=chem_data)\n", "dynamics.set_conc(conc={\"U\": 50., \"X\": 100., \"D\": 0.})\n", "dynamics.describe_state()" ] }, { "cell_type": "code", "execution_count": null, "id": "e652b8fa-b7b3-4772-b602-aa15d11d9067", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "0b46b395-3f68-4dbd-b0c5-d67a0e623726", "metadata": { "tags": [] }, "source": [ "# 1. Take the initial system to equilibrium" ] }, { "cell_type": "code", "execution_count": 6, "id": "bcf652b8-e0dc-438e-bdbe-02216c1d52a0", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "* INFO: the tentative time step (0.03) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.015) [Step started at t=0, and will rewind there]\n", "* INFO: the tentative time step (0.015) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.0075) [Step started at t=0, and will rewind there]\n", "* INFO: the tentative time step (0.0075) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.00375) [Step started at t=0, and will rewind there]\n", "* INFO: the tentative time step (0.00375) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.001875) [Step started at t=0, and will rewind there]\n", "Some steps were backtracked and re-done, to prevent negative concentrations or excessively large concentration changes\n", "60 total step(s) taken\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SYSTEM TIMEUXDcaption
00.00000050.000000100.0000000.000000Initial state
10.00187549.25000098.8750002.625000
20.00281248.88554798.3262113.902695
30.00375048.52622397.7841025.163452
40.00468748.17195897.2485896.407496
..................
560.24570624.64394753.47530597.236801
570.28223924.54611452.41070098.497071
580.33703724.58037651.37100899.468240
590.41923524.76889450.56371699.898495
600.54253224.97182050.10914499.947215
\n", "

61 rows × 5 columns

\n", "
" ], "text/plain": [ " SYSTEM TIME U X D caption\n", "0 0.000000 50.000000 100.000000 0.000000 Initial state\n", "1 0.001875 49.250000 98.875000 2.625000 \n", "2 0.002812 48.885547 98.326211 3.902695 \n", "3 0.003750 48.526223 97.784102 5.163452 \n", "4 0.004687 48.171958 97.248589 6.407496 \n", ".. ... ... ... ... ...\n", "56 0.245706 24.643947 53.475305 97.236801 \n", "57 0.282239 24.546114 52.410700 98.497071 \n", "58 0.337037 24.580376 51.371008 99.468240 \n", "59 0.419235 24.768894 50.563716 99.898495 \n", "60 0.542532 24.971820 50.109144 99.947215 \n", "\n", "[61 rows x 5 columns]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.set_diagnostics() # To save diagnostic information about the call to single_compartment_react()\n", "\n", "# All of these settings are currently close to the default values... but subject to change; set for repeatability\n", "dynamics.set_thresholds(norm=\"norm_A\", low=0.5, high=0.8, abort=1.44)\n", "dynamics.set_thresholds(norm=\"norm_B\", low=0.08, high=0.5, abort=1.5)\n", "dynamics.set_step_factors(upshift=1.5, downshift=0.5, abort=0.5)\n", "dynamics.set_error_step_factor(0.5)\n", "\n", "dynamics.single_compartment_react(initial_step=0.03, target_end_time=0.5,\n", " variable_steps=True, explain_variable_steps=False)\n", "\n", "dynamics.get_history()" ] }, { "cell_type": "code", "execution_count": 7, "id": "b56d1612-a68c-4da3-be37-a7245b6c1a80", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "From time 0 to 0.001875, in 1 step of 0.00187\n", "From time 0.001875 to 0.01219, in 11 steps of 0.000938\n", "From time 0.01219 to 0.01781, in 4 steps of 0.00141\n", "From time 0.01781 to 0.03469, in 8 steps of 0.00211\n", "From time 0.03469 to 0.03785, in 1 step of 0.00316\n", "From time 0.03785 to 0.03943, in 1 step of 0.00158\n", "From time 0.03943 to 0.04418, in 2 steps of 0.00237\n", "From time 0.04418 to 0.04774, in 1 step of 0.00356\n", "From time 0.04774 to 0.04952, in 1 step of 0.00178\n", "From time 0.04952 to 0.05219, in 1 step of 0.00267\n", "From time 0.05219 to 0.05619, in 1 step of 0.004\n", "From time 0.05619 to 0.0582, in 1 step of 0.002\n", "From time 0.0582 to 0.0612, in 1 step of 0.003\n", "From time 0.0612 to 0.0657, in 1 step of 0.00451\n", "From time 0.0657 to 0.06796, in 1 step of 0.00225\n", "From time 0.06796 to 0.07134, in 1 step of 0.00338\n", "From time 0.07134 to 0.0764, in 1 step of 0.00507\n", "From time 0.0764 to 0.07894, in 1 step of 0.00253\n", "From time 0.07894 to 0.08274, in 1 step of 0.0038\n", "From time 0.08274 to 0.08844, in 1 step of 0.0057\n", "From time 0.08844 to 0.09129, in 1 step of 0.00285\n", "From time 0.09129 to 0.09557, in 1 step of 0.00428\n", "From time 0.09557 to 0.1212, in 4 steps of 0.00641\n", "From time 0.1212 to 0.1308, in 1 step of 0.00962\n", "From time 0.1308 to 0.1357, in 1 step of 0.00481\n", "From time 0.1357 to 0.1429, in 1 step of 0.00722\n", "From time 0.1429 to 0.1645, in 2 steps of 0.0108\n", "From time 0.1645 to 0.197, in 2 steps of 0.0162\n", "From time 0.197 to 0.2457, in 2 steps of 0.0244\n", "From time 0.2457 to 0.2822, in 1 step of 0.0365\n", "From time 0.2822 to 0.337, in 1 step of 0.0548\n", "From time 0.337 to 0.4192, in 1 step of 0.0822\n", "From time 0.4192 to 0.5425, in 1 step of 0.123\n", "(60 steps total)\n" ] } ], "source": [ "dynamics.explain_time_advance()" ] }, { "cell_type": "markdown", "id": "cbf6c9c7-8cec-400f-9e70-49ff1a9f485c", "metadata": { "tags": [] }, "source": [ "## Plots of changes of concentration with time" ] }, { "cell_type": "code", "execution_count": 8, "id": "db4e74d0-3f9d-49dc-9553-bf3cdfe785f2", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "Chemical=U
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "U", "line": { "color": "red", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "U", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.001875, 0.0028125, 0.00375, 0.0046875, 0.005625, 0.0065625, 0.0075, 0.0084375, 0.009375000000000001, 0.010312500000000002, 0.011250000000000003, 0.012187500000000004, 0.013593750000000003, 0.015000000000000003, 0.016406250000000004, 0.017812500000000005, 0.019921875000000006, 0.022031250000000006, 0.024140625000000006, 0.026250000000000006, 0.028359375000000006, 0.030468750000000006, 0.032578125000000006, 0.03468750000000001, 0.03785156250000001, 0.03943359375000001, 0.04180664062500001, 0.04417968750000001, 0.04773925781250001, 0.04951904296875001, 0.05218872070312501, 0.05619323730468751, 0.05819549560546876, 0.06119888305664063, 0.06570396423339844, 0.06795650482177736, 0.07133531570434572, 0.07640353202819826, 0.07893764019012453, 0.08273880243301393, 0.08844054579734804, 0.0912914174795151, 0.09556772500276567, 0.10198218628764154, 0.10839664757251741, 0.11481110885739328, 0.12122557014226915, 0.13084726206958294, 0.13565810803323985, 0.1428743769787252, 0.15369878039695326, 0.1645231838151813, 0.18075978894252334, 0.19699639406986538, 0.22135130176087847, 0.24570620945189153, 0.28223857098841115, 0.3370371132931906, 0.41923492675035967, 0.5425316469361133 ], "xaxis": "x", "y": [ 50, 49.25, 48.885546875, 48.52622282714844, 48.171957628471375, 47.82268200084223, 47.47832760320713, 47.138827018981644, 46.80411374361658, 46.47412217233054, 46.148787588007075, 45.828046149254185, 45.51183487862401, 45.04422003717377, 44.586520402857374, 44.1385319409692, 43.700054759863434, 43.056312161076825, 42.433097648549, 41.82977686585419, 41.24573478803396, 40.68037513623794, 40.13311981003683, 39.60340833687468, 39.0906973381439, 38.34634134800067, 37.99212166434703, 37.47363420895225, 36.9739613817775, 36.251688120565944, 35.91026441058608, 35.41213782337691, 34.69564046752737, 34.35950406735029, 33.87090266391732, 33.172068201725935, 32.847066182813144, 32.37665278296857, 31.708199743869162, 31.40045063172574, 30.957189611222436, 30.332055669317338, 30.04761836788253, 29.64026518340453, 29.070815488745257, 28.559743951567444, 28.101436116699297, 27.69080322597189, 27.139448759582695, 26.90751653019054, 26.587635286837752, 26.166222459997815, 25.822744143841394, 25.404965346729764, 25.108813852070643, 24.800680767393366, 24.643947049907403, 24.546114287254596, 24.580375891256416, 24.768894368626963, 24.971820401448806 ], "yaxis": "y" }, { "hovertemplate": "Chemical=X
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "X", "line": { "color": "green", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "X", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.001875, 0.0028125, 0.00375, 0.0046875, 0.005625, 0.0065625, 0.0075, 0.0084375, 0.009375000000000001, 0.010312500000000002, 0.011250000000000003, 0.012187500000000004, 0.013593750000000003, 0.015000000000000003, 0.016406250000000004, 0.017812500000000005, 0.019921875000000006, 0.022031250000000006, 0.024140625000000006, 0.026250000000000006, 0.028359375000000006, 0.030468750000000006, 0.032578125000000006, 0.03468750000000001, 0.03785156250000001, 0.03943359375000001, 0.04180664062500001, 0.04417968750000001, 0.04773925781250001, 0.04951904296875001, 0.05218872070312501, 0.05619323730468751, 0.05819549560546876, 0.06119888305664063, 0.06570396423339844, 0.06795650482177736, 0.07133531570434572, 0.07640353202819826, 0.07893764019012453, 0.08273880243301393, 0.08844054579734804, 0.0912914174795151, 0.09556772500276567, 0.10198218628764154, 0.10839664757251741, 0.11481110885739328, 0.12122557014226915, 0.13084726206958294, 0.13565810803323985, 0.1428743769787252, 0.15369878039695326, 0.1645231838151813, 0.18075978894252334, 0.19699639406986538, 0.22135130176087847, 0.24570620945189153, 0.28223857098841115, 0.3370371132931906, 0.41923492675035967, 0.5425316469361133 ], "xaxis": "x", "y": [ 100, 98.875, 98.3262109375, 97.78410233154297, 97.24858896471787, 96.71958673366791, 96.19701263434784, 95.68078474747749, 95.17082222418888, 94.66704527186444, 94.16937514016372, 93.67773410723605, 93.1920454661167, 92.47232753389777, 91.76566403198322, 91.07180608067932, 90.3905096717188, 89.38704852161524, 88.41078482154907, 87.46094243633803, 86.5367679938147, 85.63753020802108, 84.76251922266016, 83.9110459741967, 83.08244157401674, 81.87286427660283, 81.29236349627526, 80.43905380532827, 79.61135097965537, 78.406984862168, 77.83180636724603, 76.98832744351286, 75.76547712322048, 75.18469579958348, 74.3352799032586, 73.10880338077648, 72.52987423080755, 71.68567405701367, 70.47218603946796, 69.90328161351553, 69.07640628263276, 67.89368912818146, 67.3433695844638, 66.54636833756433, 65.41255517738188, 64.36611350090233, 63.39975255254289, 62.50681855537756, 61.268447281137725, 60.71879505348851, 59.940056768792026, 58.86858887964811, 57.92887225130012, 56.69007910994831, 55.67300998038746, 54.413618362828565, 53.47530536160518, 52.41070008491905, 51.37100808221938, 50.56371638818033, 50.10914435037049 ], "yaxis": "y" }, { "hovertemplate": "Chemical=D
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "D", "line": { "color": "gray", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "D", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.001875, 0.0028125, 0.00375, 0.0046875, 0.005625, 0.0065625, 0.0075, 0.0084375, 0.009375000000000001, 0.010312500000000002, 0.011250000000000003, 0.012187500000000004, 0.013593750000000003, 0.015000000000000003, 0.016406250000000004, 0.017812500000000005, 0.019921875000000006, 0.022031250000000006, 0.024140625000000006, 0.026250000000000006, 0.028359375000000006, 0.030468750000000006, 0.032578125000000006, 0.03468750000000001, 0.03785156250000001, 0.03943359375000001, 0.04180664062500001, 0.04417968750000001, 0.04773925781250001, 0.04951904296875001, 0.05218872070312501, 0.05619323730468751, 0.05819549560546876, 0.06119888305664063, 0.06570396423339844, 0.06795650482177736, 0.07133531570434572, 0.07640353202819826, 0.07893764019012453, 0.08273880243301393, 0.08844054579734804, 0.0912914174795151, 0.09556772500276567, 0.10198218628764154, 0.10839664757251741, 0.11481110885739328, 0.12122557014226915, 0.13084726206958294, 0.13565810803323985, 0.1428743769787252, 0.15369878039695326, 0.1645231838151813, 0.18075978894252334, 0.19699639406986538, 0.22135130176087847, 0.24570620945189153, 0.28223857098841115, 0.3370371132931906, 0.41923492675035967, 0.5425316469361133 ], "xaxis": "x", "y": [ 0, 2.625, 3.9026953124999997, 5.163452014160156, 6.407495778339386, 7.635049264647642, 8.846332159237907, 10.041561214559222, 11.220950288577962, 12.38471038347448, 13.533049683822124, 14.666173594255568, 15.784284776635282, 17.43923239175468, 19.061295162302017, 20.651130037382256, 22.209380808554315, 24.500327156231087, 26.723019881352897, 28.879503831953556, 30.97176243011735, 33.00171951950301, 34.97124115726615, 36.882137352053924, 38.73616374969545, 41.43445302739581, 42.723393175030665, 44.61367777676722, 46.44072625678962, 49.08963889670011, 50.34766481158181, 52.18739690973333, 54.8432419417248, 56.09629606571597, 57.92291476890678, 60.54706021577166, 61.775993403566176, 63.56102037704921, 66.11141447279374, 67.295817123033, 69.00921449492238, 71.44219953318385, 72.56139367977113, 74.1731012956266, 76.4458138451276, 78.51439859596277, 80.3973752140585, 82.11157499267864, 84.45265519969686, 85.46617188613038, 86.88467265753245, 88.79896620035625, 90.42563946101707, 92.49999019659214, 94.10936231547123, 95.98502010238468, 97.23680053857998, 98.49707134057172, 99.46824013526775, 99.89849487456571, 99.94721484673187 ], "yaxis": "y" } ], "layout": { "autosize": true, "legend": { "title": { "text": "Chemical" }, "tracegroupgap": 0 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Changes in concentration for `U <-> 2 D` and `X <-> D`" }, "xaxis": { "anchor": "y", "autorange": true, "domain": [ 0, 1 ], "range": [ 0, 0.5425316469361133 ], "title": { "text": "SYSTEM TIME" }, "type": "linear" }, "yaxis": { "anchor": "x", "autorange": true, "domain": [ 0, 1 ], "range": [ -5.555555555555555, 105.55555555555556 ], "title": { "text": "concentration" }, "type": "linear" } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "dynamics.plot_history(colors=['red', 'green', 'gray'])" ] }, { "cell_type": "markdown", "id": "962acf15-3b50-40e4-9daa-3dcca7d3291a", "metadata": {}, "source": [ "### Equilibrium" ] }, { "cell_type": "code", "execution_count": 9, "id": "2783a665-fca0-44e5-8d42-af2a96eae392", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0: U <-> 2 D\n", "Final concentrations: [U] = 24.97 ; [D] = 99.95\n", "1. Ratio of reactant/product concentrations, adjusted for reaction orders: 4.0024\n", " Formula used: [D] / [U]\n", "2. Ratio of forward/reverse reaction rates: 4.0\n", "Discrepancy between the two values: 0.06 %\n", "Reaction IS in equilibrium (within 1% tolerance)\n", "\n", "1: X <-> D\n", "Final concentrations: [X] = 50.11 ; [D] = 99.95\n", "1. Ratio of reactant/product concentrations, adjusted for reaction orders: 1.99459\n", " Formula used: [D] / [X]\n", "2. Ratio of forward/reverse reaction rates: 2.0\n", "Discrepancy between the two values: 0.2705 %\n", "Reaction IS in equilibrium (within 1% tolerance)\n", "\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Verify that the reaction has reached equilibrium\n", "dynamics.is_in_equilibrium()" ] }, { "cell_type": "code", "execution_count": null, "id": "95679484-9ebe-4765-8644-40e94c384f65", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "448ec7fa-6529-438b-84ba-47888c2cd080", "metadata": { "tags": [] }, "source": [ "# 2. Now, let's suddenly increase [U]" ] }, { "cell_type": "code", "execution_count": 10, "id": "7245be7a-c9db-45f5-b033-d6c521237a9c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SYSTEM STATE at Time t = 0.54253165:\n", "3 species:\n", " Species 0 (U). Conc: 70.0\n", " Species 1 (X). Conc: 50.10914435037049\n", " Species 2 (D). Conc: 99.94721484673187\n", "Set of chemicals involved in reactions: {'D', 'X', 'U'}\n" ] } ], "source": [ "dynamics.set_single_conc(species_name=\"U\", conc=70., snapshot=True)\n", "dynamics.describe_state()" ] }, { "cell_type": "code", "execution_count": 11, "id": "61eead55-fcef-41cd-b29e-f2d5ad5c6078", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SYSTEM TIMEUXDcaption
590.41923524.76889450.56371699.898495
600.54253224.97182050.10914499.947215
610.54253270.00000050.10914499.947215Set concentration of `U`
\n", "
" ], "text/plain": [ " SYSTEM TIME U X D caption\n", "59 0.419235 24.768894 50.563716 99.898495 \n", "60 0.542532 24.971820 50.109144 99.947215 \n", "61 0.542532 70.000000 50.109144 99.947215 Set concentration of `U`" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.get_history(tail=3)" ] }, { "cell_type": "markdown", "id": "24455d58-a0ea-43fa-b6ad-95c42a8b34b2", "metadata": {}, "source": [ "### Again, take the system to equilibrium" ] }, { "cell_type": "code", "execution_count": 12, "id": "c06fd8d8-d550-4e35-a239-7b91bee32be9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "* INFO: the tentative time step (0.03) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.015) [Step started at t=0.54253, and will rewind there]\n", "* INFO: the tentative time step (0.015) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.0075) [Step started at t=0.54253, and will rewind there]\n", "* INFO: the tentative time step (0.0075) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.00375) [Step started at t=0.54253, and will rewind there]\n", "Some steps were backtracked and re-done, to prevent negative concentrations or excessively large concentration changes\n", "32 total step(s) taken\n" ] } ], "source": [ "dynamics.single_compartment_react(initial_step=0.03, target_end_time=1,\n", " variable_steps=True, explain_variable_steps=False)" ] }, { "cell_type": "code", "execution_count": 13, "id": "35850ec7-e78e-4b57-976c-bc0ad6c824d5", "metadata": {}, "outputs": [], "source": [ "#dynamics.get_history()\n", "#dynamics.explain_time_advance()" ] }, { "cell_type": "code", "execution_count": 14, "id": "5af5d869-16ff-4f1d-ab83-4865b42e6376", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "Chemical=U
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "U", "line": { "color": "red", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "U", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.001875, 0.0028125, 0.00375, 0.0046875, 0.005625, 0.0065625, 0.0075, 0.0084375, 0.009375000000000001, 0.010312500000000002, 0.011250000000000003, 0.012187500000000004, 0.013593750000000003, 0.015000000000000003, 0.016406250000000004, 0.017812500000000005, 0.019921875000000006, 0.022031250000000006, 0.024140625000000006, 0.026250000000000006, 0.028359375000000006, 0.030468750000000006, 0.032578125000000006, 0.03468750000000001, 0.03785156250000001, 0.03943359375000001, 0.04180664062500001, 0.04417968750000001, 0.04773925781250001, 0.04951904296875001, 0.05218872070312501, 0.05619323730468751, 0.05819549560546876, 0.06119888305664063, 0.06570396423339844, 0.06795650482177736, 0.07133531570434572, 0.07640353202819826, 0.07893764019012453, 0.08273880243301393, 0.08844054579734804, 0.0912914174795151, 0.09556772500276567, 0.10198218628764154, 0.10839664757251741, 0.11481110885739328, 0.12122557014226915, 0.13084726206958294, 0.13565810803323985, 0.1428743769787252, 0.15369878039695326, 0.1645231838151813, 0.18075978894252334, 0.19699639406986538, 0.22135130176087847, 0.24570620945189153, 0.28223857098841115, 0.3370371132931906, 0.41923492675035967, 0.5425316469361133, 0.5425316469361133, 0.5462816469361134, 0.5481566469361133, 0.5509691469361133, 0.5551878969361134, 0.5572972719361133, 0.5604613344361133, 0.5652074281861134, 0.5675804750611133, 0.5711400453736133, 0.5764794008423633, 0.5791490785767383, 0.5831535951783008, 0.5891603700806446, 0.5951671449829884, 0.6011739198853322, 0.607180694787676, 0.6161908571411916, 0.6206959383179494, 0.6274535600830862, 0.6375899927307912, 0.6477264253784962, 0.6578628580262013, 0.6730675069977589, 0.6882721559693165, 0.7110791294266529, 0.7338861028839893, 0.7680965630699939, 0.8023070232559985, 0.8536227135350054, 0.9049384038140124, 0.9819119392325228, 1.0973722423602885 ], "xaxis": "x", "y": [ 50, 49.25, 48.885546875, 48.52622282714844, 48.171957628471375, 47.82268200084223, 47.47832760320713, 47.138827018981644, 46.80411374361658, 46.47412217233054, 46.148787588007075, 45.828046149254185, 45.51183487862401, 45.04422003717377, 44.586520402857374, 44.1385319409692, 43.700054759863434, 43.056312161076825, 42.433097648549, 41.82977686585419, 41.24573478803396, 40.68037513623794, 40.13311981003683, 39.60340833687468, 39.0906973381439, 38.34634134800067, 37.99212166434703, 37.47363420895225, 36.9739613817775, 36.251688120565944, 35.91026441058608, 35.41213782337691, 34.69564046752737, 34.35950406735029, 33.87090266391732, 33.172068201725935, 32.847066182813144, 32.37665278296857, 31.708199743869162, 31.40045063172574, 30.957189611222436, 30.332055669317338, 30.04761836788253, 29.64026518340453, 29.070815488745257, 28.559743951567444, 28.101436116699297, 27.69080322597189, 27.139448759582695, 26.90751653019054, 26.587635286837752, 26.166222459997815, 25.822744143841394, 25.404965346729764, 25.108813852070643, 24.800680767393366, 24.643947049907403, 24.546114287254596, 24.580375891256416, 24.768894368626963, 24.971820401448806, 70, 68.64960411135048, 68.00480151044856, 67.05928252961051, 65.68860845154757, 65.0376737354675, 64.08566575239784, 62.71104757754818, 62.06215234373546, 61.11586310811809, 59.755450409358204, 59.11749592887481, 58.19009615563685, 56.86319131899928, 55.627693372046444, 54.476668186990096, 53.40373970666638, 51.902695496767365, 51.22736525106632, 50.26448023109477, 48.92667509536713, 47.73547629760807, 46.672872225974785, 45.248422725218795, 44.047633849309086, 42.52224009900185, 41.33840386232175, 39.943860341788564, 38.98027261125279, 37.95193812884189, 37.343343947129185, 36.77151584257192, 36.37344741829961 ], "yaxis": "y" }, { "hovertemplate": "Chemical=X
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "X", "line": { "color": "green", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "X", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.001875, 0.0028125, 0.00375, 0.0046875, 0.005625, 0.0065625, 0.0075, 0.0084375, 0.009375000000000001, 0.010312500000000002, 0.011250000000000003, 0.012187500000000004, 0.013593750000000003, 0.015000000000000003, 0.016406250000000004, 0.017812500000000005, 0.019921875000000006, 0.022031250000000006, 0.024140625000000006, 0.026250000000000006, 0.028359375000000006, 0.030468750000000006, 0.032578125000000006, 0.03468750000000001, 0.03785156250000001, 0.03943359375000001, 0.04180664062500001, 0.04417968750000001, 0.04773925781250001, 0.04951904296875001, 0.05218872070312501, 0.05619323730468751, 0.05819549560546876, 0.06119888305664063, 0.06570396423339844, 0.06795650482177736, 0.07133531570434572, 0.07640353202819826, 0.07893764019012453, 0.08273880243301393, 0.08844054579734804, 0.0912914174795151, 0.09556772500276567, 0.10198218628764154, 0.10839664757251741, 0.11481110885739328, 0.12122557014226915, 0.13084726206958294, 0.13565810803323985, 0.1428743769787252, 0.15369878039695326, 0.1645231838151813, 0.18075978894252334, 0.19699639406986538, 0.22135130176087847, 0.24570620945189153, 0.28223857098841115, 0.3370371132931906, 0.41923492675035967, 0.5425316469361133, 0.5425316469361133, 0.5462816469361134, 0.5481566469361133, 0.5509691469361133, 0.5551878969361134, 0.5572972719361133, 0.5604613344361133, 0.5652074281861134, 0.5675804750611133, 0.5711400453736133, 0.5764794008423633, 0.5791490785767383, 0.5831535951783008, 0.5891603700806446, 0.5951671449829884, 0.6011739198853322, 0.607180694787676, 0.6161908571411916, 0.6206959383179494, 0.6274535600830862, 0.6375899927307912, 0.6477264253784962, 0.6578628580262013, 0.6730675069977589, 0.6882721559693165, 0.7110791294266529, 0.7338861028839893, 0.7680965630699939, 0.8023070232559985, 0.8536227135350054, 0.9049384038140124, 0.9819119392325228, 1.0973722423602885 ], "xaxis": "x", "y": [ 100, 98.875, 98.3262109375, 97.78410233154297, 97.24858896471787, 96.71958673366791, 96.19701263434784, 95.68078474747749, 95.17082222418888, 94.66704527186444, 94.16937514016372, 93.67773410723605, 93.1920454661167, 92.47232753389777, 91.76566403198322, 91.07180608067932, 90.3905096717188, 89.38704852161524, 88.41078482154907, 87.46094243633803, 86.5367679938147, 85.63753020802108, 84.76251922266016, 83.9110459741967, 83.08244157401674, 81.87286427660283, 81.29236349627526, 80.43905380532827, 79.61135097965537, 78.406984862168, 77.83180636724603, 76.98832744351286, 75.76547712322048, 75.18469579958348, 74.3352799032586, 73.10880338077648, 72.52987423080755, 71.68567405701367, 70.47218603946796, 69.90328161351553, 69.07640628263276, 67.89368912818146, 67.3433695844638, 66.54636833756433, 65.41255517738188, 64.36611350090233, 63.39975255254289, 62.50681855537756, 61.268447281137725, 60.71879505348851, 59.940056768792026, 58.86858887964811, 57.92887225130012, 56.69007910994831, 55.67300998038746, 54.413618362828565, 53.47530536160518, 52.41070008491905, 51.37100808221938, 50.56371638818033, 50.10914435037049, 50.10914435037049, 50.10609476951289, 50.11981339450837, 50.15092512319661, 50.2203448919828, 50.271084479253325, 50.35810655988157, 50.51203246107748, 50.60528015145098, 50.75602312087917, 51.00520918996901, 51.14560618695928, 51.36646987934619, 51.7192494016621, 52.10077983137471, 52.50621250275814, 52.93121078414743, 53.5922480334024, 53.93653837590408, 54.45941639265048, 55.2545936724872, 56.05859203378781, 56.86169035624579, 58.05337951861877, 59.21194527023817, 60.87630165267982, 62.407765337231886, 64.47642966205002, 66.19441221368767, 68.27463391364391, 69.71074166421627, 71.15109654765287, 72.21103524746438 ], "yaxis": "y" }, { "hovertemplate": "Chemical=D
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "D", "line": { "color": "gray", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "D", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.001875, 0.0028125, 0.00375, 0.0046875, 0.005625, 0.0065625, 0.0075, 0.0084375, 0.009375000000000001, 0.010312500000000002, 0.011250000000000003, 0.012187500000000004, 0.013593750000000003, 0.015000000000000003, 0.016406250000000004, 0.017812500000000005, 0.019921875000000006, 0.022031250000000006, 0.024140625000000006, 0.026250000000000006, 0.028359375000000006, 0.030468750000000006, 0.032578125000000006, 0.03468750000000001, 0.03785156250000001, 0.03943359375000001, 0.04180664062500001, 0.04417968750000001, 0.04773925781250001, 0.04951904296875001, 0.05218872070312501, 0.05619323730468751, 0.05819549560546876, 0.06119888305664063, 0.06570396423339844, 0.06795650482177736, 0.07133531570434572, 0.07640353202819826, 0.07893764019012453, 0.08273880243301393, 0.08844054579734804, 0.0912914174795151, 0.09556772500276567, 0.10198218628764154, 0.10839664757251741, 0.11481110885739328, 0.12122557014226915, 0.13084726206958294, 0.13565810803323985, 0.1428743769787252, 0.15369878039695326, 0.1645231838151813, 0.18075978894252334, 0.19699639406986538, 0.22135130176087847, 0.24570620945189153, 0.28223857098841115, 0.3370371132931906, 0.41923492675035967, 0.5425316469361133, 0.5425316469361133, 0.5462816469361134, 0.5481566469361133, 0.5509691469361133, 0.5551878969361134, 0.5572972719361133, 0.5604613344361133, 0.5652074281861134, 0.5675804750611133, 0.5711400453736133, 0.5764794008423633, 0.5791490785767383, 0.5831535951783008, 0.5891603700806446, 0.5951671449829884, 0.6011739198853322, 0.607180694787676, 0.6161908571411916, 0.6206959383179494, 0.6274535600830862, 0.6375899927307912, 0.6477264253784962, 0.6578628580262013, 0.6730675069977589, 0.6882721559693165, 0.7110791294266529, 0.7338861028839893, 0.7680965630699939, 0.8023070232559985, 0.8536227135350054, 0.9049384038140124, 0.9819119392325228, 1.0973722423602885 ], "xaxis": "x", "y": [ 0, 2.625, 3.9026953124999997, 5.163452014160156, 6.407495778339386, 7.635049264647642, 8.846332159237907, 10.041561214559222, 11.220950288577962, 12.38471038347448, 13.533049683822124, 14.666173594255568, 15.784284776635282, 17.43923239175468, 19.061295162302017, 20.651130037382256, 22.209380808554315, 24.500327156231087, 26.723019881352897, 28.879503831953556, 30.97176243011735, 33.00171951950301, 34.97124115726615, 36.882137352053924, 38.73616374969545, 41.43445302739581, 42.723393175030665, 44.61367777676722, 46.44072625678962, 49.08963889670011, 50.34766481158181, 52.18739690973333, 54.8432419417248, 56.09629606571597, 57.92291476890678, 60.54706021577166, 61.775993403566176, 63.56102037704921, 66.11141447279374, 67.295817123033, 69.00921449492238, 71.44219953318385, 72.56139367977113, 74.1731012956266, 76.4458138451276, 78.51439859596277, 80.3973752140585, 82.11157499267864, 84.45265519969686, 85.46617188613038, 86.88467265753245, 88.79896620035625, 90.42563946101707, 92.49999019659214, 94.10936231547123, 95.98502010238468, 97.23680053857998, 98.49707134057172, 99.46824013526775, 99.89849487456571, 99.94721484673187, 99.94721484673187, 102.65105620488849, 103.92694278169687, 105.78686901468473, 108.45879740202444, 109.70992724691406, 111.5269211324251, 114.12223158092851, 115.32677435818046, 117.068609859987, 119.54024918841695, 120.67576115239346, 122.30969700648247, 124.61072715744172, 126.70019262163477, 128.59681032036403, 130.31766899962216, 132.65872017016522, 133.66509031906563, 135.06798234226233, 136.9484153338809, 138.5268145680984, 139.848924388907, 141.506134228046, 142.74914622824602, 144.13557734641884, 144.97178613522698, 145.69220885147521, 145.9014017609091, 145.87784902577465, 145.6589296386277, 145.36223096430564, 145.09842911303875 ], "yaxis": "y" } ], "layout": { "autosize": true, "legend": { "title": { "text": "Chemical" }, "tracegroupgap": 0 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Changes in concentration for `U <-> 2 D` and `X <-> D`" }, "xaxis": { "anchor": "y", "autorange": true, "domain": [ 0, 1 ], "range": [ 0, 1.0973722423602885 ], "title": { "text": "SYSTEM TIME" }, "type": "linear" }, "yaxis": { "anchor": "x", "autorange": true, "domain": [ 0, 1 ], "range": [ -8.105633431161618, 154.0070351920707 ], "title": { "text": "concentration" }, "type": "linear" } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "dynamics.plot_history(colors=['red', 'green', 'gray'])" ] }, { "cell_type": "markdown", "id": "158e3787-f2d5-4a01-aaa9-6066e93e584c", "metadata": {}, "source": [ "### The (transiently) high value of [U] led to an increase in [X]" ] }, { "cell_type": "code", "execution_count": 15, "id": "c3afbcc8-bdae-4938-a3f1-ce00d62816f2", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0: U <-> 2 D\n", "Final concentrations: [U] = 36.37 ; [D] = 145.1\n", "1. Ratio of reactant/product concentrations, adjusted for reaction orders: 3.98913\n", " Formula used: [D] / [U]\n", "2. Ratio of forward/reverse reaction rates: 4.0\n", "Discrepancy between the two values: 0.2717 %\n", "Reaction IS in equilibrium (within 1% tolerance)\n", "\n", "1: X <-> D\n", "Final concentrations: [X] = 72.21 ; [D] = 145.1\n", "1. Ratio of reactant/product concentrations, adjusted for reaction orders: 2.00937\n", " Formula used: [D] / [X]\n", "2. Ratio of forward/reverse reaction rates: 2.0\n", "Discrepancy between the two values: 0.4683 %\n", "Reaction IS in equilibrium (within 1% tolerance)\n", "\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Verify that the reaction has reached equilibrium\n", "dynamics.is_in_equilibrium()" ] }, { "cell_type": "code", "execution_count": null, "id": "02d8a758-89b1-4c28-94c9-c73b11f3b8dc", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "f6619731-c5ea-484c-af3e-cea50d685361", "metadata": { "tags": [] }, "source": [ "# 3. Let's again suddenly increase [U]" ] }, { "cell_type": "code", "execution_count": 16, "id": "d3618eba-a673-4ff5-85d0-08f5ea592361", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SYSTEM STATE at Time t = 1.0973722:\n", "3 species:\n", " Species 0 (U). Conc: 100.0\n", " Species 1 (X). Conc: 72.21103524746438\n", " Species 2 (D). Conc: 145.09842911303875\n", "Set of chemicals involved in reactions: {'D', 'X', 'U'}\n" ] } ], "source": [ "dynamics.set_single_conc(species_name=\"U\", conc=100., snapshot=True)\n", "dynamics.describe_state()" ] }, { "cell_type": "code", "execution_count": 17, "id": "e8fe3554-d5ab-4306-b890-4e36289b5b4b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SYSTEM TIMEUXDcaption
920.98191236.77151671.151097145.362231
931.09737236.37344772.211035145.098429
941.097372100.00000072.211035145.098429Set concentration of `U`
\n", "
" ], "text/plain": [ " SYSTEM TIME U X D caption\n", "92 0.981912 36.771516 71.151097 145.362231 \n", "93 1.097372 36.373447 72.211035 145.098429 \n", "94 1.097372 100.000000 72.211035 145.098429 Set concentration of `U`" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.get_history(tail=3)" ] }, { "cell_type": "markdown", "id": "0974480d-ca45-46fe-addd-c8d394780fdb", "metadata": {}, "source": [ "### Yet again, take the system to equilibrium" ] }, { "cell_type": "code", "execution_count": 18, "id": "8fe20f9c-05c4-45a4-b485-a51005440200", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "* INFO: the tentative time step (0.03) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.015) [Step started at t=1.0974, and will rewind there]\n", "* INFO: the tentative time step (0.015) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.0075) [Step started at t=1.0974, and will rewind there]\n", "* INFO: the tentative time step (0.0075) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.00375) [Step started at t=1.0974, and will rewind there]\n", "* INFO: the tentative time step (0.00375) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.001875) [Step started at t=1.0974, and will rewind there]\n", "Some steps were backtracked and re-done, to prevent negative concentrations or excessively large concentration changes\n", "45 total step(s) taken\n" ] } ], "source": [ "dynamics.single_compartment_react(initial_step=0.03, target_end_time=1.6,\n", " variable_steps=True, explain_variable_steps=False)" ] }, { "cell_type": "code", "execution_count": 19, "id": "ad01c472-3ebe-4d0d-8913-1bcd85ea7a6c", "metadata": {}, "outputs": [], "source": [ "#dynamics.get_history()\n", "#dynamics.explain_time_advance()" ] }, { "cell_type": "code", "execution_count": 20, "id": "54346a72-bac9-4cc7-ba01-0533ed60371f", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "Chemical=U
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "U", "line": { "color": "red", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "U", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.001875, 0.0028125, 0.00375, 0.0046875, 0.005625, 0.0065625, 0.0075, 0.0084375, 0.009375000000000001, 0.010312500000000002, 0.011250000000000003, 0.012187500000000004, 0.013593750000000003, 0.015000000000000003, 0.016406250000000004, 0.017812500000000005, 0.019921875000000006, 0.022031250000000006, 0.024140625000000006, 0.026250000000000006, 0.028359375000000006, 0.030468750000000006, 0.032578125000000006, 0.03468750000000001, 0.03785156250000001, 0.03943359375000001, 0.04180664062500001, 0.04417968750000001, 0.04773925781250001, 0.04951904296875001, 0.05218872070312501, 0.05619323730468751, 0.05819549560546876, 0.06119888305664063, 0.06570396423339844, 0.06795650482177736, 0.07133531570434572, 0.07640353202819826, 0.07893764019012453, 0.08273880243301393, 0.08844054579734804, 0.0912914174795151, 0.09556772500276567, 0.10198218628764154, 0.10839664757251741, 0.11481110885739328, 0.12122557014226915, 0.13084726206958294, 0.13565810803323985, 0.1428743769787252, 0.15369878039695326, 0.1645231838151813, 0.18075978894252334, 0.19699639406986538, 0.22135130176087847, 0.24570620945189153, 0.28223857098841115, 0.3370371132931906, 0.41923492675035967, 0.5425316469361133, 0.5425316469361133, 0.5462816469361134, 0.5481566469361133, 0.5509691469361133, 0.5551878969361134, 0.5572972719361133, 0.5604613344361133, 0.5652074281861134, 0.5675804750611133, 0.5711400453736133, 0.5764794008423633, 0.5791490785767383, 0.5831535951783008, 0.5891603700806446, 0.5951671449829884, 0.6011739198853322, 0.607180694787676, 0.6161908571411916, 0.6206959383179494, 0.6274535600830862, 0.6375899927307912, 0.6477264253784962, 0.6578628580262013, 0.6730675069977589, 0.6882721559693165, 0.7110791294266529, 0.7338861028839893, 0.7680965630699939, 0.8023070232559985, 0.8536227135350054, 0.9049384038140124, 0.9819119392325228, 1.0973722423602885, 1.0973722423602885, 1.0992472423602886, 1.1011222423602887, 1.1039347423602888, 1.1053409923602888, 1.107450367360289, 1.109559742360289, 1.112723804860289, 1.1143058361102889, 1.116678882985289, 1.120238453297789, 1.122018238454039, 1.124687916188414, 1.1273575939227891, 1.1313621105243516, 1.133364368825133, 1.1363677562763048, 1.1408728374530626, 1.1431253780414414, 1.1465041889240097, 1.1515724052478622, 1.1541065134097885, 1.157907675652678, 1.163609419017012, 1.1664602906991792, 1.1707365982224298, 1.1771510595073056, 1.1835655207921814, 1.1899799820770571, 1.196394443361933, 1.2060161352892467, 1.2108269812529036, 1.2180432501983889, 1.228867653616617, 1.239692057034845, 1.2505164604530732, 1.2667530655804153, 1.2829896707077575, 1.2992262758350996, 1.3235811835261126, 1.3479360912171257, 1.3844684527536453, 1.421000814290165, 1.4757993565949443, 1.5305978988997238, 1.6127957123568928 ], "xaxis": "x", "y": [ 50, 49.25, 48.885546875, 48.52622282714844, 48.171957628471375, 47.82268200084223, 47.47832760320713, 47.138827018981644, 46.80411374361658, 46.47412217233054, 46.148787588007075, 45.828046149254185, 45.51183487862401, 45.04422003717377, 44.586520402857374, 44.1385319409692, 43.700054759863434, 43.056312161076825, 42.433097648549, 41.82977686585419, 41.24573478803396, 40.68037513623794, 40.13311981003683, 39.60340833687468, 39.0906973381439, 38.34634134800067, 37.99212166434703, 37.47363420895225, 36.9739613817775, 36.251688120565944, 35.91026441058608, 35.41213782337691, 34.69564046752737, 34.35950406735029, 33.87090266391732, 33.172068201725935, 32.847066182813144, 32.37665278296857, 31.708199743869162, 31.40045063172574, 30.957189611222436, 30.332055669317338, 30.04761836788253, 29.64026518340453, 29.070815488745257, 28.559743951567444, 28.101436116699297, 27.69080322597189, 27.139448759582695, 26.90751653019054, 26.587635286837752, 26.166222459997815, 25.822744143841394, 25.404965346729764, 25.108813852070643, 24.800680767393366, 24.643947049907403, 24.546114287254596, 24.580375891256416, 24.768894368626963, 24.971820401448806, 70, 68.64960411135048, 68.00480151044856, 67.05928252961051, 65.68860845154757, 65.0376737354675, 64.08566575239784, 62.71104757754818, 62.06215234373546, 61.11586310811809, 59.755450409358204, 59.11749592887481, 58.19009615563685, 56.86319131899928, 55.627693372046444, 54.476668186990096, 53.40373970666638, 51.902695496767365, 51.22736525106632, 50.26448023109477, 48.92667509536713, 47.73547629760807, 46.672872225974785, 45.248422725218795, 44.047633849309086, 42.52224009900185, 41.33840386232175, 39.943860341788564, 38.98027261125279, 37.95193812884189, 37.343343947129185, 36.77151584257192, 36.37344741829961, 100, 99.04411910917389, 98.10973127145178, 96.73960357577661, 96.07755617126598, 95.10111800575183, 94.14917525731026, 92.75700228066964, 92.08699168452215, 91.10073499200918, 89.66269920981858, 88.97374763997495, 87.96184035587012, 86.98147808003809, 85.55663794041904, 84.87732824074993, 83.88193072254988, 82.44051304117967, 81.75708828919629, 80.75832190200704, 79.3178233033994, 78.63897571661147, 77.64978281930678, 76.229350732957, 75.56440315263563, 74.59853032068712, 73.21820658651443, 71.93520102125211, 70.74185671861383, 69.63116378390956, 68.07947174343897, 67.38276956537239, 66.39025202494096, 65.01296345730381, 63.788727886388955, 62.69824633687114, 61.2382045952369, 60.00938029899484, 58.969886599828484, 57.644457276251494, 56.60935373997737, 55.382666987842, 54.527477099802496, 53.610180322853026, 53.06705431317674, 52.56439771254905 ], "yaxis": "y" }, { "hovertemplate": "Chemical=X
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "X", "line": { "color": "green", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "X", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.001875, 0.0028125, 0.00375, 0.0046875, 0.005625, 0.0065625, 0.0075, 0.0084375, 0.009375000000000001, 0.010312500000000002, 0.011250000000000003, 0.012187500000000004, 0.013593750000000003, 0.015000000000000003, 0.016406250000000004, 0.017812500000000005, 0.019921875000000006, 0.022031250000000006, 0.024140625000000006, 0.026250000000000006, 0.028359375000000006, 0.030468750000000006, 0.032578125000000006, 0.03468750000000001, 0.03785156250000001, 0.03943359375000001, 0.04180664062500001, 0.04417968750000001, 0.04773925781250001, 0.04951904296875001, 0.05218872070312501, 0.05619323730468751, 0.05819549560546876, 0.06119888305664063, 0.06570396423339844, 0.06795650482177736, 0.07133531570434572, 0.07640353202819826, 0.07893764019012453, 0.08273880243301393, 0.08844054579734804, 0.0912914174795151, 0.09556772500276567, 0.10198218628764154, 0.10839664757251741, 0.11481110885739328, 0.12122557014226915, 0.13084726206958294, 0.13565810803323985, 0.1428743769787252, 0.15369878039695326, 0.1645231838151813, 0.18075978894252334, 0.19699639406986538, 0.22135130176087847, 0.24570620945189153, 0.28223857098841115, 0.3370371132931906, 0.41923492675035967, 0.5425316469361133, 0.5425316469361133, 0.5462816469361134, 0.5481566469361133, 0.5509691469361133, 0.5551878969361134, 0.5572972719361133, 0.5604613344361133, 0.5652074281861134, 0.5675804750611133, 0.5711400453736133, 0.5764794008423633, 0.5791490785767383, 0.5831535951783008, 0.5891603700806446, 0.5951671449829884, 0.6011739198853322, 0.607180694787676, 0.6161908571411916, 0.6206959383179494, 0.6274535600830862, 0.6375899927307912, 0.6477264253784962, 0.6578628580262013, 0.6730675069977589, 0.6882721559693165, 0.7110791294266529, 0.7338861028839893, 0.7680965630699939, 0.8023070232559985, 0.8536227135350054, 0.9049384038140124, 0.9819119392325228, 1.0973722423602885, 1.0973722423602885, 1.0992472423602886, 1.1011222423602887, 1.1039347423602888, 1.1053409923602888, 1.107450367360289, 1.109559742360289, 1.112723804860289, 1.1143058361102889, 1.116678882985289, 1.120238453297789, 1.122018238454039, 1.124687916188414, 1.1273575939227891, 1.1313621105243516, 1.133364368825133, 1.1363677562763048, 1.1408728374530626, 1.1431253780414414, 1.1465041889240097, 1.1515724052478622, 1.1541065134097885, 1.157907675652678, 1.163609419017012, 1.1664602906991792, 1.1707365982224298, 1.1771510595073056, 1.1835655207921814, 1.1899799820770571, 1.196394443361933, 1.2060161352892467, 1.2108269812529036, 1.2180432501983889, 1.228867653616617, 1.239692057034845, 1.2505164604530732, 1.2667530655804153, 1.2829896707077575, 1.2992262758350996, 1.3235811835261126, 1.3479360912171257, 1.3844684527536453, 1.421000814290165, 1.4757993565949443, 1.5305978988997238, 1.6127957123568928 ], "xaxis": "x", "y": [ 100, 98.875, 98.3262109375, 97.78410233154297, 97.24858896471787, 96.71958673366791, 96.19701263434784, 95.68078474747749, 95.17082222418888, 94.66704527186444, 94.16937514016372, 93.67773410723605, 93.1920454661167, 92.47232753389777, 91.76566403198322, 91.07180608067932, 90.3905096717188, 89.38704852161524, 88.41078482154907, 87.46094243633803, 86.5367679938147, 85.63753020802108, 84.76251922266016, 83.9110459741967, 83.08244157401674, 81.87286427660283, 81.29236349627526, 80.43905380532827, 79.61135097965537, 78.406984862168, 77.83180636724603, 76.98832744351286, 75.76547712322048, 75.18469579958348, 74.3352799032586, 73.10880338077648, 72.52987423080755, 71.68567405701367, 70.47218603946796, 69.90328161351553, 69.07640628263276, 67.89368912818146, 67.3433695844638, 66.54636833756433, 65.41255517738188, 64.36611350090233, 63.39975255254289, 62.50681855537756, 61.268447281137725, 60.71879505348851, 59.940056768792026, 58.86858887964811, 57.92887225130012, 56.69007910994831, 55.67300998038746, 54.413618362828565, 53.47530536160518, 52.41070008491905, 51.37100808221938, 50.56371638818033, 50.10914435037049, 50.10914435037049, 50.10609476951289, 50.11981339450837, 50.15092512319661, 50.2203448919828, 50.271084479253325, 50.35810655988157, 50.51203246107748, 50.60528015145098, 50.75602312087917, 51.00520918996901, 51.14560618695928, 51.36646987934619, 51.7192494016621, 52.10077983137471, 52.50621250275814, 52.93121078414743, 53.5922480334024, 53.93653837590408, 54.45941639265048, 55.2545936724872, 56.05859203378781, 56.86169035624579, 58.05337951861877, 59.21194527023817, 60.87630165267982, 62.407765337231886, 64.47642966205002, 66.19441221368767, 68.27463391364391, 69.71074166421627, 71.15109654765287, 72.21103524746438, 72.21103524746438, 72.21483976469125, 72.22933374071171, 72.26647562073595, 72.29613693626126, 72.34844484547565, 72.41211776725834, 72.52388600211061, 72.59139349890081, 72.70075275730586, 72.88235209744595, 72.98559926566209, 73.14902495998763, 73.32473280695064, 73.60551721453814, 73.75796698011553, 73.99476221843045, 74.36726011970075, 74.56543858155318, 74.87053478437596, 75.34463423125432, 75.59277345672825, 75.97197579673895, 76.55516102115143, 76.85608717485056, 77.31295585246595, 78.00905709420539, 78.71809650467608, 79.43558169967547, 80.15757433059551, 81.24216263242045, 81.78228640638476, 82.58755850333122, 83.78147779994559, 84.94853588199823, 86.08140931480825, 87.72140760664219, 89.26399058378003, 90.70086837404814, 92.69313046447462, 94.44238457408339, 96.7180149462227, 98.51432053858211, 100.60404353071438, 101.96474171616619, 103.26703387633307 ], "yaxis": "y" }, { "hovertemplate": "Chemical=D
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "D", "line": { "color": "gray", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "D", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.001875, 0.0028125, 0.00375, 0.0046875, 0.005625, 0.0065625, 0.0075, 0.0084375, 0.009375000000000001, 0.010312500000000002, 0.011250000000000003, 0.012187500000000004, 0.013593750000000003, 0.015000000000000003, 0.016406250000000004, 0.017812500000000005, 0.019921875000000006, 0.022031250000000006, 0.024140625000000006, 0.026250000000000006, 0.028359375000000006, 0.030468750000000006, 0.032578125000000006, 0.03468750000000001, 0.03785156250000001, 0.03943359375000001, 0.04180664062500001, 0.04417968750000001, 0.04773925781250001, 0.04951904296875001, 0.05218872070312501, 0.05619323730468751, 0.05819549560546876, 0.06119888305664063, 0.06570396423339844, 0.06795650482177736, 0.07133531570434572, 0.07640353202819826, 0.07893764019012453, 0.08273880243301393, 0.08844054579734804, 0.0912914174795151, 0.09556772500276567, 0.10198218628764154, 0.10839664757251741, 0.11481110885739328, 0.12122557014226915, 0.13084726206958294, 0.13565810803323985, 0.1428743769787252, 0.15369878039695326, 0.1645231838151813, 0.18075978894252334, 0.19699639406986538, 0.22135130176087847, 0.24570620945189153, 0.28223857098841115, 0.3370371132931906, 0.41923492675035967, 0.5425316469361133, 0.5425316469361133, 0.5462816469361134, 0.5481566469361133, 0.5509691469361133, 0.5551878969361134, 0.5572972719361133, 0.5604613344361133, 0.5652074281861134, 0.5675804750611133, 0.5711400453736133, 0.5764794008423633, 0.5791490785767383, 0.5831535951783008, 0.5891603700806446, 0.5951671449829884, 0.6011739198853322, 0.607180694787676, 0.6161908571411916, 0.6206959383179494, 0.6274535600830862, 0.6375899927307912, 0.6477264253784962, 0.6578628580262013, 0.6730675069977589, 0.6882721559693165, 0.7110791294266529, 0.7338861028839893, 0.7680965630699939, 0.8023070232559985, 0.8536227135350054, 0.9049384038140124, 0.9819119392325228, 1.0973722423602885, 1.0973722423602885, 1.0992472423602886, 1.1011222423602887, 1.1039347423602888, 1.1053409923602888, 1.107450367360289, 1.109559742360289, 1.112723804860289, 1.1143058361102889, 1.116678882985289, 1.120238453297789, 1.122018238454039, 1.124687916188414, 1.1273575939227891, 1.1313621105243516, 1.133364368825133, 1.1363677562763048, 1.1408728374530626, 1.1431253780414414, 1.1465041889240097, 1.1515724052478622, 1.1541065134097885, 1.157907675652678, 1.163609419017012, 1.1664602906991792, 1.1707365982224298, 1.1771510595073056, 1.1835655207921814, 1.1899799820770571, 1.196394443361933, 1.2060161352892467, 1.2108269812529036, 1.2180432501983889, 1.228867653616617, 1.239692057034845, 1.2505164604530732, 1.2667530655804153, 1.2829896707077575, 1.2992262758350996, 1.3235811835261126, 1.3479360912171257, 1.3844684527536453, 1.421000814290165, 1.4757993565949443, 1.5305978988997238, 1.6127957123568928 ], "xaxis": "x", "y": [ 0, 2.625, 3.9026953124999997, 5.163452014160156, 6.407495778339386, 7.635049264647642, 8.846332159237907, 10.041561214559222, 11.220950288577962, 12.38471038347448, 13.533049683822124, 14.666173594255568, 15.784284776635282, 17.43923239175468, 19.061295162302017, 20.651130037382256, 22.209380808554315, 24.500327156231087, 26.723019881352897, 28.879503831953556, 30.97176243011735, 33.00171951950301, 34.97124115726615, 36.882137352053924, 38.73616374969545, 41.43445302739581, 42.723393175030665, 44.61367777676722, 46.44072625678962, 49.08963889670011, 50.34766481158181, 52.18739690973333, 54.8432419417248, 56.09629606571597, 57.92291476890678, 60.54706021577166, 61.775993403566176, 63.56102037704921, 66.11141447279374, 67.295817123033, 69.00921449492238, 71.44219953318385, 72.56139367977113, 74.1731012956266, 76.4458138451276, 78.51439859596277, 80.3973752140585, 82.11157499267864, 84.45265519969686, 85.46617188613038, 86.88467265753245, 88.79896620035625, 90.42563946101707, 92.49999019659214, 94.10936231547123, 95.98502010238468, 97.23680053857998, 98.49707134057172, 99.46824013526775, 99.89849487456571, 99.94721484673187, 99.94721484673187, 102.65105620488849, 103.92694278169687, 105.78686901468473, 108.45879740202444, 109.70992724691406, 111.5269211324251, 114.12223158092851, 115.32677435818046, 117.068609859987, 119.54024918841695, 120.67576115239346, 122.30969700648247, 124.61072715744172, 126.70019262163477, 128.59681032036403, 130.31766899962216, 132.65872017016522, 133.66509031906563, 135.06798234226233, 136.9484153338809, 138.5268145680984, 139.848924388907, 141.506134228046, 142.74914622824602, 144.13557734641884, 144.97178613522698, 145.69220885147521, 145.9014017609091, 145.87784902577465, 145.6589296386277, 145.36223096430564, 145.09842911303875, 145.09842911303875, 147.00638637746408, 148.86066807688786, 151.56378158821397, 152.85821508170991, 154.75878350352383, 156.59899607862428, 159.27157379705326, 160.54408749255805, 162.40724161917893, 165.10171384342004, 166.37636981489118, 168.23675868877527, 170.02177539347633, 172.5906712651269, 173.79684089888772, 175.5508406969729, 178.06117815844303, 179.22984920055737, 180.9222857721131, 183.32918352245005, 184.43873947055195, 186.03792292515064, 188.2956018734377, 189.32457088038132, 190.79944786666297, 192.8639940932689, 194.72096581332283, 196.39016922360003, 197.88956246208852, 199.90835824120475, 200.7616388233736, 201.94140180728996, 203.50205964594988, 204.78347270572698, 205.83156237195257, 207.1116475633871, 208.02671317873336, 208.66882278679796, 209.32741934352546, 209.64837230646492, 209.82611543859636, 209.74018962231597, 209.48506018408264, 209.2106140179834, 208.9136350590719 ], "yaxis": "y" } ], "layout": { "autosize": true, "legend": { "title": { "text": "Chemical" }, "tracegroupgap": 0 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Changes in concentration for `U <-> 2 D` and `X <-> D`" }, "xaxis": { "anchor": "y", "autorange": true, "domain": [ 0, 1 ], "range": [ 0, 1.6127957123568928 ], "title": { "text": "SYSTEM TIME" }, "type": "linear" }, "yaxis": { "anchor": "x", "autorange": true, "domain": [ 0, 1 ], "range": [ -11.657006413255353, 221.4831218518517 ], "title": { "text": "concentration" }, "type": "linear" } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "dynamics.plot_history(colors=['red', 'green', 'gray'])" ] }, { "cell_type": "markdown", "id": "ffbf3294-7a8d-4679-9c4b-5b9a975bf8fc", "metadata": {}, "source": [ "### The (transiently) high value of [U] again led to an increase in [X]" ] }, { "cell_type": "code", "execution_count": 21, "id": "aff608b1-5c78-4070-845a-118afe7c2108", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0: U <-> 2 D\n", "Final concentrations: [U] = 52.56 ; [D] = 208.9\n", "1. Ratio of reactant/product concentrations, adjusted for reaction orders: 3.97443\n", " Formula used: [D] / [U]\n", "2. Ratio of forward/reverse reaction rates: 4.0\n", "Discrepancy between the two values: 0.6392 %\n", "Reaction IS in equilibrium (within 2% tolerance)\n", "\n", "1: X <-> D\n", "Final concentrations: [X] = 103.3 ; [D] = 208.9\n", "1. Ratio of reactant/product concentrations, adjusted for reaction orders: 2.02304\n", " Formula used: [D] / [X]\n", "2. Ratio of forward/reverse reaction rates: 2.0\n", "Discrepancy between the two values: 1.152 %\n", "Reaction IS in equilibrium (within 2% tolerance)\n", "\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Verify that the reaction has reached equilibrium\n", "dynamics.is_in_equilibrium(tolerance=2)" ] }, { "cell_type": "code", "execution_count": null, "id": "7ddbe0ec-53c3-4d25-825a-cbe3bdf8e50a", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "64ebc51b-0dc7-4cff-b231-4c35843a7113", "metadata": { "tags": [] }, "source": [ "# 4. Now, instead, let's DECREASE [U]" ] }, { "cell_type": "code", "execution_count": 22, "id": "52f4843c-0671-4cd9-9c51-74a44feb4fe4", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SYSTEM STATE at Time t = 1.6127957:\n", "3 species:\n", " Species 0 (U). Conc: 5.0\n", " Species 1 (X). Conc: 103.26703387633307\n", " Species 2 (D). Conc: 208.9136350590719\n", "Set of chemicals involved in reactions: {'D', 'X', 'U'}\n" ] } ], "source": [ "dynamics.set_single_conc(species_name=\"U\", conc=5., snapshot=True)\n", "dynamics.describe_state()" ] }, { "cell_type": "code", "execution_count": 23, "id": "e5ce5d59", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SYSTEM TIMEUXDcaption
1381.53059853.067054101.964742209.210614
1391.61279652.564398103.267034208.913635
1401.6127965.000000103.267034208.913635Set concentration of `U`
\n", "
" ], "text/plain": [ " SYSTEM TIME U X D caption\n", "138 1.530598 53.067054 101.964742 209.210614 \n", "139 1.612796 52.564398 103.267034 208.913635 \n", "140 1.612796 5.000000 103.267034 208.913635 Set concentration of `U`" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.get_history(tail=3)" ] }, { "cell_type": "markdown", "id": "da46e3d8-58d2-4b48-8b32-887613967fce", "metadata": {}, "source": [ "### Take the system to equilibrium" ] }, { "cell_type": "code", "execution_count": 24, "id": "c392f375-c7b4-476b-809e-5cc4f5c14fa4", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "* INFO: the tentative time step (0.03) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.015) [Step started at t=1.6128, and will rewind there]\n", "* INFO: the tentative time step (0.015) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.0075) [Step started at t=1.6128, and will rewind there]\n", "* INFO: the tentative time step (0.0075) leads to a least one norm value > its ABORT threshold:\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.00375) [Step started at t=1.6128, and will rewind there]\n", "Some steps were backtracked and re-done, to prevent negative concentrations or excessively large concentration changes\n", "37 total step(s) taken\n" ] } ], "source": [ "dynamics.single_compartment_react(initial_step=0.03, target_end_time=2.3,\n", " variable_steps=True, explain_variable_steps=False)" ] }, { "cell_type": "code", "execution_count": 25, "id": "6de58fe9-ff1e-40dd-9ac7-83eee458f818", "metadata": {}, "outputs": [], "source": [ "#dynamics.get_history()\n", "#dynamics.explain_time_advance()" ] }, { "cell_type": "code", "execution_count": 26, "id": "c388dae7-c4a6-4644-a390-958e3862d102", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "Chemical=U
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "U", "line": { "color": "red", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "U", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.001875, 0.0028125, 0.00375, 0.0046875, 0.005625, 0.0065625, 0.0075, 0.0084375, 0.009375000000000001, 0.010312500000000002, 0.011250000000000003, 0.012187500000000004, 0.013593750000000003, 0.015000000000000003, 0.016406250000000004, 0.017812500000000005, 0.019921875000000006, 0.022031250000000006, 0.024140625000000006, 0.026250000000000006, 0.028359375000000006, 0.030468750000000006, 0.032578125000000006, 0.03468750000000001, 0.03785156250000001, 0.03943359375000001, 0.04180664062500001, 0.04417968750000001, 0.04773925781250001, 0.04951904296875001, 0.05218872070312501, 0.05619323730468751, 0.05819549560546876, 0.06119888305664063, 0.06570396423339844, 0.06795650482177736, 0.07133531570434572, 0.07640353202819826, 0.07893764019012453, 0.08273880243301393, 0.08844054579734804, 0.0912914174795151, 0.09556772500276567, 0.10198218628764154, 0.10839664757251741, 0.11481110885739328, 0.12122557014226915, 0.13084726206958294, 0.13565810803323985, 0.1428743769787252, 0.15369878039695326, 0.1645231838151813, 0.18075978894252334, 0.19699639406986538, 0.22135130176087847, 0.24570620945189153, 0.28223857098841115, 0.3370371132931906, 0.41923492675035967, 0.5425316469361133, 0.5425316469361133, 0.5462816469361134, 0.5481566469361133, 0.5509691469361133, 0.5551878969361134, 0.5572972719361133, 0.5604613344361133, 0.5652074281861134, 0.5675804750611133, 0.5711400453736133, 0.5764794008423633, 0.5791490785767383, 0.5831535951783008, 0.5891603700806446, 0.5951671449829884, 0.6011739198853322, 0.607180694787676, 0.6161908571411916, 0.6206959383179494, 0.6274535600830862, 0.6375899927307912, 0.6477264253784962, 0.6578628580262013, 0.6730675069977589, 0.6882721559693165, 0.7110791294266529, 0.7338861028839893, 0.7680965630699939, 0.8023070232559985, 0.8536227135350054, 0.9049384038140124, 0.9819119392325228, 1.0973722423602885, 1.0973722423602885, 1.0992472423602886, 1.1011222423602887, 1.1039347423602888, 1.1053409923602888, 1.107450367360289, 1.109559742360289, 1.112723804860289, 1.1143058361102889, 1.116678882985289, 1.120238453297789, 1.122018238454039, 1.124687916188414, 1.1273575939227891, 1.1313621105243516, 1.133364368825133, 1.1363677562763048, 1.1408728374530626, 1.1431253780414414, 1.1465041889240097, 1.1515724052478622, 1.1541065134097885, 1.157907675652678, 1.163609419017012, 1.1664602906991792, 1.1707365982224298, 1.1771510595073056, 1.1835655207921814, 1.1899799820770571, 1.196394443361933, 1.2060161352892467, 1.2108269812529036, 1.2180432501983889, 1.228867653616617, 1.239692057034845, 1.2505164604530732, 1.2667530655804153, 1.2829896707077575, 1.2992262758350996, 1.3235811835261126, 1.3479360912171257, 1.3844684527536453, 1.421000814290165, 1.4757993565949443, 1.5305978988997238, 1.6127957123568928, 1.6127957123568928, 1.6165457123568927, 1.6184207123568928, 1.6202957123568928, 1.622170712356893, 1.624045712356893, 1.626858212356893, 1.6296707123568932, 1.6324832123568933, 1.6367019623568932, 1.6388113373568933, 1.6419753998568933, 1.6467214936068932, 1.6514675873568931, 1.656213681106893, 1.660959774856893, 1.6657058686068928, 1.6728250092318928, 1.6763845795443928, 1.6817239350131428, 1.6897329682162678, 1.697742001419393, 1.705751034622518, 1.7177645844272056, 1.7237713593295494, 1.732781521683065, 1.7462967652133385, 1.759812008743612, 1.780084874039022, 1.800357739334432, 1.8307670372775473, 1.8611763352206625, 1.9067902821353353, 1.952404229050008, 2.0208251494220173, 2.1234565299800314, 2.277403600817052, 2.5083242070725835 ], "xaxis": "x", "y": [ 50, 49.25, 48.885546875, 48.52622282714844, 48.171957628471375, 47.82268200084223, 47.47832760320713, 47.138827018981644, 46.80411374361658, 46.47412217233054, 46.148787588007075, 45.828046149254185, 45.51183487862401, 45.04422003717377, 44.586520402857374, 44.1385319409692, 43.700054759863434, 43.056312161076825, 42.433097648549, 41.82977686585419, 41.24573478803396, 40.68037513623794, 40.13311981003683, 39.60340833687468, 39.0906973381439, 38.34634134800067, 37.99212166434703, 37.47363420895225, 36.9739613817775, 36.251688120565944, 35.91026441058608, 35.41213782337691, 34.69564046752737, 34.35950406735029, 33.87090266391732, 33.172068201725935, 32.847066182813144, 32.37665278296857, 31.708199743869162, 31.40045063172574, 30.957189611222436, 30.332055669317338, 30.04761836788253, 29.64026518340453, 29.070815488745257, 28.559743951567444, 28.101436116699297, 27.69080322597189, 27.139448759582695, 26.90751653019054, 26.587635286837752, 26.166222459997815, 25.822744143841394, 25.404965346729764, 25.108813852070643, 24.800680767393366, 24.643947049907403, 24.546114287254596, 24.580375891256416, 24.768894368626963, 24.971820401448806, 70, 68.64960411135048, 68.00480151044856, 67.05928252961051, 65.68860845154757, 65.0376737354675, 64.08566575239784, 62.71104757754818, 62.06215234373546, 61.11586310811809, 59.755450409358204, 59.11749592887481, 58.19009615563685, 56.86319131899928, 55.627693372046444, 54.476668186990096, 53.40373970666638, 51.902695496767365, 51.22736525106632, 50.26448023109477, 48.92667509536713, 47.73547629760807, 46.672872225974785, 45.248422725218795, 44.047633849309086, 42.52224009900185, 41.33840386232175, 39.943860341788564, 38.98027261125279, 37.95193812884189, 37.343343947129185, 36.77151584257192, 36.37344741829961, 100, 99.04411910917389, 98.10973127145178, 96.73960357577661, 96.07755617126598, 95.10111800575183, 94.14917525731026, 92.75700228066964, 92.08699168452215, 91.10073499200918, 89.66269920981858, 88.97374763997495, 87.96184035587012, 86.98147808003809, 85.55663794041904, 84.87732824074993, 83.88193072254988, 82.44051304117967, 81.75708828919629, 80.75832190200704, 79.3178233033994, 78.63897571661147, 77.64978281930678, 76.229350732957, 75.56440315263563, 74.59853032068712, 73.21820658651443, 71.93520102125211, 70.74185671861383, 69.63116378390956, 68.07947174343897, 67.38276956537239, 66.39025202494096, 65.01296345730381, 63.788727886388955, 62.69824633687114, 61.2382045952369, 60.00938029899484, 58.969886599828484, 57.644457276251494, 56.60935373997737, 55.382666987842, 54.527477099802496, 53.610180322853026, 53.06705431317674, 52.56439771254905, 5, 6.416852262943039, 7.093298830502602, 7.754536623796476, 8.400936187594821, 9.032858609428787, 9.959554345651267, 10.855239781130674, 11.721042752179953, 12.976550670000435, 13.573081043750658, 14.44572914401126, 15.706216927286428, 16.896923450019948, 18.02207794080956, 19.085639007346092, 20.091312463200854, 21.518195712981353, 22.17407228450059, 23.118564486611863, 24.450747940399598, 25.66450430232026, 26.771548359481894, 28.28775659923606, 28.948132782888006, 29.876014758372676, 31.136873011676037, 32.22218371351224, 33.62839959492597, 34.75357507776406, 36.116025502754155, 37.09836401783321, 38.18438589734958, 38.8641359477591, 39.53271648757578, 40.04409260527105, 40.28015110376856, 40.26929692237333 ], "yaxis": "y" }, { "hovertemplate": "Chemical=X
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "X", "line": { "color": "green", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "X", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.001875, 0.0028125, 0.00375, 0.0046875, 0.005625, 0.0065625, 0.0075, 0.0084375, 0.009375000000000001, 0.010312500000000002, 0.011250000000000003, 0.012187500000000004, 0.013593750000000003, 0.015000000000000003, 0.016406250000000004, 0.017812500000000005, 0.019921875000000006, 0.022031250000000006, 0.024140625000000006, 0.026250000000000006, 0.028359375000000006, 0.030468750000000006, 0.032578125000000006, 0.03468750000000001, 0.03785156250000001, 0.03943359375000001, 0.04180664062500001, 0.04417968750000001, 0.04773925781250001, 0.04951904296875001, 0.05218872070312501, 0.05619323730468751, 0.05819549560546876, 0.06119888305664063, 0.06570396423339844, 0.06795650482177736, 0.07133531570434572, 0.07640353202819826, 0.07893764019012453, 0.08273880243301393, 0.08844054579734804, 0.0912914174795151, 0.09556772500276567, 0.10198218628764154, 0.10839664757251741, 0.11481110885739328, 0.12122557014226915, 0.13084726206958294, 0.13565810803323985, 0.1428743769787252, 0.15369878039695326, 0.1645231838151813, 0.18075978894252334, 0.19699639406986538, 0.22135130176087847, 0.24570620945189153, 0.28223857098841115, 0.3370371132931906, 0.41923492675035967, 0.5425316469361133, 0.5425316469361133, 0.5462816469361134, 0.5481566469361133, 0.5509691469361133, 0.5551878969361134, 0.5572972719361133, 0.5604613344361133, 0.5652074281861134, 0.5675804750611133, 0.5711400453736133, 0.5764794008423633, 0.5791490785767383, 0.5831535951783008, 0.5891603700806446, 0.5951671449829884, 0.6011739198853322, 0.607180694787676, 0.6161908571411916, 0.6206959383179494, 0.6274535600830862, 0.6375899927307912, 0.6477264253784962, 0.6578628580262013, 0.6730675069977589, 0.6882721559693165, 0.7110791294266529, 0.7338861028839893, 0.7680965630699939, 0.8023070232559985, 0.8536227135350054, 0.9049384038140124, 0.9819119392325228, 1.0973722423602885, 1.0973722423602885, 1.0992472423602886, 1.1011222423602887, 1.1039347423602888, 1.1053409923602888, 1.107450367360289, 1.109559742360289, 1.112723804860289, 1.1143058361102889, 1.116678882985289, 1.120238453297789, 1.122018238454039, 1.124687916188414, 1.1273575939227891, 1.1313621105243516, 1.133364368825133, 1.1363677562763048, 1.1408728374530626, 1.1431253780414414, 1.1465041889240097, 1.1515724052478622, 1.1541065134097885, 1.157907675652678, 1.163609419017012, 1.1664602906991792, 1.1707365982224298, 1.1771510595073056, 1.1835655207921814, 1.1899799820770571, 1.196394443361933, 1.2060161352892467, 1.2108269812529036, 1.2180432501983889, 1.228867653616617, 1.239692057034845, 1.2505164604530732, 1.2667530655804153, 1.2829896707077575, 1.2992262758350996, 1.3235811835261126, 1.3479360912171257, 1.3844684527536453, 1.421000814290165, 1.4757993565949443, 1.5305978988997238, 1.6127957123568928, 1.6127957123568928, 1.6165457123568927, 1.6184207123568928, 1.6202957123568928, 1.622170712356893, 1.624045712356893, 1.626858212356893, 1.6296707123568932, 1.6324832123568933, 1.6367019623568932, 1.6388113373568933, 1.6419753998568933, 1.6467214936068932, 1.6514675873568931, 1.656213681106893, 1.660959774856893, 1.6657058686068928, 1.6728250092318928, 1.6763845795443928, 1.6817239350131428, 1.6897329682162678, 1.697742001419393, 1.705751034622518, 1.7177645844272056, 1.7237713593295494, 1.732781521683065, 1.7462967652133385, 1.759812008743612, 1.780084874039022, 1.800357739334432, 1.8307670372775473, 1.8611763352206625, 1.9067902821353353, 1.952404229050008, 2.0208251494220173, 2.1234565299800314, 2.277403600817052, 2.5083242070725835 ], "xaxis": "x", "y": [ 100, 98.875, 98.3262109375, 97.78410233154297, 97.24858896471787, 96.71958673366791, 96.19701263434784, 95.68078474747749, 95.17082222418888, 94.66704527186444, 94.16937514016372, 93.67773410723605, 93.1920454661167, 92.47232753389777, 91.76566403198322, 91.07180608067932, 90.3905096717188, 89.38704852161524, 88.41078482154907, 87.46094243633803, 86.5367679938147, 85.63753020802108, 84.76251922266016, 83.9110459741967, 83.08244157401674, 81.87286427660283, 81.29236349627526, 80.43905380532827, 79.61135097965537, 78.406984862168, 77.83180636724603, 76.98832744351286, 75.76547712322048, 75.18469579958348, 74.3352799032586, 73.10880338077648, 72.52987423080755, 71.68567405701367, 70.47218603946796, 69.90328161351553, 69.07640628263276, 67.89368912818146, 67.3433695844638, 66.54636833756433, 65.41255517738188, 64.36611350090233, 63.39975255254289, 62.50681855537756, 61.268447281137725, 60.71879505348851, 59.940056768792026, 58.86858887964811, 57.92887225130012, 56.69007910994831, 55.67300998038746, 54.413618362828565, 53.47530536160518, 52.41070008491905, 51.37100808221938, 50.56371638818033, 50.10914435037049, 50.10914435037049, 50.10609476951289, 50.11981339450837, 50.15092512319661, 50.2203448919828, 50.271084479253325, 50.35810655988157, 50.51203246107748, 50.60528015145098, 50.75602312087917, 51.00520918996901, 51.14560618695928, 51.36646987934619, 51.7192494016621, 52.10077983137471, 52.50621250275814, 52.93121078414743, 53.5922480334024, 53.93653837590408, 54.45941639265048, 55.2545936724872, 56.05859203378781, 56.86169035624579, 58.05337951861877, 59.21194527023817, 60.87630165267982, 62.407765337231886, 64.47642966205002, 66.19441221368767, 68.27463391364391, 69.71074166421627, 71.15109654765287, 72.21103524746438, 72.21103524746438, 72.21483976469125, 72.22933374071171, 72.26647562073595, 72.29613693626126, 72.34844484547565, 72.41211776725834, 72.52388600211061, 72.59139349890081, 72.70075275730586, 72.88235209744595, 72.98559926566209, 73.14902495998763, 73.32473280695064, 73.60551721453814, 73.75796698011553, 73.99476221843045, 74.36726011970075, 74.56543858155318, 74.87053478437596, 75.34463423125432, 75.59277345672825, 75.97197579673895, 76.55516102115143, 76.85608717485056, 77.31295585246595, 78.00905709420539, 78.71809650467608, 79.43558169967547, 80.15757433059551, 81.24216263242045, 81.78228640638476, 82.58755850333122, 83.78147779994559, 84.94853588199823, 86.08140931480825, 87.72140760664219, 89.26399058378003, 90.70086837404814, 92.69313046447462, 94.44238457408339, 96.7180149462227, 98.51432053858211, 100.60404353071438, 101.96474171616619, 103.26703387633307, 103.26703387633307, 103.29380400853015, 103.29079774068974, 103.2802321797341, 103.26240598744504, 103.23760861705811, 103.1903765540472, 103.1287020620825, 103.05347401397194, 102.92157261905311, 102.84223596505294, 102.7141654629247, 102.50268020305215, 102.26433414386956, 102.00226177064961, 101.71934324572382, 101.41822297820042, 100.94287885015078, 100.68996042621187, 100.30172483367976, 99.7019691542018, 99.08142763399593, 98.44728946252451, 97.48484928637144, 97.00101452214332, 96.27879666402829, 95.20807512376861, 94.1653483067331, 92.65949547792293, 91.25734606225039, 89.33257257384368, 87.6859912143372, 85.6232328263121, 84.11006293660698, 82.49304564641318, 81.14942610013775, 80.52326428944968, 80.55829992835199 ], "yaxis": "y" }, { "hovertemplate": "Chemical=D
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "D", "line": { "color": "gray", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "D", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.001875, 0.0028125, 0.00375, 0.0046875, 0.005625, 0.0065625, 0.0075, 0.0084375, 0.009375000000000001, 0.010312500000000002, 0.011250000000000003, 0.012187500000000004, 0.013593750000000003, 0.015000000000000003, 0.016406250000000004, 0.017812500000000005, 0.019921875000000006, 0.022031250000000006, 0.024140625000000006, 0.026250000000000006, 0.028359375000000006, 0.030468750000000006, 0.032578125000000006, 0.03468750000000001, 0.03785156250000001, 0.03943359375000001, 0.04180664062500001, 0.04417968750000001, 0.04773925781250001, 0.04951904296875001, 0.05218872070312501, 0.05619323730468751, 0.05819549560546876, 0.06119888305664063, 0.06570396423339844, 0.06795650482177736, 0.07133531570434572, 0.07640353202819826, 0.07893764019012453, 0.08273880243301393, 0.08844054579734804, 0.0912914174795151, 0.09556772500276567, 0.10198218628764154, 0.10839664757251741, 0.11481110885739328, 0.12122557014226915, 0.13084726206958294, 0.13565810803323985, 0.1428743769787252, 0.15369878039695326, 0.1645231838151813, 0.18075978894252334, 0.19699639406986538, 0.22135130176087847, 0.24570620945189153, 0.28223857098841115, 0.3370371132931906, 0.41923492675035967, 0.5425316469361133, 0.5425316469361133, 0.5462816469361134, 0.5481566469361133, 0.5509691469361133, 0.5551878969361134, 0.5572972719361133, 0.5604613344361133, 0.5652074281861134, 0.5675804750611133, 0.5711400453736133, 0.5764794008423633, 0.5791490785767383, 0.5831535951783008, 0.5891603700806446, 0.5951671449829884, 0.6011739198853322, 0.607180694787676, 0.6161908571411916, 0.6206959383179494, 0.6274535600830862, 0.6375899927307912, 0.6477264253784962, 0.6578628580262013, 0.6730675069977589, 0.6882721559693165, 0.7110791294266529, 0.7338861028839893, 0.7680965630699939, 0.8023070232559985, 0.8536227135350054, 0.9049384038140124, 0.9819119392325228, 1.0973722423602885, 1.0973722423602885, 1.0992472423602886, 1.1011222423602887, 1.1039347423602888, 1.1053409923602888, 1.107450367360289, 1.109559742360289, 1.112723804860289, 1.1143058361102889, 1.116678882985289, 1.120238453297789, 1.122018238454039, 1.124687916188414, 1.1273575939227891, 1.1313621105243516, 1.133364368825133, 1.1363677562763048, 1.1408728374530626, 1.1431253780414414, 1.1465041889240097, 1.1515724052478622, 1.1541065134097885, 1.157907675652678, 1.163609419017012, 1.1664602906991792, 1.1707365982224298, 1.1771510595073056, 1.1835655207921814, 1.1899799820770571, 1.196394443361933, 1.2060161352892467, 1.2108269812529036, 1.2180432501983889, 1.228867653616617, 1.239692057034845, 1.2505164604530732, 1.2667530655804153, 1.2829896707077575, 1.2992262758350996, 1.3235811835261126, 1.3479360912171257, 1.3844684527536453, 1.421000814290165, 1.4757993565949443, 1.5305978988997238, 1.6127957123568928, 1.6127957123568928, 1.6165457123568927, 1.6184207123568928, 1.6202957123568928, 1.622170712356893, 1.624045712356893, 1.626858212356893, 1.6296707123568932, 1.6324832123568933, 1.6367019623568932, 1.6388113373568933, 1.6419753998568933, 1.6467214936068932, 1.6514675873568931, 1.656213681106893, 1.660959774856893, 1.6657058686068928, 1.6728250092318928, 1.6763845795443928, 1.6817239350131428, 1.6897329682162678, 1.697742001419393, 1.705751034622518, 1.7177645844272056, 1.7237713593295494, 1.732781521683065, 1.7462967652133385, 1.759812008743612, 1.780084874039022, 1.800357739334432, 1.8307670372775473, 1.8611763352206625, 1.9067902821353353, 1.952404229050008, 2.0208251494220173, 2.1234565299800314, 2.277403600817052, 2.5083242070725835 ], "xaxis": "x", "y": [ 0, 2.625, 3.9026953124999997, 5.163452014160156, 6.407495778339386, 7.635049264647642, 8.846332159237907, 10.041561214559222, 11.220950288577962, 12.38471038347448, 13.533049683822124, 14.666173594255568, 15.784284776635282, 17.43923239175468, 19.061295162302017, 20.651130037382256, 22.209380808554315, 24.500327156231087, 26.723019881352897, 28.879503831953556, 30.97176243011735, 33.00171951950301, 34.97124115726615, 36.882137352053924, 38.73616374969545, 41.43445302739581, 42.723393175030665, 44.61367777676722, 46.44072625678962, 49.08963889670011, 50.34766481158181, 52.18739690973333, 54.8432419417248, 56.09629606571597, 57.92291476890678, 60.54706021577166, 61.775993403566176, 63.56102037704921, 66.11141447279374, 67.295817123033, 69.00921449492238, 71.44219953318385, 72.56139367977113, 74.1731012956266, 76.4458138451276, 78.51439859596277, 80.3973752140585, 82.11157499267864, 84.45265519969686, 85.46617188613038, 86.88467265753245, 88.79896620035625, 90.42563946101707, 92.49999019659214, 94.10936231547123, 95.98502010238468, 97.23680053857998, 98.49707134057172, 99.46824013526775, 99.89849487456571, 99.94721484673187, 99.94721484673187, 102.65105620488849, 103.92694278169687, 105.78686901468473, 108.45879740202444, 109.70992724691406, 111.5269211324251, 114.12223158092851, 115.32677435818046, 117.068609859987, 119.54024918841695, 120.67576115239346, 122.30969700648247, 124.61072715744172, 126.70019262163477, 128.59681032036403, 130.31766899962216, 132.65872017016522, 133.66509031906563, 135.06798234226233, 136.9484153338809, 138.5268145680984, 139.848924388907, 141.506134228046, 142.74914622824602, 144.13557734641884, 144.97178613522698, 145.69220885147521, 145.9014017609091, 145.87784902577465, 145.6589296386277, 145.36223096430564, 145.09842911303875, 145.09842911303875, 147.00638637746408, 148.86066807688786, 151.56378158821397, 152.85821508170991, 154.75878350352383, 156.59899607862428, 159.27157379705326, 160.54408749255805, 162.40724161917893, 165.10171384342004, 166.37636981489118, 168.23675868877527, 170.02177539347633, 172.5906712651269, 173.79684089888772, 175.5508406969729, 178.06117815844303, 179.22984920055737, 180.9222857721131, 183.32918352245005, 184.43873947055195, 186.03792292515064, 188.2956018734377, 189.32457088038132, 190.79944786666297, 192.8639940932689, 194.72096581332283, 196.39016922360003, 197.88956246208852, 199.90835824120475, 200.7616388233736, 201.94140180728996, 203.50205964594988, 204.78347270572698, 205.83156237195257, 207.1116475633871, 208.02671317873336, 208.66882278679796, 209.32741934352546, 209.64837230646492, 209.82611543859636, 209.74018962231597, 209.48506018408264, 209.2106140179834, 208.9136350590719, 208.9136350590719, 206.05316040098876, 204.70327353371005, 203.39136350807794, 202.1163905727703, 200.8773430994893, 199.07118369005525, 197.34148731106114, 195.68510941707316, 193.30599497635103, 192.19227088285075, 190.5750451844578, 188.26555487778, 186.12248789149555, 184.13425128313628, 182.290047674989, 180.5798210308029, 178.20139865929153, 177.14256394019196, 175.64181512850152, 173.57720390040402, 171.77023269676857, 170.19028275391673, 168.12030645056146, 167.2833888474857, 166.14984275463138, 164.69884778828433, 163.57095320164743, 162.26437426763013, 161.4161727176265, 160.61604535605304, 160.2979496854014, 160.18866431439375, 160.34233410327982, 160.62219031384026, 160.94305762472518, 161.0971024384182, 161.08377516230635 ], "yaxis": "y" } ], "layout": { "autosize": true, "legend": { "title": { "text": "Chemical" }, "tracegroupgap": 0 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Changes in concentration for `U <-> 2 D` and `X <-> D`" }, "xaxis": { "anchor": "y", "autorange": true, "domain": [ 0, 1 ], "range": [ 0, 2.5083242070725835 ], "title": { "text": "SYSTEM TIME" }, "type": "linear" }, "yaxis": { "anchor": "x", "autorange": true, "domain": [ 0, 1 ], "range": [ -11.657006413255353, 221.4831218518517 ], "title": { "text": "concentration" }, "type": "linear" } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "dynamics.plot_history(colors=['red', 'green', 'gray'])" ] }, { "cell_type": "markdown", "id": "a1629b91-2753-4df7-b6a0-dedf86ac3dc1", "metadata": {}, "source": [ "### The (transiently) LOW value of [U] led to an DECREASE in [X]" ] }, { "cell_type": "code", "execution_count": 27, "id": "31c9c18f-3a7f-4690-8e2f-70fdb02ef5c7", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Verify that the reaction has reached equilibrium\n", "dynamics.is_in_equilibrium(explain=False)" ] }, { "cell_type": "code", "execution_count": null, "id": "9382dbf7", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "jupytext": { "formats": "ipynb,py:percent" }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 5 }