{ "cells": [ { "cell_type": "markdown", "id": "49bcb5b0-f19d-4b96-a5f1-e0ae30f66d8f", "metadata": {}, "source": [ "## `A` up-regulates `B` , \n", "### by being *the limiting reagent* in the reaction `A + X <-> 2B` (mostly forward), where `X` is plentiful\n", "1st-order kinetics. \n", "If [A] is low, [B] remains low, too. Then, if [A] goes high, then so does [B]. However, at that point, A can no longer bring B down to any substantial extent.\n", "\n", "See also the experiment \"1D/reactions/up_regulation_1\"\n", "\n", "LAST REVISED: Nov. 4, 2023" ] }, { "cell_type": "code", "execution_count": 1, "id": "53fed9be-020d-4500-a68b-1638f9159fca", "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": "ad48644a", "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_1.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_1\"],\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: 1 (at temp. 25 C)\n", "0: A + X <-> 2 B (kF = 8 / kR = 2 / delta_G = -3,436.6 / K = 4) | 1st order in all reactants & products\n", "Set of chemicals involved in the above reactions: {'X', 'B', 'A'}\n", "[GRAPHIC ELEMENT SENT TO LOG FILE `up_regulate_1.log.htm`]\n" ] } ], "source": [ "# Initialize the system\n", "chem_data = chem(names=[\"A\", \"X\", \"B\"])\n", "\n", "# Reaction A + X <-> 2B , with 1st-order kinetics for all species\n", "chem_data.add_reaction(reactants=[(\"A\") , (\"X\")], products=[(2, \"B\")],\n", " forward_rate=8., reverse_rate=2.)\n", "\n", "chem_data.describe_reactions()\n", "\n", "# Send the plot of the reaction network to the HTML log file\n", "graph_data = chem_data.prepare_graph_network()\n", "GraphicLog.export_plot(graph_data, \"vue_cytoscape_1\")" ] }, { "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 (A). Conc: 5.0\n", " Species 1 (X). Conc: 100.0\n", " Species 2 (B). Conc: 0.0\n", "Set of chemicals involved in reactions: {'X', 'B', 'A'}\n" ] } ], "source": [ "dynamics = ReactionDynamics(chem_data=chem_data)\n", "dynamics.set_conc(conc={\"A\": 5., \"X\": 100., \"B\": 0.},\n", " snapshot=True) # A is scarce, X is plentiful, B is absent\n", "dynamics.describe_state()" ] }, { "cell_type": "markdown", "id": "0b46b395-3f68-4dbd-b0c5-d67a0e623726", "metadata": { "tags": [] }, "source": [ "### Take the initial system to equilibrium" ] }, { "cell_type": "code", "execution_count": 6, "id": "dde62826-d170-4b39-b027-c0d56fb21387", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "* INFO: the tentative time step (0.0005) 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.00025) [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", "55 total step(s) taken\n" ] } ], "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.0005, reaction_duration=0.015,\n", " variable_steps=True, explain_variable_steps=False)" ] }, { "cell_type": "code", "execution_count": 7, "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=A
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "A", "line": { "color": "red", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "A", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.00025, 0.0005, 0.000625, 0.00075, 0.000875, 0.001, 0.0011250000000000001, 0.0012500000000000002, 0.0013750000000000004, 0.0015000000000000005, 0.0016250000000000006, 0.0017500000000000007, 0.0018750000000000008, 0.002000000000000001, 0.002125000000000001, 0.002250000000000001, 0.0023750000000000012, 0.0025000000000000014, 0.0026250000000000015, 0.0027500000000000016, 0.0028750000000000017, 0.003000000000000002, 0.003125000000000002, 0.003250000000000002, 0.003375000000000002, 0.0035000000000000022, 0.0036250000000000024, 0.0037500000000000025, 0.0038750000000000026, 0.004000000000000003, 0.004125000000000003, 0.004250000000000003, 0.004375000000000003, 0.004500000000000003, 0.004625000000000003, 0.004812500000000003, 0.005000000000000004, 0.005187500000000004, 0.005375000000000004, 0.005562500000000004, 0.005750000000000004, 0.005937500000000004, 0.006125000000000005, 0.006312500000000005, 0.006593750000000005, 0.006875000000000005, 0.0071562500000000055, 0.007437500000000006, 0.007859375000000005, 0.008281250000000006, 0.008914062500000005, 0.009863281250000005, 0.011287109375000005, 0.013422851562500004, 0.016626464843750004 ], "xaxis": "x", "y": [ 5, 4, 3.209, 2.894742819, 2.6124153437973483, 2.3586049645361937, 2.1302951730442525, 1.9248138264942307, 1.7397891977973683, 1.573112462954947, 1.4229055399216455, 1.2874934006835885, 1.165380141661502, 1.0552282272582496, 0.9558404249434842, 0.8661440334434253, 0.7851770727629085, 0.7120761592784581, 0.6460658336107526, 0.5864491454395666, 0.5325993294499012, 0.48395243144170513, 0.44000076428312396, 0.4002870906215159, 0.36439944371224287, 0.33196650988314585, 0.30265350642562144, 0.27615849741702286, 0.25220909739800157, 0.2305595191676821, 0.21098792739528963, 0.19329406442353292, 0.17729711867574416, 0.16283380957391988, 0.14975666591007017, 0.13793247725667396, 0.12189511183723217, 0.10816134943911394, 0.09639968781569214, 0.08632649318637779, 0.07769904464229038, 0.0703096007849748, 0.06398033531258333, 0.05855901205409571, 0.05391528984050737, 0.04794870150445153, 0.04326555134323659, 0.0395896542055093, 0.036704300741480234, 0.033306998989528276, 0.031005492800602743, 0.028666689166455803, 0.02685565121474256, 0.02611029522254958, 0.02620913837444258, 0.026115345965600032 ], "yaxis": "y" }, { "hovertemplate": "Chemical=X
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "X", "line": { "color": "darkorange", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "X", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.00025, 0.0005, 0.000625, 0.00075, 0.000875, 0.001, 0.0011250000000000001, 0.0012500000000000002, 0.0013750000000000004, 0.0015000000000000005, 0.0016250000000000006, 0.0017500000000000007, 0.0018750000000000008, 0.002000000000000001, 0.002125000000000001, 0.002250000000000001, 0.0023750000000000012, 0.0025000000000000014, 0.0026250000000000015, 0.0027500000000000016, 0.0028750000000000017, 0.003000000000000002, 0.003125000000000002, 0.003250000000000002, 0.003375000000000002, 0.0035000000000000022, 0.0036250000000000024, 0.0037500000000000025, 0.0038750000000000026, 0.004000000000000003, 0.004125000000000003, 0.004250000000000003, 0.004375000000000003, 0.004500000000000003, 0.004625000000000003, 0.004812500000000003, 0.005000000000000004, 0.005187500000000004, 0.005375000000000004, 0.005562500000000004, 0.005750000000000004, 0.005937500000000004, 0.006125000000000005, 0.006312500000000005, 0.006593750000000005, 0.006875000000000005, 0.0071562500000000055, 0.007437500000000006, 0.007859375000000005, 0.008281250000000006, 0.008914062500000005, 0.009863281250000005, 0.011287109375000005, 0.013422851562500004, 0.016626464843750004 ], "xaxis": "x", "y": [ 100, 99, 98.209, 97.894742819, 97.61241534379735, 97.3586049645362, 97.13029517304426, 96.92481382649424, 96.73978919779738, 96.57311246295495, 96.42290553992166, 96.2874934006836, 96.16538014166152, 96.05522822725827, 95.9558404249435, 95.86614403344345, 95.78517707276293, 95.71207615927848, 95.64606583361078, 95.58644914543959, 95.53259932944992, 95.48395243144172, 95.44000076428314, 95.40028709062153, 95.36439944371226, 95.33196650988316, 95.30265350642563, 95.27615849741703, 95.25220909739801, 95.23055951916768, 95.2109879273953, 95.19329406442354, 95.17729711867575, 95.16283380957393, 95.14975666591008, 95.13793247725668, 95.12189511183725, 95.10816134943913, 95.0963996878157, 95.08632649318639, 95.0776990446423, 95.07030960078498, 95.06398033531259, 95.0585590120541, 95.05391528984052, 95.04794870150447, 95.04326555134325, 95.03958965420553, 95.0367043007415, 95.03330699898956, 95.03100549280063, 95.02866668916649, 95.02685565121477, 95.02611029522258, 95.02620913837447, 95.02611534596562 ], "yaxis": "y" }, { "hovertemplate": "Chemical=B
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "B", "line": { "color": "green", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "B", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.00025, 0.0005, 0.000625, 0.00075, 0.000875, 0.001, 0.0011250000000000001, 0.0012500000000000002, 0.0013750000000000004, 0.0015000000000000005, 0.0016250000000000006, 0.0017500000000000007, 0.0018750000000000008, 0.002000000000000001, 0.002125000000000001, 0.002250000000000001, 0.0023750000000000012, 0.0025000000000000014, 0.0026250000000000015, 0.0027500000000000016, 0.0028750000000000017, 0.003000000000000002, 0.003125000000000002, 0.003250000000000002, 0.003375000000000002, 0.0035000000000000022, 0.0036250000000000024, 0.0037500000000000025, 0.0038750000000000026, 0.004000000000000003, 0.004125000000000003, 0.004250000000000003, 0.004375000000000003, 0.004500000000000003, 0.004625000000000003, 0.004812500000000003, 0.005000000000000004, 0.005187500000000004, 0.005375000000000004, 0.005562500000000004, 0.005750000000000004, 0.005937500000000004, 0.006125000000000005, 0.006312500000000005, 0.006593750000000005, 0.006875000000000005, 0.0071562500000000055, 0.007437500000000006, 0.007859375000000005, 0.008281250000000006, 0.008914062500000005, 0.009863281250000005, 0.011287109375000005, 0.013422851562500004, 0.016626464843750004 ], "xaxis": "x", "y": [ 0, 2, 3.582, 4.210514362, 4.775169312405303, 5.2827900709276125, 5.739409653911495, 6.150372347011539, 6.520421604405263, 6.853775074090105, 7.154188920156709, 7.425013198632822, 7.669239716676995, 7.8895435454835, 8.088319150113032, 8.26771193311315, 8.429645854474183, 8.575847681443083, 8.707868332778494, 8.827101709120866, 8.934801341100197, 9.03209513711659, 9.119998471433753, 9.19942581875697, 9.271201112575515, 9.336066980233708, 9.394692987148757, 9.447683005165954, 9.495581805203997, 9.538880961664637, 9.578024145209422, 9.613411871152936, 9.645405762648513, 9.674332380852162, 9.700486668179861, 9.724135045486653, 9.756209776325537, 9.783677301121774, 9.807200624368617, 9.827347013627246, 9.844601910715422, 9.859380798430053, 9.872039329374836, 9.882881975891811, 9.892169420318988, 9.9041025969911, 9.91346889731353, 9.920820691588984, 9.926591398517042, 9.933386002020946, 9.937989014398797, 9.94266662166709, 9.946288697570516, 9.947779409554903, 9.947581723251117, 9.947769308068802 ], "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": "Reaction `A + X <-> 2 B` . Changes in concentrations with time" }, "xaxis": { "anchor": "y", "autorange": true, "domain": [ 0, 1 ], "range": [ 0, 0.016626464843750004 ], "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_curves(colors=['red', 'darkorange', 'green'])" ] }, { "cell_type": "markdown", "id": "7dc56592-179d-4e4c-b75a-8eb81dcafe71", "metadata": {}, "source": [ "**A, as the scarse limiting reagent, stops the reaction. \n", "As long as A is low, B also remains low.**" ] }, { "cell_type": "code", "execution_count": 8, "id": "bcf652b8-e0dc-438e-bdbe-02216c1d52a0", "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", " \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", " \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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SYSTEM TIMEAXBcaption
00.0000005.000000100.0000000.000000Initial state
10.0002504.00000099.0000002.000000
20.0005003.20900098.2090003.582000
30.0006252.89474397.8947434.210514
40.0007502.61241597.6124154.775169
50.0008752.35860597.3586055.282790
60.0010002.13029597.1302955.739410
70.0011251.92481496.9248146.150372
80.0012501.73978996.7397896.520422
90.0013751.57311296.5731126.853775
100.0015001.42290696.4229067.154189
110.0016251.28749396.2874937.425013
120.0017501.16538096.1653807.669240
130.0018751.05522896.0552287.889544
140.0020000.95584095.9558408.088319
150.0021250.86614495.8661448.267712
160.0022500.78517795.7851778.429646
170.0023750.71207695.7120768.575848
180.0025000.64606695.6460668.707868
190.0026250.58644995.5864498.827102
200.0027500.53259995.5325998.934801
210.0028750.48395295.4839529.032095
220.0030000.44000195.4400019.119998
230.0031250.40028795.4002879.199426
240.0032500.36439995.3643999.271201
250.0033750.33196795.3319679.336067
260.0035000.30265495.3026549.394693
270.0036250.27615895.2761589.447683
280.0037500.25220995.2522099.495582
290.0038750.23056095.2305609.538881
300.0040000.21098895.2109889.578024
310.0041250.19329495.1932949.613412
320.0042500.17729795.1772979.645406
330.0043750.16283495.1628349.674332
340.0045000.14975795.1497579.700487
350.0046250.13793295.1379329.724135
360.0048130.12189595.1218959.756210
370.0050000.10816195.1081619.783677
380.0051880.09640095.0964009.807201
390.0053750.08632695.0863269.827347
400.0055630.07769995.0776999.844602
410.0057500.07031095.0703109.859381
420.0059380.06398095.0639809.872039
430.0061250.05855995.0585599.882882
440.0063130.05391595.0539159.892169
450.0065940.04794995.0479499.904103
460.0068750.04326695.0432669.913469
470.0071560.03959095.0395909.920821
480.0074380.03670495.0367049.926591
490.0078590.03330795.0333079.933386
500.0082810.03100595.0310059.937989
510.0089140.02866795.0286679.942667
520.0098630.02685695.0268569.946289
530.0112870.02611095.0261109.947779
540.0134230.02620995.0262099.947582
550.0166260.02611595.0261159.947769
\n", "
" ], "text/plain": [ " SYSTEM TIME A X B caption\n", "0 0.000000 5.000000 100.000000 0.000000 Initial state\n", "1 0.000250 4.000000 99.000000 2.000000 \n", "2 0.000500 3.209000 98.209000 3.582000 \n", "3 0.000625 2.894743 97.894743 4.210514 \n", "4 0.000750 2.612415 97.612415 4.775169 \n", "5 0.000875 2.358605 97.358605 5.282790 \n", "6 0.001000 2.130295 97.130295 5.739410 \n", "7 0.001125 1.924814 96.924814 6.150372 \n", "8 0.001250 1.739789 96.739789 6.520422 \n", "9 0.001375 1.573112 96.573112 6.853775 \n", "10 0.001500 1.422906 96.422906 7.154189 \n", "11 0.001625 1.287493 96.287493 7.425013 \n", "12 0.001750 1.165380 96.165380 7.669240 \n", "13 0.001875 1.055228 96.055228 7.889544 \n", "14 0.002000 0.955840 95.955840 8.088319 \n", "15 0.002125 0.866144 95.866144 8.267712 \n", "16 0.002250 0.785177 95.785177 8.429646 \n", "17 0.002375 0.712076 95.712076 8.575848 \n", "18 0.002500 0.646066 95.646066 8.707868 \n", "19 0.002625 0.586449 95.586449 8.827102 \n", "20 0.002750 0.532599 95.532599 8.934801 \n", "21 0.002875 0.483952 95.483952 9.032095 \n", "22 0.003000 0.440001 95.440001 9.119998 \n", "23 0.003125 0.400287 95.400287 9.199426 \n", "24 0.003250 0.364399 95.364399 9.271201 \n", "25 0.003375 0.331967 95.331967 9.336067 \n", "26 0.003500 0.302654 95.302654 9.394693 \n", "27 0.003625 0.276158 95.276158 9.447683 \n", "28 0.003750 0.252209 95.252209 9.495582 \n", "29 0.003875 0.230560 95.230560 9.538881 \n", "30 0.004000 0.210988 95.210988 9.578024 \n", "31 0.004125 0.193294 95.193294 9.613412 \n", "32 0.004250 0.177297 95.177297 9.645406 \n", "33 0.004375 0.162834 95.162834 9.674332 \n", "34 0.004500 0.149757 95.149757 9.700487 \n", "35 0.004625 0.137932 95.137932 9.724135 \n", "36 0.004813 0.121895 95.121895 9.756210 \n", "37 0.005000 0.108161 95.108161 9.783677 \n", "38 0.005188 0.096400 95.096400 9.807201 \n", "39 0.005375 0.086326 95.086326 9.827347 \n", "40 0.005563 0.077699 95.077699 9.844602 \n", "41 0.005750 0.070310 95.070310 9.859381 \n", "42 0.005938 0.063980 95.063980 9.872039 \n", "43 0.006125 0.058559 95.058559 9.882882 \n", "44 0.006313 0.053915 95.053915 9.892169 \n", "45 0.006594 0.047949 95.047949 9.904103 \n", "46 0.006875 0.043266 95.043266 9.913469 \n", "47 0.007156 0.039590 95.039590 9.920821 \n", "48 0.007438 0.036704 95.036704 9.926591 \n", "49 0.007859 0.033307 95.033307 9.933386 \n", "50 0.008281 0.031005 95.031005 9.937989 \n", "51 0.008914 0.028667 95.028667 9.942667 \n", "52 0.009863 0.026856 95.026856 9.946289 \n", "53 0.011287 0.026110 95.026110 9.947779 \n", "54 0.013423 0.026209 95.026209 9.947582 \n", "55 0.016626 0.026115 95.026115 9.947769 " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.get_history()" ] }, { "cell_type": "code", "execution_count": 9, "id": "b56d1612-a68c-4da3-be37-a7245b6c1a80", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "From time 0 to 0.0005, in 2 steps of 0.00025\n", "From time 0.0005 to 0.004625, in 33 steps of 0.000125\n", "From time 0.004625 to 0.006313, in 9 steps of 0.000188\n", "From time 0.006313 to 0.007438, in 4 steps of 0.000281\n", "From time 0.007438 to 0.008281, in 2 steps of 0.000422\n", "From time 0.008281 to 0.008914, in 1 step of 0.000633\n", "From time 0.008914 to 0.009863, in 1 step of 0.000949\n", "From time 0.009863 to 0.01129, in 1 step of 0.00142\n", "From time 0.01129 to 0.01342, in 1 step of 0.00214\n", "From time 0.01342 to 0.01663, in 1 step of 0.0032\n", "(55 steps total)\n" ] } ], "source": [ "dynamics.explain_time_advance()" ] }, { "cell_type": "markdown", "id": "962acf15-3b50-40e4-9daa-3dcca7d3291a", "metadata": {}, "source": [ "### Equilibrium" ] }, { "cell_type": "code", "execution_count": 10, "id": "2783a665-fca0-44e5-8d42-af2a96eae392", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0: A + X <-> 2 B\n", "Final concentrations: [B] = 9.948 ; [A] = 0.02612 ; [X] = 95.03\n", "1. Ratio of reactant/product concentrations, adjusted for reaction orders: 4.00855\n", " Formula used: [B] / ([A][X])\n", "2. Ratio of forward/reverse reaction rates: 4.0\n", "Discrepancy between the two values: 0.2137 %\n", "Reaction IS in equilibrium (within 1% tolerance)\n", "\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 10, "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": "15355aeb-f702-4d10-9d13-8365f6a76772", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "448ec7fa-6529-438b-84ba-47888c2cd080", "metadata": { "tags": [] }, "source": [ "# Now, let's suddenly increase [A]" ] }, { "cell_type": "code", "execution_count": 11, "id": "7245be7a-c9db-45f5-b033-d6c521237a9c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SYSTEM STATE at Time t = 0.016626465:\n", "3 species:\n", " Species 0 (A). Conc: 50.0\n", " Species 1 (X). Conc: 95.02611534596562\n", " Species 2 (B). Conc: 9.947769308068802\n", "Set of chemicals involved in reactions: {'X', 'B', 'A'}\n" ] } ], "source": [ "dynamics.set_single_conc(species_name=\"A\", conc=50., snapshot=True)\n", "dynamics.describe_state()" ] }, { "cell_type": "code", "execution_count": 12, "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SYSTEM TIMEAXBcaption
520.0098630.02685695.0268569.946289
530.0112870.02611095.0261109.947779
540.0134230.02620995.0262099.947582
550.0166260.02611595.0261159.947769
560.01662650.00000095.0261159.947769Set concentration of `A`
\n", "
" ], "text/plain": [ " SYSTEM TIME A X B caption\n", "52 0.009863 0.026856 95.026856 9.946289 \n", "53 0.011287 0.026110 95.026110 9.947779 \n", "54 0.013423 0.026209 95.026209 9.947582 \n", "55 0.016626 0.026115 95.026115 9.947769 \n", "56 0.016626 50.000000 95.026115 9.947769 Set concentration of `A`" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.get_history(tail=5)" ] }, { "cell_type": "markdown", "id": "24455d58-a0ea-43fa-b6ad-95c42a8b34b2", "metadata": {}, "source": [ "### Again, take the system to equilibrium" ] }, { "cell_type": "code", "execution_count": 13, "id": "c06fd8d8-d550-4e35-a239-7b91bee32be9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "* INFO: the tentative time step (0.0005) 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.00025) [Step started at t=0.016626, and will rewind there]\n", "* INFO: the tentative time step (0.00025) 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.000125) [Step started at t=0.016626, and will rewind there]\n", "* INFO: the tentative time step (0.000125) 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 6.25e-05) [Step started at t=0.016626, and will rewind there]\n", "* INFO: the tentative time step (6.25e-05) 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 3.125e-05) [Step started at t=0.016626, and will rewind there]\n", "Some steps were backtracked and re-done, to prevent negative concentrations or excessively large concentration changes\n", "78 total step(s) taken\n" ] } ], "source": [ "dynamics.single_compartment_react(initial_step=0.0005, target_end_time=0.035,\n", " variable_steps=True, explain_variable_steps=False)" ] }, { "cell_type": "code", "execution_count": 14, "id": "ea3bc6ce-e7c3-4ba4-873a-0104286a2fe3", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "Chemical=A
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "A", "line": { "color": "red", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "A", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.00025, 0.0005, 0.000625, 0.00075, 0.000875, 0.001, 0.0011250000000000001, 0.0012500000000000002, 0.0013750000000000004, 0.0015000000000000005, 0.0016250000000000006, 0.0017500000000000007, 0.0018750000000000008, 0.002000000000000001, 0.002125000000000001, 0.002250000000000001, 0.0023750000000000012, 0.0025000000000000014, 0.0026250000000000015, 0.0027500000000000016, 0.0028750000000000017, 0.003000000000000002, 0.003125000000000002, 0.003250000000000002, 0.003375000000000002, 0.0035000000000000022, 0.0036250000000000024, 0.0037500000000000025, 0.0038750000000000026, 0.004000000000000003, 0.004125000000000003, 0.004250000000000003, 0.004375000000000003, 0.004500000000000003, 0.004625000000000003, 0.004812500000000003, 0.005000000000000004, 0.005187500000000004, 0.005375000000000004, 0.005562500000000004, 0.005750000000000004, 0.005937500000000004, 0.006125000000000005, 0.006312500000000005, 0.006593750000000005, 0.006875000000000005, 0.0071562500000000055, 0.007437500000000006, 0.007859375000000005, 0.008281250000000006, 0.008914062500000005, 0.009863281250000005, 0.011287109375000005, 0.013422851562500004, 0.016626464843750004, 0.016626464843750004, 0.016657714843750004, 0.016673339843750003, 0.01668896484375, 0.01670458984375, 0.01672802734375, 0.01675146484375, 0.016774902343750002, 0.016798339843750003, 0.016833496093750004, 0.016851074218750005, 0.016877441406250006, 0.016916992187500007, 0.016936767578125008, 0.016966430664062507, 0.017010925292968757, 0.017033172607421883, 0.01706654357910157, 0.0171166000366211, 0.017141628265380866, 0.017179170608520516, 0.017235484123229988, 0.017263640880584723, 0.017305876016616827, 0.017369228720664983, 0.01740090507268906, 0.017448419600725178, 0.017519691392779355, 0.017555327288806443, 0.017608781132847074, 0.017688961898908024, 0.0177290522819385, 0.01778918785648421, 0.017879391218302777, 0.01792449289921206, 0.017992145420575985, 0.018093624202621873, 0.018144363593644817, 0.018220472680179234, 0.01833463630998086, 0.018448799939782483, 0.018562963569584107, 0.018677127199385732, 0.018848372644088167, 0.018933995366439384, 0.019062429449966212, 0.01925508057525645, 0.01944773170054669, 0.019640382825836928, 0.019833033951127167, 0.020025685076417405, 0.020314661764352766, 0.020603638452288128, 0.02089261514022349, 0.02118159182815885, 0.02147056851609421, 0.021759545204029573, 0.022048521891964934, 0.022337498579900295, 0.022626475267835656, 0.022915451955771018, 0.02320442864370638, 0.02349340533164174, 0.0237823820195771, 0.024071358707512463, 0.024504823739415503, 0.024938288771318543, 0.025371753803221583, 0.025805218835124624, 0.026238683867027664, 0.026672148898930704, 0.027322346446785262, 0.02797254399463982, 0.02862274154249438, 0.02959803786427622, 0.030573334186058062, 0.03203627866873082, 0.034230695392739964, 0.037522320478753673 ], "xaxis": "x", "y": [ 5, 4, 3.209, 2.894742819, 2.6124153437973483, 2.3586049645361937, 2.1302951730442525, 1.9248138264942307, 1.7397891977973683, 1.573112462954947, 1.4229055399216455, 1.2874934006835885, 1.165380141661502, 1.0552282272582496, 0.9558404249434842, 0.8661440334434253, 0.7851770727629085, 0.7120761592784581, 0.6460658336107526, 0.5864491454395666, 0.5325993294499012, 0.48395243144170513, 0.44000076428312396, 0.4002870906215159, 0.36439944371224287, 0.33196650988314585, 0.30265350642562144, 0.27615849741702286, 0.25220909739800157, 0.2305595191676821, 0.21098792739528963, 0.19329406442353292, 0.17729711867574416, 0.16283380957391988, 0.14975666591007017, 0.13793247725667396, 0.12189511183723217, 0.10816134943911394, 0.09639968781569214, 0.08632649318637779, 0.07769904464229038, 0.0703096007849748, 0.06398033531258333, 0.05855901205409571, 0.05391528984050737, 0.04794870150445153, 0.04326555134323659, 0.0395896542055093, 0.036704300741480234, 0.033306998989528276, 0.031005492800602743, 0.028666689166455803, 0.02685565121474256, 0.02611029522254958, 0.02620913837444258, 0.026115345965600032, 50, 48.81279529375718, 48.24061291988646, 47.67862823229769, 47.126579810269234, 46.31303274328364, 45.52068351886258, 44.74874122369926, 43.99645386370261, 42.896432057671475, 42.366905124973755, 41.58722352683281, 40.449643404812775, 39.90381069174907, 39.10136663428113, 37.93327111913333, 37.374703240352105, 36.554870156072056, 35.364338252708436, 34.79706835809741, 33.965873561200794, 32.76187804662478, 32.19032408545847, 31.354328415260273, 30.14654826958428, 29.57541536516729, 28.741565038450698, 27.540160715709014, 26.974328244500455, 26.14978609913989, 24.965148925128037, 24.409548183686276, 23.601513200641122, 22.444002232825866, 21.903491230506347, 21.119015944257264, 19.998696159048073, 19.47793795846661, 18.723752942428842, 17.650147465538254, 16.65684770476653, 15.735971715531882, 14.880629007248855, 13.686838091660919, 13.150530810415605, 12.385945140571353, 11.322805821069025, 10.373109207089003, 9.52180419979558, 8.756334129783715, 8.06613708739654, 7.130325355165776, 6.325882195720753, 5.63112979273681, 5.0287032241644845, 4.504526706542796, 4.047071012770113, 3.6468053261303544, 3.295786206338327, 2.9873449563764725, 2.715846737616279, 2.4765027598279437, 2.2652222540209475, 2.0784946287783455, 1.9132947850598905, 1.6938621853144613, 1.5118166092576515, 1.3605345928078456, 1.2346425915978416, 1.1297583372849325, 1.0422923068785968, 0.9327940946091285, 0.8503508450740351, 0.788195471137651, 0.7178353496807718, 0.6732947355286701, 0.6309410032977733, 0.6022303588434575, 0.5945161626538438 ], "yaxis": "y" }, { "hovertemplate": "Chemical=X
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "X", "line": { "color": "darkorange", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "X", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.00025, 0.0005, 0.000625, 0.00075, 0.000875, 0.001, 0.0011250000000000001, 0.0012500000000000002, 0.0013750000000000004, 0.0015000000000000005, 0.0016250000000000006, 0.0017500000000000007, 0.0018750000000000008, 0.002000000000000001, 0.002125000000000001, 0.002250000000000001, 0.0023750000000000012, 0.0025000000000000014, 0.0026250000000000015, 0.0027500000000000016, 0.0028750000000000017, 0.003000000000000002, 0.003125000000000002, 0.003250000000000002, 0.003375000000000002, 0.0035000000000000022, 0.0036250000000000024, 0.0037500000000000025, 0.0038750000000000026, 0.004000000000000003, 0.004125000000000003, 0.004250000000000003, 0.004375000000000003, 0.004500000000000003, 0.004625000000000003, 0.004812500000000003, 0.005000000000000004, 0.005187500000000004, 0.005375000000000004, 0.005562500000000004, 0.005750000000000004, 0.005937500000000004, 0.006125000000000005, 0.006312500000000005, 0.006593750000000005, 0.006875000000000005, 0.0071562500000000055, 0.007437500000000006, 0.007859375000000005, 0.008281250000000006, 0.008914062500000005, 0.009863281250000005, 0.011287109375000005, 0.013422851562500004, 0.016626464843750004, 0.016626464843750004, 0.016657714843750004, 0.016673339843750003, 0.01668896484375, 0.01670458984375, 0.01672802734375, 0.01675146484375, 0.016774902343750002, 0.016798339843750003, 0.016833496093750004, 0.016851074218750005, 0.016877441406250006, 0.016916992187500007, 0.016936767578125008, 0.016966430664062507, 0.017010925292968757, 0.017033172607421883, 0.01706654357910157, 0.0171166000366211, 0.017141628265380866, 0.017179170608520516, 0.017235484123229988, 0.017263640880584723, 0.017305876016616827, 0.017369228720664983, 0.01740090507268906, 0.017448419600725178, 0.017519691392779355, 0.017555327288806443, 0.017608781132847074, 0.017688961898908024, 0.0177290522819385, 0.01778918785648421, 0.017879391218302777, 0.01792449289921206, 0.017992145420575985, 0.018093624202621873, 0.018144363593644817, 0.018220472680179234, 0.01833463630998086, 0.018448799939782483, 0.018562963569584107, 0.018677127199385732, 0.018848372644088167, 0.018933995366439384, 0.019062429449966212, 0.01925508057525645, 0.01944773170054669, 0.019640382825836928, 0.019833033951127167, 0.020025685076417405, 0.020314661764352766, 0.020603638452288128, 0.02089261514022349, 0.02118159182815885, 0.02147056851609421, 0.021759545204029573, 0.022048521891964934, 0.022337498579900295, 0.022626475267835656, 0.022915451955771018, 0.02320442864370638, 0.02349340533164174, 0.0237823820195771, 0.024071358707512463, 0.024504823739415503, 0.024938288771318543, 0.025371753803221583, 0.025805218835124624, 0.026238683867027664, 0.026672148898930704, 0.027322346446785262, 0.02797254399463982, 0.02862274154249438, 0.02959803786427622, 0.030573334186058062, 0.03203627866873082, 0.034230695392739964, 0.037522320478753673 ], "xaxis": "x", "y": [ 100, 99, 98.209, 97.894742819, 97.61241534379735, 97.3586049645362, 97.13029517304426, 96.92481382649424, 96.73978919779738, 96.57311246295495, 96.42290553992166, 96.2874934006836, 96.16538014166152, 96.05522822725827, 95.9558404249435, 95.86614403344345, 95.78517707276293, 95.71207615927848, 95.64606583361078, 95.58644914543959, 95.53259932944992, 95.48395243144172, 95.44000076428314, 95.40028709062153, 95.36439944371226, 95.33196650988316, 95.30265350642563, 95.27615849741703, 95.25220909739801, 95.23055951916768, 95.2109879273953, 95.19329406442354, 95.17729711867575, 95.16283380957393, 95.14975666591008, 95.13793247725668, 95.12189511183725, 95.10816134943913, 95.0963996878157, 95.08632649318639, 95.0776990446423, 95.07030960078498, 95.06398033531259, 95.0585590120541, 95.05391528984052, 95.04794870150447, 95.04326555134325, 95.03958965420553, 95.0367043007415, 95.03330699898956, 95.03100549280063, 95.02866668916649, 95.02685565121477, 95.02611029522258, 95.02620913837447, 95.02611534596562, 95.02611534596562, 93.83891063972281, 93.26672826585208, 92.70474357826332, 92.15269515623487, 91.33914808924928, 90.54679886482822, 89.7748565696649, 89.02256920966825, 87.92254740363711, 87.39302047093939, 86.61333887279844, 85.47575875077841, 84.92992603771471, 84.12748198024677, 82.95938646509897, 82.40081858631775, 81.5809855020377, 80.39045359867409, 79.82318370406306, 78.99198890716644, 77.78799339259044, 77.21643943142413, 76.38044376122593, 75.17266361554994, 74.60153071113295, 73.76768038441635, 72.56627606167467, 72.00044359046612, 71.17590144510555, 69.9912642710937, 69.43566352965193, 68.62762854660679, 67.47011757879153, 66.92960657647201, 66.14513129022293, 65.02481150501374, 64.50405330443228, 63.74986828839451, 62.676262811503925, 61.682963050732205, 60.76208706149755, 59.90674435321453, 58.71295343762659, 58.176646156381274, 57.41206048653702, 56.348921167034696, 55.39922455305467, 54.54791954576125, 53.78244947574939, 53.09225243336221, 52.15644070113145, 51.35199754168643, 50.657245138702486, 50.05481857013016, 49.53064205250847, 49.07318635873579, 48.67292067209603, 48.321901552304006, 48.01346030234215, 47.74196208358196, 47.50261810579362, 47.291337599986626, 47.10460997474402, 46.93941013102557, 46.719977531280136, 46.53793195522333, 46.38664993877352, 46.26075793756352, 46.15587368325061, 46.06840765284428, 45.95890944057481, 45.87646619103971, 45.814310817103326, 45.74395069564645, 45.69941008149434, 45.65705634926344, 45.62834570480913, 45.62063150861952 ], "yaxis": "y" }, { "hovertemplate": "Chemical=B
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "B", "line": { "color": "green", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "B", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.00025, 0.0005, 0.000625, 0.00075, 0.000875, 0.001, 0.0011250000000000001, 0.0012500000000000002, 0.0013750000000000004, 0.0015000000000000005, 0.0016250000000000006, 0.0017500000000000007, 0.0018750000000000008, 0.002000000000000001, 0.002125000000000001, 0.002250000000000001, 0.0023750000000000012, 0.0025000000000000014, 0.0026250000000000015, 0.0027500000000000016, 0.0028750000000000017, 0.003000000000000002, 0.003125000000000002, 0.003250000000000002, 0.003375000000000002, 0.0035000000000000022, 0.0036250000000000024, 0.0037500000000000025, 0.0038750000000000026, 0.004000000000000003, 0.004125000000000003, 0.004250000000000003, 0.004375000000000003, 0.004500000000000003, 0.004625000000000003, 0.004812500000000003, 0.005000000000000004, 0.005187500000000004, 0.005375000000000004, 0.005562500000000004, 0.005750000000000004, 0.005937500000000004, 0.006125000000000005, 0.006312500000000005, 0.006593750000000005, 0.006875000000000005, 0.0071562500000000055, 0.007437500000000006, 0.007859375000000005, 0.008281250000000006, 0.008914062500000005, 0.009863281250000005, 0.011287109375000005, 0.013422851562500004, 0.016626464843750004, 0.016626464843750004, 0.016657714843750004, 0.016673339843750003, 0.01668896484375, 0.01670458984375, 0.01672802734375, 0.01675146484375, 0.016774902343750002, 0.016798339843750003, 0.016833496093750004, 0.016851074218750005, 0.016877441406250006, 0.016916992187500007, 0.016936767578125008, 0.016966430664062507, 0.017010925292968757, 0.017033172607421883, 0.01706654357910157, 0.0171166000366211, 0.017141628265380866, 0.017179170608520516, 0.017235484123229988, 0.017263640880584723, 0.017305876016616827, 0.017369228720664983, 0.01740090507268906, 0.017448419600725178, 0.017519691392779355, 0.017555327288806443, 0.017608781132847074, 0.017688961898908024, 0.0177290522819385, 0.01778918785648421, 0.017879391218302777, 0.01792449289921206, 0.017992145420575985, 0.018093624202621873, 0.018144363593644817, 0.018220472680179234, 0.01833463630998086, 0.018448799939782483, 0.018562963569584107, 0.018677127199385732, 0.018848372644088167, 0.018933995366439384, 0.019062429449966212, 0.01925508057525645, 0.01944773170054669, 0.019640382825836928, 0.019833033951127167, 0.020025685076417405, 0.020314661764352766, 0.020603638452288128, 0.02089261514022349, 0.02118159182815885, 0.02147056851609421, 0.021759545204029573, 0.022048521891964934, 0.022337498579900295, 0.022626475267835656, 0.022915451955771018, 0.02320442864370638, 0.02349340533164174, 0.0237823820195771, 0.024071358707512463, 0.024504823739415503, 0.024938288771318543, 0.025371753803221583, 0.025805218835124624, 0.026238683867027664, 0.026672148898930704, 0.027322346446785262, 0.02797254399463982, 0.02862274154249438, 0.02959803786427622, 0.030573334186058062, 0.03203627866873082, 0.034230695392739964, 0.037522320478753673 ], "xaxis": "x", "y": [ 0, 2, 3.582, 4.210514362, 4.775169312405303, 5.2827900709276125, 5.739409653911495, 6.150372347011539, 6.520421604405263, 6.853775074090105, 7.154188920156709, 7.425013198632822, 7.669239716676995, 7.8895435454835, 8.088319150113032, 8.26771193311315, 8.429645854474183, 8.575847681443083, 8.707868332778494, 8.827101709120866, 8.934801341100197, 9.03209513711659, 9.119998471433753, 9.19942581875697, 9.271201112575515, 9.336066980233708, 9.394692987148757, 9.447683005165954, 9.495581805203997, 9.538880961664637, 9.578024145209422, 9.613411871152936, 9.645405762648513, 9.674332380852162, 9.700486668179861, 9.724135045486653, 9.756209776325537, 9.783677301121774, 9.807200624368617, 9.827347013627246, 9.844601910715422, 9.859380798430053, 9.872039329374836, 9.882881975891811, 9.892169420318988, 9.9041025969911, 9.91346889731353, 9.920820691588984, 9.926591398517042, 9.933386002020946, 9.937989014398797, 9.94266662166709, 9.946288697570516, 9.947779409554903, 9.947581723251117, 9.947769308068802, 9.947769308068802, 12.322178720554433, 13.466543468295889, 14.590512843473421, 15.69460968753033, 17.321703821501515, 18.906402270343637, 20.450286860670275, 21.954861580663582, 24.154905192725863, 25.2139590581213, 26.773322254403197, 29.048482498443256, 30.14014792457066, 31.745036039506548, 34.08122706980214, 35.19836282736458, 36.83802899592469, 39.21909280265193, 40.353632591873975, 42.01602218566721, 44.42401321481924, 45.56712113715185, 47.23911247754825, 49.654672768900234, 50.79693857773421, 52.464639231167396, 54.867447876650765, 55.99911281906788, 57.64819710978901, 60.01747145781272, 61.12867294069624, 62.74474290678655, 65.05976484241707, 66.1407868470561, 67.70973741955427, 69.95037698997265, 70.99189339113558, 72.50026342321111, 74.64747437699228, 76.63407389853572, 78.47582587700502, 80.18651129357107, 82.57409312474695, 83.64670768723758, 85.17587902692608, 87.30215766593074, 89.20155089389078, 90.90416090847762, 92.43510104850135, 93.8154951332757, 95.68711859773722, 97.29600491662727, 98.68550972259516, 99.89036285973981, 100.93871589498319, 101.85362728252855, 102.65415865580806, 103.35619689539212, 103.97307939531582, 104.51607583283621, 104.99476378841288, 105.41732480002688, 105.79078005051208, 106.12117973794899, 106.56004493743986, 106.92413608955347, 107.22670012245308, 107.47848412487309, 107.6882526334989, 107.86318469431157, 108.08218111885051, 108.2470676179207, 108.37137836579348, 108.51209860870723, 108.60117983701144, 108.68588730147324, 108.74330859038187, 108.75873698276109 ], "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": "Reaction `A + X <-> 2 B` . Changes in concentrations with time" }, "xaxis": { "anchor": "y", "autorange": true, "domain": [ 0, 1 ], "range": [ 0, 0.037522320478753673 ], "title": { "text": "SYSTEM TIME" }, "type": "linear" }, "yaxis": { "anchor": "x", "autorange": true, "domain": [ 0, 1 ], "range": [ -6.042152054597839, 114.80088903735893 ], "title": { "text": "concentration" }, "type": "linear" } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "dynamics.plot_curves(colors=['red', 'darkorange', 'green'])" ] }, { "cell_type": "markdown", "id": "44beb909-5071-47e5-9499-482cf37f9ce3", "metadata": {}, "source": [ "**A**, still the limiting reagent, is again stopping the reaction. \n", "The (transiently) high value of [A] led to a high value of [B]" ] }, { "cell_type": "code", "execution_count": 15, "id": "35850ec7-e78e-4b57-976c-bc0ad6c824d5", "metadata": {}, "outputs": [], "source": [ "#dynamics.get_history()\n", "\n", "#dynamics.explain_time_advance()" ] }, { "cell_type": "code", "execution_count": 16, "id": "aff608b1-5c78-4070-845a-118afe7c2108", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0: A + X <-> 2 B\n", "Final concentrations: [B] = 108.8 ; [A] = 0.5945 ; [X] = 45.62\n", "1. Ratio of reactant/product concentrations, adjusted for reaction orders: 4.00995\n", " Formula used: [B] / ([A][X])\n", "2. Ratio of forward/reverse reaction rates: 4.0\n", "Discrepancy between the two values: 0.2488 %\n", "Reaction IS in equilibrium (within 1% tolerance)\n", "\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 16, "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": "7ddbe0ec-53c3-4d25-825a-cbe3bdf8e50a", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "f6619731-c5ea-484c-af3e-cea50d685361", "metadata": { "tags": [] }, "source": [ "# Let's again suddenly increase [A]" ] }, { "cell_type": "code", "execution_count": 17, "id": "d3618eba-a673-4ff5-85d0-08f5ea592361", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SYSTEM STATE at Time t = 0.03752232:\n", "3 species:\n", " Species 0 (A). Conc: 30.0\n", " Species 1 (X). Conc: 45.62063150861952\n", " Species 2 (B). Conc: 108.75873698276109\n", "Set of chemicals involved in reactions: {'X', 'B', 'A'}\n" ] } ], "source": [ "dynamics.set_single_conc(species_name=\"A\", conc=30., snapshot=True)\n", "dynamics.describe_state()" ] }, { "cell_type": "code", "execution_count": 18, "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SYSTEM TIMEAXBcaption
1310.0305730.67329545.699410108.601180
1320.0320360.63094145.657056108.685887
1330.0342310.60223045.628346108.743309
1340.0375220.59451645.620632108.758737
1350.03752230.00000045.620632108.758737Set concentration of `A`
\n", "
" ], "text/plain": [ " SYSTEM TIME A X B caption\n", "131 0.030573 0.673295 45.699410 108.601180 \n", "132 0.032036 0.630941 45.657056 108.685887 \n", "133 0.034231 0.602230 45.628346 108.743309 \n", "134 0.037522 0.594516 45.620632 108.758737 \n", "135 0.037522 30.000000 45.620632 108.758737 Set concentration of `A`" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.get_history(tail=5)" ] }, { "cell_type": "markdown", "id": "0974480d-ca45-46fe-addd-c8d394780fdb", "metadata": {}, "source": [ "### Yet again, take the system to equilibrium" ] }, { "cell_type": "code", "execution_count": 19, "id": "8fe20f9c-05c4-45a4-b485-a51005440200", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "* INFO: the tentative time step (0.0005) 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.00025) [Step started at t=0.037522, and will rewind there]\n", "* INFO: the tentative time step (0.00025) 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.000125) [Step started at t=0.037522, and will rewind there]\n", "41 total step(s) taken\n" ] } ], "source": [ "dynamics.single_compartment_react(initial_step=0.0005, target_end_time=0.070,\n", " variable_steps=True, explain_variable_steps=False)" ] }, { "cell_type": "code", "execution_count": 20, "id": "c388dae7-c4a6-4644-a390-958e3862d102", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "Chemical=A
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "A", "line": { "color": "red", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "A", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.00025, 0.0005, 0.000625, 0.00075, 0.000875, 0.001, 0.0011250000000000001, 0.0012500000000000002, 0.0013750000000000004, 0.0015000000000000005, 0.0016250000000000006, 0.0017500000000000007, 0.0018750000000000008, 0.002000000000000001, 0.002125000000000001, 0.002250000000000001, 0.0023750000000000012, 0.0025000000000000014, 0.0026250000000000015, 0.0027500000000000016, 0.0028750000000000017, 0.003000000000000002, 0.003125000000000002, 0.003250000000000002, 0.003375000000000002, 0.0035000000000000022, 0.0036250000000000024, 0.0037500000000000025, 0.0038750000000000026, 0.004000000000000003, 0.004125000000000003, 0.004250000000000003, 0.004375000000000003, 0.004500000000000003, 0.004625000000000003, 0.004812500000000003, 0.005000000000000004, 0.005187500000000004, 0.005375000000000004, 0.005562500000000004, 0.005750000000000004, 0.005937500000000004, 0.006125000000000005, 0.006312500000000005, 0.006593750000000005, 0.006875000000000005, 0.0071562500000000055, 0.007437500000000006, 0.007859375000000005, 0.008281250000000006, 0.008914062500000005, 0.009863281250000005, 0.011287109375000005, 0.013422851562500004, 0.016626464843750004, 0.016626464843750004, 0.016657714843750004, 0.016673339843750003, 0.01668896484375, 0.01670458984375, 0.01672802734375, 0.01675146484375, 0.016774902343750002, 0.016798339843750003, 0.016833496093750004, 0.016851074218750005, 0.016877441406250006, 0.016916992187500007, 0.016936767578125008, 0.016966430664062507, 0.017010925292968757, 0.017033172607421883, 0.01706654357910157, 0.0171166000366211, 0.017141628265380866, 0.017179170608520516, 0.017235484123229988, 0.017263640880584723, 0.017305876016616827, 0.017369228720664983, 0.01740090507268906, 0.017448419600725178, 0.017519691392779355, 0.017555327288806443, 0.017608781132847074, 0.017688961898908024, 0.0177290522819385, 0.01778918785648421, 0.017879391218302777, 0.01792449289921206, 0.017992145420575985, 0.018093624202621873, 0.018144363593644817, 0.018220472680179234, 0.01833463630998086, 0.018448799939782483, 0.018562963569584107, 0.018677127199385732, 0.018848372644088167, 0.018933995366439384, 0.019062429449966212, 0.01925508057525645, 0.01944773170054669, 0.019640382825836928, 0.019833033951127167, 0.020025685076417405, 0.020314661764352766, 0.020603638452288128, 0.02089261514022349, 0.02118159182815885, 0.02147056851609421, 0.021759545204029573, 0.022048521891964934, 0.022337498579900295, 0.022626475267835656, 0.022915451955771018, 0.02320442864370638, 0.02349340533164174, 0.0237823820195771, 0.024071358707512463, 0.024504823739415503, 0.024938288771318543, 0.025371753803221583, 0.025805218835124624, 0.026238683867027664, 0.026672148898930704, 0.027322346446785262, 0.02797254399463982, 0.02862274154249438, 0.02959803786427622, 0.030573334186058062, 0.03203627866873082, 0.034230695392739964, 0.037522320478753673, 0.037522320478753673, 0.037647320478753674, 0.037709820478753674, 0.03780357047875367, 0.03789732047875367, 0.038037945478753665, 0.03810825797875367, 0.038213726728753665, 0.038371929853753664, 0.03845103141625367, 0.038569683760003665, 0.03874766227562867, 0.03892564079125367, 0.039103619306878674, 0.03928159782250368, 0.03954856559594118, 0.03968204948265993, 0.03988227531273805, 0.04018261405785524, 0.04048295280297243, 0.040783291548089615, 0.041233799665765396, 0.04145905372460329, 0.04179693481286013, 0.04230375644524538, 0.04281057807763063, 0.043317399710015886, 0.04407763215859377, 0.04483786460717165, 0.045598097055749534, 0.04635832950432742, 0.0471185619529053, 0.048258910625772124, 0.04939925929863895, 0.05053960797150577, 0.051679956644372596, 0.05339047965367283, 0.05510100266297306, 0.05766678717692341, 0.06151546394784893, 0.06728847910423721, 0.07594800183881964 ], "xaxis": "x", "y": [ 5, 4, 3.209, 2.894742819, 2.6124153437973483, 2.3586049645361937, 2.1302951730442525, 1.9248138264942307, 1.7397891977973683, 1.573112462954947, 1.4229055399216455, 1.2874934006835885, 1.165380141661502, 1.0552282272582496, 0.9558404249434842, 0.8661440334434253, 0.7851770727629085, 0.7120761592784581, 0.6460658336107526, 0.5864491454395666, 0.5325993294499012, 0.48395243144170513, 0.44000076428312396, 0.4002870906215159, 0.36439944371224287, 0.33196650988314585, 0.30265350642562144, 0.27615849741702286, 0.25220909739800157, 0.2305595191676821, 0.21098792739528963, 0.19329406442353292, 0.17729711867574416, 0.16283380957391988, 0.14975666591007017, 0.13793247725667396, 0.12189511183723217, 0.10816134943911394, 0.09639968781569214, 0.08632649318637779, 0.07769904464229038, 0.0703096007849748, 0.06398033531258333, 0.05855901205409571, 0.05391528984050737, 0.04794870150445153, 0.04326555134323659, 0.0395896542055093, 0.036704300741480234, 0.033306998989528276, 0.031005492800602743, 0.028666689166455803, 0.02685565121474256, 0.02611029522254958, 0.02620913837444258, 0.026115345965600032, 50, 48.81279529375718, 48.24061291988646, 47.67862823229769, 47.126579810269234, 46.31303274328364, 45.52068351886258, 44.74874122369926, 43.99645386370261, 42.896432057671475, 42.366905124973755, 41.58722352683281, 40.449643404812775, 39.90381069174907, 39.10136663428113, 37.93327111913333, 37.374703240352105, 36.554870156072056, 35.364338252708436, 34.79706835809741, 33.965873561200794, 32.76187804662478, 32.19032408545847, 31.354328415260273, 30.14654826958428, 29.57541536516729, 28.741565038450698, 27.540160715709014, 26.974328244500455, 26.14978609913989, 24.965148925128037, 24.409548183686276, 23.601513200641122, 22.444002232825866, 21.903491230506347, 21.119015944257264, 19.998696159048073, 19.47793795846661, 18.723752942428842, 17.650147465538254, 16.65684770476653, 15.735971715531882, 14.880629007248855, 13.686838091660919, 13.150530810415605, 12.385945140571353, 11.322805821069025, 10.373109207089003, 9.52180419979558, 8.756334129783715, 8.06613708739654, 7.130325355165776, 6.325882195720753, 5.63112979273681, 5.0287032241644845, 4.504526706542796, 4.047071012770113, 3.6468053261303544, 3.295786206338327, 2.9873449563764725, 2.715846737616279, 2.4765027598279437, 2.2652222540209475, 2.0784946287783455, 1.9132947850598905, 1.6938621853144613, 1.5118166092576515, 1.3605345928078456, 1.2346425915978416, 1.1297583372849325, 1.0422923068785968, 0.9327940946091285, 0.8503508450740351, 0.788195471137651, 0.7178353496807718, 0.6732947355286701, 0.6309410032977733, 0.6022303588434575, 0.5945161626538438, 30, 28.658570738987105, 28.03801161348573, 27.141063465149976, 26.292079421664464, 25.085034656640353, 24.52734072438796, 23.721730772117457, 22.57894719906507, 22.052696489207914, 21.293667828685134, 20.219392387515605, 19.2332724952743, 18.325181136612514, 17.486495010835938, 16.321487872197157, 15.801099366020592, 15.060730309318746, 14.033753453648, 13.118346139264787, 12.298115391280126, 11.190559765073914, 10.715836234270006, 10.05254725116026, 9.156821383293957, 8.389406514344161, 7.7267474134216, 6.8626794420323005, 6.159997129119546, 5.581862099503201, 5.101695378662598, 4.699805107165207, 4.192009575604722, 3.80008449327181, 3.4943732551230022, 3.253965278155637, 2.968587353275382, 2.7704632279693504, 2.5621749130878735, 2.387323872167239, 2.295195812041052, 2.289775262831825 ], "yaxis": "y" }, { "hovertemplate": "Chemical=X
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "X", "line": { "color": "darkorange", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "X", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.00025, 0.0005, 0.000625, 0.00075, 0.000875, 0.001, 0.0011250000000000001, 0.0012500000000000002, 0.0013750000000000004, 0.0015000000000000005, 0.0016250000000000006, 0.0017500000000000007, 0.0018750000000000008, 0.002000000000000001, 0.002125000000000001, 0.002250000000000001, 0.0023750000000000012, 0.0025000000000000014, 0.0026250000000000015, 0.0027500000000000016, 0.0028750000000000017, 0.003000000000000002, 0.003125000000000002, 0.003250000000000002, 0.003375000000000002, 0.0035000000000000022, 0.0036250000000000024, 0.0037500000000000025, 0.0038750000000000026, 0.004000000000000003, 0.004125000000000003, 0.004250000000000003, 0.004375000000000003, 0.004500000000000003, 0.004625000000000003, 0.004812500000000003, 0.005000000000000004, 0.005187500000000004, 0.005375000000000004, 0.005562500000000004, 0.005750000000000004, 0.005937500000000004, 0.006125000000000005, 0.006312500000000005, 0.006593750000000005, 0.006875000000000005, 0.0071562500000000055, 0.007437500000000006, 0.007859375000000005, 0.008281250000000006, 0.008914062500000005, 0.009863281250000005, 0.011287109375000005, 0.013422851562500004, 0.016626464843750004, 0.016626464843750004, 0.016657714843750004, 0.016673339843750003, 0.01668896484375, 0.01670458984375, 0.01672802734375, 0.01675146484375, 0.016774902343750002, 0.016798339843750003, 0.016833496093750004, 0.016851074218750005, 0.016877441406250006, 0.016916992187500007, 0.016936767578125008, 0.016966430664062507, 0.017010925292968757, 0.017033172607421883, 0.01706654357910157, 0.0171166000366211, 0.017141628265380866, 0.017179170608520516, 0.017235484123229988, 0.017263640880584723, 0.017305876016616827, 0.017369228720664983, 0.01740090507268906, 0.017448419600725178, 0.017519691392779355, 0.017555327288806443, 0.017608781132847074, 0.017688961898908024, 0.0177290522819385, 0.01778918785648421, 0.017879391218302777, 0.01792449289921206, 0.017992145420575985, 0.018093624202621873, 0.018144363593644817, 0.018220472680179234, 0.01833463630998086, 0.018448799939782483, 0.018562963569584107, 0.018677127199385732, 0.018848372644088167, 0.018933995366439384, 0.019062429449966212, 0.01925508057525645, 0.01944773170054669, 0.019640382825836928, 0.019833033951127167, 0.020025685076417405, 0.020314661764352766, 0.020603638452288128, 0.02089261514022349, 0.02118159182815885, 0.02147056851609421, 0.021759545204029573, 0.022048521891964934, 0.022337498579900295, 0.022626475267835656, 0.022915451955771018, 0.02320442864370638, 0.02349340533164174, 0.0237823820195771, 0.024071358707512463, 0.024504823739415503, 0.024938288771318543, 0.025371753803221583, 0.025805218835124624, 0.026238683867027664, 0.026672148898930704, 0.027322346446785262, 0.02797254399463982, 0.02862274154249438, 0.02959803786427622, 0.030573334186058062, 0.03203627866873082, 0.034230695392739964, 0.037522320478753673, 0.037522320478753673, 0.037647320478753674, 0.037709820478753674, 0.03780357047875367, 0.03789732047875367, 0.038037945478753665, 0.03810825797875367, 0.038213726728753665, 0.038371929853753664, 0.03845103141625367, 0.038569683760003665, 0.03874766227562867, 0.03892564079125367, 0.039103619306878674, 0.03928159782250368, 0.03954856559594118, 0.03968204948265993, 0.03988227531273805, 0.04018261405785524, 0.04048295280297243, 0.040783291548089615, 0.041233799665765396, 0.04145905372460329, 0.04179693481286013, 0.04230375644524538, 0.04281057807763063, 0.043317399710015886, 0.04407763215859377, 0.04483786460717165, 0.045598097055749534, 0.04635832950432742, 0.0471185619529053, 0.048258910625772124, 0.04939925929863895, 0.05053960797150577, 0.051679956644372596, 0.05339047965367283, 0.05510100266297306, 0.05766678717692341, 0.06151546394784893, 0.06728847910423721, 0.07594800183881964 ], "xaxis": "x", "y": [ 100, 99, 98.209, 97.894742819, 97.61241534379735, 97.3586049645362, 97.13029517304426, 96.92481382649424, 96.73978919779738, 96.57311246295495, 96.42290553992166, 96.2874934006836, 96.16538014166152, 96.05522822725827, 95.9558404249435, 95.86614403344345, 95.78517707276293, 95.71207615927848, 95.64606583361078, 95.58644914543959, 95.53259932944992, 95.48395243144172, 95.44000076428314, 95.40028709062153, 95.36439944371226, 95.33196650988316, 95.30265350642563, 95.27615849741703, 95.25220909739801, 95.23055951916768, 95.2109879273953, 95.19329406442354, 95.17729711867575, 95.16283380957393, 95.14975666591008, 95.13793247725668, 95.12189511183725, 95.10816134943913, 95.0963996878157, 95.08632649318639, 95.0776990446423, 95.07030960078498, 95.06398033531259, 95.0585590120541, 95.05391528984052, 95.04794870150447, 95.04326555134325, 95.03958965420553, 95.0367043007415, 95.03330699898956, 95.03100549280063, 95.02866668916649, 95.02685565121477, 95.02611029522258, 95.02620913837447, 95.02611534596562, 95.02611534596562, 93.83891063972281, 93.26672826585208, 92.70474357826332, 92.15269515623487, 91.33914808924928, 90.54679886482822, 89.7748565696649, 89.02256920966825, 87.92254740363711, 87.39302047093939, 86.61333887279844, 85.47575875077841, 84.92992603771471, 84.12748198024677, 82.95938646509897, 82.40081858631775, 81.5809855020377, 80.39045359867409, 79.82318370406306, 78.99198890716644, 77.78799339259044, 77.21643943142413, 76.38044376122593, 75.17266361554994, 74.60153071113295, 73.76768038441635, 72.56627606167467, 72.00044359046612, 71.17590144510555, 69.9912642710937, 69.43566352965193, 68.62762854660679, 67.47011757879153, 66.92960657647201, 66.14513129022293, 65.02481150501374, 64.50405330443228, 63.74986828839451, 62.676262811503925, 61.682963050732205, 60.76208706149755, 59.90674435321453, 58.71295343762659, 58.176646156381274, 57.41206048653702, 56.348921167034696, 55.39922455305467, 54.54791954576125, 53.78244947574939, 53.09225243336221, 52.15644070113145, 51.35199754168643, 50.657245138702486, 50.05481857013016, 49.53064205250847, 49.07318635873579, 48.67292067209603, 48.321901552304006, 48.01346030234215, 47.74196208358196, 47.50261810579362, 47.291337599986626, 47.10460997474402, 46.93941013102557, 46.719977531280136, 46.53793195522333, 46.38664993877352, 46.26075793756352, 46.15587368325061, 46.06840765284428, 45.95890944057481, 45.87646619103971, 45.814310817103326, 45.74395069564645, 45.69941008149434, 45.65705634926344, 45.62834570480913, 45.62063150861952, 45.62063150861952, 44.27920224760662, 43.65864312210524, 42.76169497376949, 41.91271093028398, 40.70566616525986, 40.14797223300747, 39.34236228073697, 38.19957870768459, 37.673327997827435, 36.914299337304655, 35.84002389613513, 34.853904003893824, 33.94581264523204, 33.10712651945546, 31.94211938081668, 31.42173087464012, 30.681361817938274, 29.654384962267528, 28.738977647884315, 27.918746899899652, 26.81119127369344, 26.33646774288953, 25.673178759779784, 24.777452891913484, 24.010038022963688, 23.347378922041127, 22.483310950651827, 21.780628637739074, 21.20249360812273, 20.722326887282126, 20.320436615784736, 19.81264108422425, 19.42071600189134, 19.11500476374253, 18.874596786775165, 18.58921886189491, 18.39109473658888, 18.1828064217074, 18.007955380786765, 17.915827320660576, 17.91040677145135 ], "yaxis": "y" }, { "hovertemplate": "Chemical=B
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "B", "line": { "color": "green", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "B", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 0.00025, 0.0005, 0.000625, 0.00075, 0.000875, 0.001, 0.0011250000000000001, 0.0012500000000000002, 0.0013750000000000004, 0.0015000000000000005, 0.0016250000000000006, 0.0017500000000000007, 0.0018750000000000008, 0.002000000000000001, 0.002125000000000001, 0.002250000000000001, 0.0023750000000000012, 0.0025000000000000014, 0.0026250000000000015, 0.0027500000000000016, 0.0028750000000000017, 0.003000000000000002, 0.003125000000000002, 0.003250000000000002, 0.003375000000000002, 0.0035000000000000022, 0.0036250000000000024, 0.0037500000000000025, 0.0038750000000000026, 0.004000000000000003, 0.004125000000000003, 0.004250000000000003, 0.004375000000000003, 0.004500000000000003, 0.004625000000000003, 0.004812500000000003, 0.005000000000000004, 0.005187500000000004, 0.005375000000000004, 0.005562500000000004, 0.005750000000000004, 0.005937500000000004, 0.006125000000000005, 0.006312500000000005, 0.006593750000000005, 0.006875000000000005, 0.0071562500000000055, 0.007437500000000006, 0.007859375000000005, 0.008281250000000006, 0.008914062500000005, 0.009863281250000005, 0.011287109375000005, 0.013422851562500004, 0.016626464843750004, 0.016626464843750004, 0.016657714843750004, 0.016673339843750003, 0.01668896484375, 0.01670458984375, 0.01672802734375, 0.01675146484375, 0.016774902343750002, 0.016798339843750003, 0.016833496093750004, 0.016851074218750005, 0.016877441406250006, 0.016916992187500007, 0.016936767578125008, 0.016966430664062507, 0.017010925292968757, 0.017033172607421883, 0.01706654357910157, 0.0171166000366211, 0.017141628265380866, 0.017179170608520516, 0.017235484123229988, 0.017263640880584723, 0.017305876016616827, 0.017369228720664983, 0.01740090507268906, 0.017448419600725178, 0.017519691392779355, 0.017555327288806443, 0.017608781132847074, 0.017688961898908024, 0.0177290522819385, 0.01778918785648421, 0.017879391218302777, 0.01792449289921206, 0.017992145420575985, 0.018093624202621873, 0.018144363593644817, 0.018220472680179234, 0.01833463630998086, 0.018448799939782483, 0.018562963569584107, 0.018677127199385732, 0.018848372644088167, 0.018933995366439384, 0.019062429449966212, 0.01925508057525645, 0.01944773170054669, 0.019640382825836928, 0.019833033951127167, 0.020025685076417405, 0.020314661764352766, 0.020603638452288128, 0.02089261514022349, 0.02118159182815885, 0.02147056851609421, 0.021759545204029573, 0.022048521891964934, 0.022337498579900295, 0.022626475267835656, 0.022915451955771018, 0.02320442864370638, 0.02349340533164174, 0.0237823820195771, 0.024071358707512463, 0.024504823739415503, 0.024938288771318543, 0.025371753803221583, 0.025805218835124624, 0.026238683867027664, 0.026672148898930704, 0.027322346446785262, 0.02797254399463982, 0.02862274154249438, 0.02959803786427622, 0.030573334186058062, 0.03203627866873082, 0.034230695392739964, 0.037522320478753673, 0.037522320478753673, 0.037647320478753674, 0.037709820478753674, 0.03780357047875367, 0.03789732047875367, 0.038037945478753665, 0.03810825797875367, 0.038213726728753665, 0.038371929853753664, 0.03845103141625367, 0.038569683760003665, 0.03874766227562867, 0.03892564079125367, 0.039103619306878674, 0.03928159782250368, 0.03954856559594118, 0.03968204948265993, 0.03988227531273805, 0.04018261405785524, 0.04048295280297243, 0.040783291548089615, 0.041233799665765396, 0.04145905372460329, 0.04179693481286013, 0.04230375644524538, 0.04281057807763063, 0.043317399710015886, 0.04407763215859377, 0.04483786460717165, 0.045598097055749534, 0.04635832950432742, 0.0471185619529053, 0.048258910625772124, 0.04939925929863895, 0.05053960797150577, 0.051679956644372596, 0.05339047965367283, 0.05510100266297306, 0.05766678717692341, 0.06151546394784893, 0.06728847910423721, 0.07594800183881964 ], "xaxis": "x", "y": [ 0, 2, 3.582, 4.210514362, 4.775169312405303, 5.2827900709276125, 5.739409653911495, 6.150372347011539, 6.520421604405263, 6.853775074090105, 7.154188920156709, 7.425013198632822, 7.669239716676995, 7.8895435454835, 8.088319150113032, 8.26771193311315, 8.429645854474183, 8.575847681443083, 8.707868332778494, 8.827101709120866, 8.934801341100197, 9.03209513711659, 9.119998471433753, 9.19942581875697, 9.271201112575515, 9.336066980233708, 9.394692987148757, 9.447683005165954, 9.495581805203997, 9.538880961664637, 9.578024145209422, 9.613411871152936, 9.645405762648513, 9.674332380852162, 9.700486668179861, 9.724135045486653, 9.756209776325537, 9.783677301121774, 9.807200624368617, 9.827347013627246, 9.844601910715422, 9.859380798430053, 9.872039329374836, 9.882881975891811, 9.892169420318988, 9.9041025969911, 9.91346889731353, 9.920820691588984, 9.926591398517042, 9.933386002020946, 9.937989014398797, 9.94266662166709, 9.946288697570516, 9.947779409554903, 9.947581723251117, 9.947769308068802, 9.947769308068802, 12.322178720554433, 13.466543468295889, 14.590512843473421, 15.69460968753033, 17.321703821501515, 18.906402270343637, 20.450286860670275, 21.954861580663582, 24.154905192725863, 25.2139590581213, 26.773322254403197, 29.048482498443256, 30.14014792457066, 31.745036039506548, 34.08122706980214, 35.19836282736458, 36.83802899592469, 39.21909280265193, 40.353632591873975, 42.01602218566721, 44.42401321481924, 45.56712113715185, 47.23911247754825, 49.654672768900234, 50.79693857773421, 52.464639231167396, 54.867447876650765, 55.99911281906788, 57.64819710978901, 60.01747145781272, 61.12867294069624, 62.74474290678655, 65.05976484241707, 66.1407868470561, 67.70973741955427, 69.95037698997265, 70.99189339113558, 72.50026342321111, 74.64747437699228, 76.63407389853572, 78.47582587700502, 80.18651129357107, 82.57409312474695, 83.64670768723758, 85.17587902692608, 87.30215766593074, 89.20155089389078, 90.90416090847762, 92.43510104850135, 93.8154951332757, 95.68711859773722, 97.29600491662727, 98.68550972259516, 99.89036285973981, 100.93871589498319, 101.85362728252855, 102.65415865580806, 103.35619689539212, 103.97307939531582, 104.51607583283621, 104.99476378841288, 105.41732480002688, 105.79078005051208, 106.12117973794899, 106.56004493743986, 106.92413608955347, 107.22670012245308, 107.47848412487309, 107.6882526334989, 107.86318469431157, 108.08218111885051, 108.2470676179207, 108.37137836579348, 108.51209860870723, 108.60117983701144, 108.68588730147324, 108.74330859038187, 108.75873698276109, 108.75873698276109, 111.44159550478689, 112.68271375578965, 114.47661005246115, 116.17457813943217, 118.5886676694804, 119.70405553398518, 121.31527543852619, 123.60084258463095, 124.65334400434526, 126.17140132539082, 128.31995220772987, 130.29219199221248, 132.10837470953606, 133.78574696108922, 136.1157612383668, 137.1565382507199, 138.6372763641236, 140.6912300754651, 142.52204470423155, 144.16250620020088, 146.3776174526133, 147.32706451422112, 148.65364248044062, 150.44509421617323, 151.97992395407283, 153.30524215591797, 155.03337809869657, 156.4387427245221, 157.59501278375478, 158.55534622543598, 159.35912676843077, 160.37471783155175, 161.15856799621758, 161.7699904725152, 162.2508064264499, 162.82156227621041, 163.2178105268225, 163.63438715658543, 163.9840892384267, 164.16834535867906, 164.17918645709753 ], "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": "Reaction `A + X <-> 2 B` . Changes in concentrations with time" }, "xaxis": { "anchor": "y", "autorange": true, "domain": [ 0, 1 ], "range": [ 0, 0.07594800183881964 ], "title": { "text": "SYSTEM TIME" }, "type": "linear" }, "yaxis": { "anchor": "x", "autorange": true, "domain": [ 0, 1 ], "range": [ -9.121065914283196, 173.30025237138074 ], "title": { "text": "concentration" }, "type": "linear" } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "dynamics.plot_curves(colors=['red', 'darkorange', 'green'])" ] }, { "cell_type": "markdown", "id": "4cba88b2-96af-415b-85e9-efa48f862f3c", "metadata": {}, "source": [ "`A`, again the scarce limiting reagent, stops the reaction yet again. \n", "And, again, the (transiently) high value of [A] up-regulated [B]\n", "\n", "Notes: \n", "`A` can up-regulate `B`, but it cannot bring it down. \n", "`X` will soon need to be replenished, if `A` is to continue being the limiting reagent.**" ] }, { "cell_type": "code", "execution_count": 21, "id": "9556b84d-b977-4a4b-9250-bc97634d8356", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Min abs distance found at data row: 2\n" ] }, { "data": { "text/plain": [ "(0.0004607037505267594, 3.333333333333333)" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Look up the some of the intersections of the [A] and [B] curves\n", "dynamics.curve_intersection(\"A\", \"B\", t_start=0, t_end=0.01)" ] }, { "cell_type": "code", "execution_count": 22, "id": "f044d268-7262-4154-bb29-f02b0f702242", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Min abs distance found at data row: 73\n" ] }, { "data": { "text/plain": [ "(0.017062701624030972, 36.64925643602293)" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.curve_intersection(\"A\", \"B\", t_start=0.0151, t_end=0.02)" ] }, { "cell_type": "markdown", "id": "af3637e5-8495-4db0-b43c-194c7bdc4f67", "metadata": {}, "source": [ "Note: the _curve_intersection()_ function currently cannot location the intersection at t=0.015 (the vertical rise in the red line); this issue will get addressed in future versions..." ] }, { "cell_type": "code", "execution_count": 23, "id": "6de58fe9-ff1e-40dd-9ac7-83eee458f818", "metadata": {}, "outputs": [], "source": [ "#dynamics.get_history()\n", "\n", "#dynamics.explain_time_advance()" ] }, { "cell_type": "code", "execution_count": 24, "id": "c3afbcc8-bdae-4938-a3f1-ce00d62816f2", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0: A + X <-> 2 B\n", "Final concentrations: [B] = 164.2 ; [A] = 2.29 ; [X] = 17.91\n", "1. Ratio of reactant/product concentrations, adjusted for reaction orders: 4.00332\n", " Formula used: [B] / ([A][X])\n", "2. Ratio of forward/reverse reaction rates: 4.0\n", "Discrepancy between the two values: 0.08288 %\n", "Reaction IS in equilibrium (within 1% tolerance)\n", "\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 24, "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": "3e5baa56", "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 }