{ "cells": [ { "cell_type": "markdown", "id": "3bbe8002-bdf3-490c-bde0-80dd3713a3d0", "metadata": {}, "source": [ "## Association/Dissociation reaction `2A <-> C`\n", "#### with 2nd-order kinetics for `A`, \n", "#### and 1-st order kinetics for `C`\n", "\n", "Taken to equilibrium. (Adaptive variable time teps are used)\n", "\n", "_See also the experiment \"1D/reactions/reaction_7\"_ \n", "\n", "LAST REVISED: May 5, 2024" ] }, { "cell_type": "code", "execution_count": 1, "id": "e6cefd48-5909-4cc0-a48f-ef016a2ee1cf", "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": "b708df90", "metadata": { "tags": [] }, "outputs": [], "source": [ "from experiments.get_notebook_info import get_notebook_basename\n", "\n", "from src.modules.reactions.reaction_dynamics import ReactionDynamics\n", "from src.modules.visualization.graphic_log import GraphicLog" ] }, { "cell_type": "code", "execution_count": 3, "id": "83c3cc5f-de21-4f66-9988-2806fbf0666d", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-> Output will be LOGGED into the file 'react_4.log.htm'\n" ] } ], "source": [ "# Initialize the HTML logging (for the graphics)\n", "log_file = get_notebook_basename() + \".log.htm\" # Use the notebook base filename for the log file\n", "\n", "# Set up the use of some specified graphic (Vue) components\n", "GraphicLog.config(filename=log_file,\n", " components=[\"vue_cytoscape_2\"],\n", " extra_js=\"https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.21.2/cytoscape.umd.js\")" ] }, { "cell_type": "code", "execution_count": null, "id": "429c1b46-8a5e-45a1-a88e-5af3f278f5d8", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "475aa75c-9a1d-42dc-adfe-88614e8ad7fc", "metadata": {}, "source": [ "# PART 1 - The Simulation" ] }, { "cell_type": "markdown", "id": "9329208b-070f-4902-8f37-0f11ddf75ed6", "metadata": {}, "source": [ "# Initialize the System\n", "Specify the chemicals, the reactions, and the initial state" ] }, { "cell_type": "code", "execution_count": 4, "id": "72b4245c-de4e-480d-a501-3495b7ed8bc4", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of reactions: 1 (at temp. 25 C)\n", "0: 2 A <-> C (kF = 3 / kR = 2 / delta_G = -1,005.1 / K = 1.5) | 2-th order in reactant A\n", "Set of chemicals involved in the above reactions: {'C', 'A'}\n" ] } ], "source": [ "# Instantiate the simulator and specify the chemicals\n", "dynamics = ReactionDynamics(names=[\"A\", \"C\"])\n", "\n", "# Reaction 2A <-> C , with 2nd-order kinetics for A, and 1st-order kinetics for C\n", "dynamics.add_reaction(reactants=[(2, \"A\")], products=\"C\",\n", " forward_rate=3., reverse_rate=2.) \n", "# Note: the reaction order for a chemical defaults to its stoichiometry coefficient; \n", "# to specify it explicitly, pass it as 3rd term in tuple: (2, \"A\", 2)\n", "\n", "dynamics.describe_reactions()" ] }, { "cell_type": "code", "execution_count": 5, "id": "cb582868-431c-4022-aa0e-a2f554f80d6c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[GRAPHIC ELEMENT SENT TO LOG FILE `react_4.log.htm`]\n" ] } ], "source": [ "# Send a plot of the network of reactions to the HTML log file\n", "dynamics.plot_reaction_network(\"vue_cytoscape_2\")" ] }, { "cell_type": "code", "execution_count": 6, "id": "ae304704-c8d9-4cef-9e0b-2587bb3909ef", "metadata": {}, "outputs": [], "source": [ "# Initial concentrations of all the chemicals, in index order\n", "dynamics.set_conc([200., 40.], snapshot=True)" ] }, { "cell_type": "code", "execution_count": 7, "id": "a605dacf-2c67-403e-9aa9-5be25fc9f481", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SYSTEM STATE at Time t = 0:\n", "2 species:\n", " Species 0 (A). Conc: 200.0\n", " Species 1 (C). Conc: 40.0\n", "Set of chemicals involved in reactions: {'C', 'A'}\n" ] } ], "source": [ "dynamics.describe_state()" ] }, { "cell_type": "code", "execution_count": 8, "id": "0ff2c242-a15b-456d-ad56-0ba1041c0b4c", "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", "
SYSTEM TIMEACcaption
00.0200.040.0Initial state
\n", "
" ], "text/plain": [ " SYSTEM TIME A C caption\n", "0 0.0 200.0 40.0 Initial state" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.get_history()" ] }, { "cell_type": "markdown", "id": "fc516ca2-e62d-4784-b826-5372ff7f4c75", "metadata": { "tags": [] }, "source": [ "## Run the reaction" ] }, { "cell_type": "code", "execution_count": 9, "id": "2502cd11-0df9-4303-8895-98401a1df7b8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "*** CAUTION: negative concentration in chemical `A` in step starting at t=0. It will be AUTOMATICALLY CORRECTED with a reduction in time step size, as follows:\n", " INFO: the tentative time step (0.002) leads to a NEGATIVE concentration of `A` from reaction 2 A <-> C (rxn # 0): \n", " Baseline value: 200 ; delta conc: -479.68\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.001) [Step started at t=0, and will rewind there]\n", "\n", "*** CAUTION: negative concentration in chemical `A` in step starting at t=0. It will be AUTOMATICALLY CORRECTED with a reduction in time step size, as follows:\n", " INFO: the tentative time step (0.001) leads to a NEGATIVE concentration of `A` from reaction 2 A <-> C (rxn # 0): \n", " Baseline value: 200 ; delta conc: -239.84\n", " -> will backtrack, and re-do step with a SMALLER delta time, multiplied by 0.5 (set to 0.0005) [Step started at t=0, and will rewind there]\n", "* 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.6 (set to 0.0003) [Step started at t=0, and will rewind there]\n", "* INFO: the tentative time step (0.0003) 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.6 (set to 0.00018) [Step started at t=0, and will rewind there]\n", "* INFO: the tentative time step (0.00018) 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.6 (set to 0.000108) [Step started at t=0, and will rewind there]\n", "* INFO: the tentative time step (0.000108) 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.6 (set to 6.48e-05) [Step started at t=0, and will rewind there]\n", "* INFO: the tentative time step (6.48e-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.6 (set to 3.888e-05) [Step started at t=0, and will rewind there]\n", "* INFO: the tentative time step (3.888e-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.6 (set to 2.3328e-05) [Step started at t=0, and will rewind there]\n", "* INFO: the tentative time step (2.3328e-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.6 (set to 1.3997e-05) [Step started at t=0, and will rewind there]\n", "* INFO: the tentative time step (1.3997e-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.6 (set to 8.3981e-06) [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", "110 total step(s) taken\n" ] } ], "source": [ "dynamics.set_diagnostics() # To save diagnostic information about the call to single_compartment_react()\n", "\n", "# For repeatibility, we avoid the defaults, and instead specify a particular group of preset parameters \n", "# applicable to the adaptive time steps.\n", "# Here we use a \"fast\" heuristic: advance quickly thru time\n", "dynamics.use_adaptive_preset(preset=\"fast\")\n", "\n", "dynamics.single_compartment_react(initial_step=0.002, reaction_duration=0.03,\n", " snapshots={\"initial_caption\": \"1st reaction step\",\n", " \"final_caption\": \"last reaction step\"},\n", " variable_steps=True, explain_variable_steps=False)" ] }, { "cell_type": "markdown", "id": "99a9a4b2-a588-4ba5-85c9-0a5a5d1dbaad", "metadata": {}, "source": [ "### Note how the (tentative) original time step that we provide, 0.002, turned out to be so large that the simulation backtracks several times, because of \"hard\" aborts (negative concentrations) or \"soft\" aborts (concentration changes surpassing the thresholds we provided)" ] }, { "cell_type": "code", "execution_count": 10, "id": "80fbaee3-bd6f-4197-9270-23374d46a4a7", "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", "
SYSTEM TIMEACcaption
00.000000200.00000040.000000Initial state
10.000008197.98580441.0070981st reaction step
20.000015196.40678941.796605
30.000025194.07595342.962023
40.000033192.25534943.872326
...............
1060.01382913.032172133.483914
1070.01676211.608977134.195511
1080.02116310.412711134.793645
1090.0277659.677514135.161243
1100.0376669.466796135.266602last reaction step
\n", "

111 rows × 4 columns

\n", "
" ], "text/plain": [ " SYSTEM TIME A C caption\n", "0 0.000000 200.000000 40.000000 Initial state\n", "1 0.000008 197.985804 41.007098 1st reaction step\n", "2 0.000015 196.406789 41.796605 \n", "3 0.000025 194.075953 42.962023 \n", "4 0.000033 192.255349 43.872326 \n", ".. ... ... ... ...\n", "106 0.013829 13.032172 133.483914 \n", "107 0.016762 11.608977 134.195511 \n", "108 0.021163 10.412711 134.793645 \n", "109 0.027765 9.677514 135.161243 \n", "110 0.037666 9.466796 135.266602 last reaction step\n", "\n", "[111 rows x 4 columns]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.get_history()" ] }, { "cell_type": "code", "execution_count": 11, "id": "9af1fff4-8551-4c15-94fa-44c59cf9afe0", "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, 8.398079999999997e-06, 1.5116543999999995e-05, 2.5194239999999993e-05, 3.325639679999999e-05, 4.131855359999999e-05, 4.9380710399999987e-05, 5.7442867199999985e-05, 6.550502399999998e-05, 7.356718079999997e-05, 8.162933759999996e-05, 8.969149439999995e-05, 9.775365119999994e-05, 0.00010984688639999994, 0.00011952147455999994, 0.00012919606271999994, 0.00013887065087999994, 0.00014854523903999993, 0.00015821982719999993, 0.00016789441535999992, 0.00017756900351999992, 0.0001872435916799999, 0.00020175547391999992, 0.0002133649797119999, 0.0002249744855039999, 0.00023658399129599988, 0.0002481934970879999, 0.0002598030028799999, 0.00027141250867199993, 0.00028302201446399995, 0.00030043627315199994, 0.00031436768010239993, 0.0003282990870527999, 0.0003422304940031999, 0.0003561619009535999, 0.00037009330790399987, 0.00038402471485439986, 0.00040492182527999986, 0.0004216395136204799, 0.0004383572019609599, 0.0004550748903014399, 0.00047179257864191993, 0.0004885102669823999, 0.0005052279553228799, 0.0005303044878335998, 0.0005503657138421758, 0.0005704269398507519, 0.0005904881658593279, 0.000610549391867904, 0.00063061061787648, 0.000660702456889344, 0.0006847759280996351, 0.0007088493993099263, 0.0007329228705202174, 0.0007569963417305086, 0.0007810698129407998, 0.0008171800197562366, 0.000846068185208586, 0.0008749563506609355, 0.0009038445161132849, 0.0009327326815656344, 0.0009760649297441585, 0.0010107307282869779, 0.001045396526829797, 0.0010800623253726163, 0.0011147281239154356, 0.0011667268217296647, 0.001208325779981048, 0.0012499247382324313, 0.0012915236964838146, 0.0013539221338608894, 0.0014038408837625492, 0.001453759633664209, 0.0015036783835658688, 0.0015785565084183587, 0.0016384590083003505, 0.0016983615081823424, 0.00178821525800533, 0.0018600982578637203, 0.0019319812577221105, 0.002039805757509696, 0.0021260653573397644, 0.002212324957169833, 0.002341714356914935, 0.002445225876711017, 0.0025487373965070986, 0.0027040046762012216, 0.0028282184999565197, 0.0030145392355894673, 0.0031635958240958254, 0.0033871807068553625, 0.003566048613062992, 0.0038343504723744363, 0.004048991959823592, 0.004370954190997325, 0.004628523975936312, 0.005014878653344792, 0.005401233330753272, 0.005787588008161752, 0.006367120024274472, 0.006946652040387191, 0.007526184056499911, 0.00839548208066899, 0.009264780104838069, 0.010568727141091689, 0.011872674177345308, 0.013828594731725739, 0.016762475563296384, 0.02116329681065235, 0.027764528681686298, 0.03766637648823722 ], "xaxis": "x", "y": [ 200, 197.9858044928, 196.4067891314626, 194.07595334497333, 192.25534898661533, 190.46879740430532, 188.71534993819054, 186.99409292105136, 185.30414607674047, 183.64466100591383, 182.01481975354585, 180.413833453115, 178.8409410427091, 176.52264155159475, 174.7158686464458, 172.94596814009458, 171.21182008364218, 169.51234954024133, 167.84652434187538, 166.21335297917756, 164.61188261516287, 163.04119721445474, 160.7300250631269, 158.93326473964117, 157.1765542323314, 155.45856600172303, 153.77803069527553, 152.133733987297, 150.52451362294565, 148.94925665108212, 146.6357169224966, 144.84211135489045, 143.09225548651855, 141.38456387891168, 139.71752700678886, 138.08970675790684, 136.4997322498795, 134.16957778233262, 132.36879532470405, 130.61621777514426, 128.90993008249367, 127.24811762984149, 125.62905971933556, 124.05112355869569, 121.74357627793043, 119.96590134278878, 118.24001728379018, 116.56368739309407, 114.93480237154793, 113.351371359806, 111.04158489742949, 109.2687305903879, 107.55237706353577, 105.88985862493844, 104.27867529774959, 102.7164801024925, 100.44336119220299, 98.7050418479391, 97.02682657844456, 95.40564341405201, 93.83862706351552, 91.56533911676678, 89.83453130782063, 88.16914727211656, 86.56553760884185, 85.02032056253428, 82.78537648667351, 81.09121389710347, 79.46648786673279, 77.9070066041123, 75.65986265590448, 73.96572967479426, 72.34768795251657, 70.80071472427237, 68.57997565365879, 66.91489951075998, 65.3311102130008, 63.06862999277249, 61.38426396067837, 59.79055059290303, 57.52526128383666, 55.85096377632318, 54.2752007633405, 52.0466837978649, 50.41148777357389, 48.880683692615165, 46.726553773792986, 45.157276312252364, 42.9651397869594, 41.38484933300463, 39.193940122296404, 37.63146143283778, 35.48182042695287, 33.965438176115484, 31.895273567682466, 30.450914577527918, 28.494240237134733, 26.806442549712752, 25.336314685381662, 23.399376307880704, 21.792923050674183, 20.440773545233533, 18.712754345180954, 17.34062951686442, 15.673056180321085, 14.440546857084291, 13.032171680702598, 11.6089773772302, 10.412710546541897, 9.677513749893356, 9.466795875764356 ], "yaxis": "y" }, { "hovertemplate": "Chemical=C
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "C", "line": { "color": "green", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "C", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 8.398079999999997e-06, 1.5116543999999995e-05, 2.5194239999999993e-05, 3.325639679999999e-05, 4.131855359999999e-05, 4.9380710399999987e-05, 5.7442867199999985e-05, 6.550502399999998e-05, 7.356718079999997e-05, 8.162933759999996e-05, 8.969149439999995e-05, 9.775365119999994e-05, 0.00010984688639999994, 0.00011952147455999994, 0.00012919606271999994, 0.00013887065087999994, 0.00014854523903999993, 0.00015821982719999993, 0.00016789441535999992, 0.00017756900351999992, 0.0001872435916799999, 0.00020175547391999992, 0.0002133649797119999, 0.0002249744855039999, 0.00023658399129599988, 0.0002481934970879999, 0.0002598030028799999, 0.00027141250867199993, 0.00028302201446399995, 0.00030043627315199994, 0.00031436768010239993, 0.0003282990870527999, 0.0003422304940031999, 0.0003561619009535999, 0.00037009330790399987, 0.00038402471485439986, 0.00040492182527999986, 0.0004216395136204799, 0.0004383572019609599, 0.0004550748903014399, 0.00047179257864191993, 0.0004885102669823999, 0.0005052279553228799, 0.0005303044878335998, 0.0005503657138421758, 0.0005704269398507519, 0.0005904881658593279, 0.000610549391867904, 0.00063061061787648, 0.000660702456889344, 0.0006847759280996351, 0.0007088493993099263, 0.0007329228705202174, 0.0007569963417305086, 0.0007810698129407998, 0.0008171800197562366, 0.000846068185208586, 0.0008749563506609355, 0.0009038445161132849, 0.0009327326815656344, 0.0009760649297441585, 0.0010107307282869779, 0.001045396526829797, 0.0010800623253726163, 0.0011147281239154356, 0.0011667268217296647, 0.001208325779981048, 0.0012499247382324313, 0.0012915236964838146, 0.0013539221338608894, 0.0014038408837625492, 0.001453759633664209, 0.0015036783835658688, 0.0015785565084183587, 0.0016384590083003505, 0.0016983615081823424, 0.00178821525800533, 0.0018600982578637203, 0.0019319812577221105, 0.002039805757509696, 0.0021260653573397644, 0.002212324957169833, 0.002341714356914935, 0.002445225876711017, 0.0025487373965070986, 0.0027040046762012216, 0.0028282184999565197, 0.0030145392355894673, 0.0031635958240958254, 0.0033871807068553625, 0.003566048613062992, 0.0038343504723744363, 0.004048991959823592, 0.004370954190997325, 0.004628523975936312, 0.005014878653344792, 0.005401233330753272, 0.005787588008161752, 0.006367120024274472, 0.006946652040387191, 0.007526184056499911, 0.00839548208066899, 0.009264780104838069, 0.010568727141091689, 0.011872674177345308, 0.013828594731725739, 0.016762475563296384, 0.02116329681065235, 0.027764528681686298, 0.03766637648823722 ], "xaxis": "x", "y": [ 40, 41.0070977536, 41.796605434268706, 42.962023327513336, 43.87232550669233, 44.76560129784734, 45.642325030904736, 46.502953539474326, 47.34792696162977, 48.17766949704308, 48.99259012322707, 49.79308327344249, 50.57952947864544, 51.73867922420261, 52.64206567677707, 53.52701592995269, 54.39408995817889, 55.243825229879306, 56.076737829062274, 56.893323510411186, 57.69405869241852, 58.47940139277259, 59.634987468436506, 60.53336763017938, 61.41172288383427, 62.27071699913845, 63.1109846523622, 63.933133006351454, 64.73774318852713, 65.5253716744589, 66.68214153875165, 67.57894432255473, 68.45387225674068, 69.30771806054412, 70.14123649660553, 70.95514662104654, 71.75013387506021, 72.91521110883365, 73.81560233764793, 74.69189111242783, 75.54503495875312, 76.37594118507921, 77.18547014033219, 77.97443822065212, 79.12821186103476, 80.01704932860558, 80.87999135810489, 81.71815630345294, 82.53259881422602, 83.32431432009699, 84.47920755128524, 85.36563470480604, 86.22381146823211, 87.05507068753077, 87.8606623511252, 88.64175994875374, 89.77831940389851, 90.64747907603045, 91.48658671077771, 92.29717829297398, 93.08068646824222, 94.2173304416166, 95.08273434608968, 95.91542636394172, 96.71723119557907, 97.48983971873285, 98.60731175666324, 99.45439305144825, 100.26675606663359, 101.04649669794384, 102.17006867204775, 103.01713516260286, 103.8261560237417, 104.5996426378638, 105.71001217317058, 106.54255024461999, 107.33444489349958, 108.46568500361373, 109.30786801966079, 110.10472470354846, 111.23736935808164, 112.07451811183837, 112.86239961832972, 113.97665810106751, 114.79425611321302, 115.55965815369238, 116.63672311310347, 117.42136184387378, 118.51743010652027, 119.30757533349765, 120.40302993885176, 121.18426928358107, 122.25908978652353, 123.01728091194222, 124.05236321615872, 124.774542711236, 125.75287988143259, 126.59677872514358, 127.33184265730912, 128.3003118460596, 129.10353847466286, 129.77961322738318, 130.64362282740947, 131.32968524156774, 132.16347190983942, 132.77972657145781, 133.48391415964866, 134.19551131138485, 134.793644726729, 135.1612431250533, 135.26660206211778 ], "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 2A <-> C (2nd order in A). Changes in concentrations with time" }, "xaxis": { "anchor": "y", "autorange": true, "domain": [ 0, 1 ], "range": [ 0, 0.03766637648823722 ], "title": { "text": "SYSTEM TIME" }, "type": "linear" }, "yaxis": { "anchor": "x", "autorange": true, "domain": [ 0, 1 ], "range": [ -1.1183821311376239, 210.58517800690197 ], "title": { "text": "concentration" }, "type": "linear" } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "dynamics.plot_history(colors=['red', 'green'],\n", " title=\"Reaction 2A <-> C (2nd order in A). Changes in concentrations with time\")" ] }, { "cell_type": "markdown", "id": "b1366038-2dea-4d69-a655-ae464ca22922", "metadata": {}, "source": [ "### Note: \"A\" (now largely depleted) is the limiting reagent" ] }, { "cell_type": "code", "execution_count": null, "id": "fce512b2-bcc8-4721-85c9-2241ab3ae55e", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "82daf161-82de-44a5-9310-da2333ba6faa", "metadata": {}, "source": [ "# PART 2 - Analysis and Validation" ] }, { "cell_type": "markdown", "id": "39cb26e8-c061-41ab-a91a-77df6f431efa", "metadata": {}, "source": [ "#### Let's take a look at time t=0.002, which in our simulation run had proposed as the first step:" ] }, { "cell_type": "code", "execution_count": 12, "id": "232349ed-fa23-4ebf-b4ba-d5bddcc8902c", "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", "
search_valueSYSTEM TIMEACcaption
800.0020.0020457.525261111.237369
\n", "
" ], "text/plain": [ " search_value SYSTEM TIME A C caption\n", "80 0.002 0.00204 57.525261 111.237369 " ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Locate the value closest to the original time step we had requested\n", "dynamics.get_history(t=0.002)" ] }, { "cell_type": "markdown", "id": "b03c9994-cade-48cf-8b14-4b894cc755cf", "metadata": {}, "source": [ "### Because of the very large changes happening between t=0 and 0.002, the simulation automatically slowed down and opted to actually take 80 steps in lieu of the 1 step we had (optimistically!) proposed \n", "The number of variable steps actually taken can be modulated by changing the preset passed to our earlier call to `use_adaptive_preset()`. For finer control, advanced users may tweak internal parameters such as \"norm thresholds\" and \"step factors\"" ] }, { "cell_type": "markdown", "id": "ce3cd198-de57-4e0f-80f2-8e07f2cd7f96", "metadata": {}, "source": [ "### Notice how, late in the simulation, the step sizes get BIGGER than the 0.002 we had originally proposed:" ] }, { "cell_type": "code", "execution_count": 13, "id": "071a9544-639a-40f7-92bc-3a20050c9c00", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "From time 0 to 8.398e-06, in 1 step of 8.4e-06\n", "From time 8.398e-06 to 1.512e-05, in 1 step of 6.72e-06\n", "From time 1.512e-05 to 2.519e-05, in 1 step of 1.01e-05\n", "From time 2.519e-05 to 9.775e-05, in 9 steps of 8.06e-06\n", "From time 9.775e-05 to 0.0001098, in 1 step of 1.21e-05\n", "From time 0.0001098 to 0.0001872, in 8 steps of 9.67e-06\n", "From time 0.0001872 to 0.0002018, in 1 step of 1.45e-05\n", "From time 0.0002018 to 0.000283, in 7 steps of 1.16e-05\n", "From time 0.000283 to 0.0003004, in 1 step of 1.74e-05\n", "From time 0.0003004 to 0.000384, in 6 steps of 1.39e-05\n", "From time 0.000384 to 0.0004049, in 1 step of 2.09e-05\n", "From time 0.0004049 to 0.0005052, in 6 steps of 1.67e-05\n", "From time 0.0005052 to 0.0005303, in 1 step of 2.51e-05\n", "From time 0.0005303 to 0.0006306, in 5 steps of 2.01e-05\n", "From time 0.0006306 to 0.0006607, in 1 step of 3.01e-05\n", "From time 0.0006607 to 0.0007811, in 5 steps of 2.41e-05\n", "From time 0.0007811 to 0.0008172, in 1 step of 3.61e-05\n", "From time 0.0008172 to 0.0009327, in 4 steps of 2.89e-05\n", "From time 0.0009327 to 0.0009761, in 1 step of 4.33e-05\n", "From time 0.0009761 to 0.001115, in 4 steps of 3.47e-05\n", "From time 0.001115 to 0.001167, in 1 step of 5.2e-05\n", "From time 0.001167 to 0.001292, in 3 steps of 4.16e-05\n", "From time 0.001292 to 0.001354, in 1 step of 6.24e-05\n", "From time 0.001354 to 0.001504, in 3 steps of 4.99e-05\n", "From time 0.001504 to 0.001579, in 1 step of 7.49e-05\n", "From time 0.001579 to 0.001698, in 2 steps of 5.99e-05\n", "From time 0.001698 to 0.001788, in 1 step of 8.99e-05\n", "From time 0.001788 to 0.001932, in 2 steps of 7.19e-05\n", "From time 0.001932 to 0.00204, in 1 step of 0.000108\n", "From time 0.00204 to 0.002212, in 2 steps of 8.63e-05\n", "From time 0.002212 to 0.002342, in 1 step of 0.000129\n", "From time 0.002342 to 0.002549, in 2 steps of 0.000104\n", "From time 0.002549 to 0.002704, in 1 step of 0.000155\n", "From time 0.002704 to 0.002828, in 1 step of 0.000124\n", "From time 0.002828 to 0.003015, in 1 step of 0.000186\n", "From time 0.003015 to 0.003164, in 1 step of 0.000149\n", "From time 0.003164 to 0.003387, in 1 step of 0.000224\n", "From time 0.003387 to 0.003566, in 1 step of 0.000179\n", "From time 0.003566 to 0.003834, in 1 step of 0.000268\n", "From time 0.003834 to 0.004049, in 1 step of 0.000215\n", "From time 0.004049 to 0.004371, in 1 step of 0.000322\n", "From time 0.004371 to 0.004629, in 1 step of 0.000258\n", "From time 0.004629 to 0.005788, in 3 steps of 0.000386\n", "From time 0.005788 to 0.007526, in 3 steps of 0.00058\n", "From time 0.007526 to 0.009265, in 2 steps of 0.000869\n", "From time 0.009265 to 0.01187, in 2 steps of 0.0013\n", "From time 0.01187 to 0.01383, in 1 step of 0.00196\n", "From time 0.01383 to 0.01676, in 1 step of 0.00293\n", "From time 0.01676 to 0.02116, in 1 step of 0.0044\n", "From time 0.02116 to 0.02776, in 1 step of 0.0066\n", "From time 0.02776 to 0.03767, in 1 step of 0.0099\n", "(110 steps total)\n" ] } ], "source": [ "dynamics.explain_time_advance()" ] }, { "cell_type": "markdown", "id": "9fb5f6b8-dde3-415d-9e90-b8d102bfd748", "metadata": {}, "source": [ "### Notice how the reaction proceeds in far-smaller steps in the early times, when the concentrations are changing much more rapidly" ] }, { "cell_type": "code", "execution_count": 14, "id": "12118fdd-5e81-42e5-b271-818f8d686b79", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(array([200., 40.], dtype=float32),\n", " array([197.98581, 41.0071 ], dtype=float32))" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Let's look at the first two arrays of concentrations, from the run's history\n", "arr0 = dynamics.get_historical_concentrations(0) # The initial concentrations\n", "arr1 = dynamics.get_historical_concentrations(1) # After the first actual simulation step\n", "arr0, arr1" ] }, { "cell_type": "code", "execution_count": 15, "id": "a2450ae8-e342-4adf-9330-ce86a1dfcbeb", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Let's verify that the reaction's stoichiometry is being respected\n", "dynamics.stoichiometry_checker(rxn_index=0, \n", " conc_arr_before = arr0, \n", " conc_arr_after = arr1)" ] }, { "cell_type": "markdown", "id": "bf6dc3ed-5999-4379-8ae1-05f73e2a670d", "metadata": {}, "source": [ "#### Indeed, it can be easy checked that the drop in [A] is twice the increase in [C], as dictated by the stoichiometry.\n", "The diagnostic data, enabled by our earlier call to `set_diagnostics()`, makes it convenient to check" ] }, { "cell_type": "code", "execution_count": 16, "id": "4ccfa79c-0bd4-40f0-be82-2da19523cd40", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Reaction: 2 A <-> C\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
START_TIMEDelta ADelta Ctime_stepcaption
00.000000NaNNaN0.002000aborted: neg. conc. in `A`
10.000000NaNNaN0.001000aborted: neg. conc. in `A`
20.000000-119.92000059.9600000.000500aborted: excessive norm value(s)
30.000000-71.95200035.9760000.000300aborted: excessive norm value(s)
40.000000-43.17120021.5856000.000180aborted: excessive norm value(s)
50.000000-25.90272012.9513600.000108aborted: excessive norm value(s)
60.000000-15.5416327.7708160.000065aborted: excessive norm value(s)
70.000000-9.3249794.6624900.000039aborted: excessive norm value(s)
80.000000-5.5949882.7974940.000023aborted: excessive norm value(s)
90.000000-3.3569931.6784960.000014aborted: excessive norm value(s)
100.000000-2.0141961.0070980.000008
110.000008-1.5790150.7895080.000007
120.000015-2.3308361.1654180.000010
130.000025-1.8206040.9103020.000008
140.000033-1.7865520.8932760.000008
\n", "
" ], "text/plain": [ " START_TIME Delta A Delta C time_step \\\n", "0 0.000000 NaN NaN 0.002000 \n", "1 0.000000 NaN NaN 0.001000 \n", "2 0.000000 -119.920000 59.960000 0.000500 \n", "3 0.000000 -71.952000 35.976000 0.000300 \n", "4 0.000000 -43.171200 21.585600 0.000180 \n", "5 0.000000 -25.902720 12.951360 0.000108 \n", "6 0.000000 -15.541632 7.770816 0.000065 \n", "7 0.000000 -9.324979 4.662490 0.000039 \n", "8 0.000000 -5.594988 2.797494 0.000023 \n", "9 0.000000 -3.356993 1.678496 0.000014 \n", "10 0.000000 -2.014196 1.007098 0.000008 \n", "11 0.000008 -1.579015 0.789508 0.000007 \n", "12 0.000015 -2.330836 1.165418 0.000010 \n", "13 0.000025 -1.820604 0.910302 0.000008 \n", "14 0.000033 -1.786552 0.893276 0.000008 \n", "\n", " caption \n", "0 aborted: neg. conc. in `A` \n", "1 aborted: neg. conc. in `A` \n", "2 aborted: excessive norm value(s) \n", "3 aborted: excessive norm value(s) \n", "4 aborted: excessive norm value(s) \n", "5 aborted: excessive norm value(s) \n", "6 aborted: excessive norm value(s) \n", "7 aborted: excessive norm value(s) \n", "8 aborted: excessive norm value(s) \n", "9 aborted: excessive norm value(s) \n", "10 \n", "11 \n", "12 \n", "13 \n", "14 " ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.get_diagnostic_rxn_data(rxn_index=0, head=15)" ] }, { "cell_type": "markdown", "id": "a2f4d0e3-b259-4bd1-a94e-5751264775f7", "metadata": {}, "source": [ "### From the diagnostic data, it can be seen that the first step had several false starts - and the time was automatically repeatedly shrunk - but finally happened. `Delta A` indeed equals - 2 * `Delta C`, satisfying the stoichiometry" ] }, { "cell_type": "code", "execution_count": 17, "id": "014c9870-1e91-4979-a24b-6e9f1c216640", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.stoichiometry_checker_entire_run()" ] }, { "cell_type": "markdown", "id": "21ba52bf-0754-496f-bca7-e120b54ff403", "metadata": {}, "source": [ "### Check the final equilibrium" ] }, { "cell_type": "code", "execution_count": 18, "id": "820a5564-bd4e-49db-8289-c912a106a5d9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0: 2 A <-> C\n", "Final concentrations: [A] = 9.467 ; [C] = 135.3\n", "1. Ratio of reactant/product concentrations, adjusted for reaction orders: 1.50933\n", " Formula used: [C] / [A]^2 \n", "2. Ratio of forward/reverse reaction rates: 1.5\n", "Discrepancy between the two values: 0.6221 %\n", "Reaction IS in equilibrium (within 1% tolerance)\n", "\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Verify that the reaction has reached equilibrium\n", "dynamics.is_in_equilibrium()" ] }, { "cell_type": "markdown", "id": "6ac3dd4e-9dd0-4d3a-aa83-76102bd79524", "metadata": { "tags": [] }, "source": [ "## Display the variable time steps" ] }, { "cell_type": "code", "execution_count": 19, "id": "21e4814e-5603-4d38-acc8-549b1d59ec93", "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, 8.398079999999997e-06, 1.5116543999999995e-05, 2.5194239999999993e-05, 3.325639679999999e-05, 4.131855359999999e-05, 4.9380710399999987e-05, 5.7442867199999985e-05, 6.550502399999998e-05, 7.356718079999997e-05, 8.162933759999996e-05, 8.969149439999995e-05, 9.775365119999994e-05, 0.00010984688639999994, 0.00011952147455999994, 0.00012919606271999994, 0.00013887065087999994, 0.00014854523903999993, 0.00015821982719999993, 0.00016789441535999992, 0.00017756900351999992, 0.0001872435916799999, 0.00020175547391999992, 0.0002133649797119999, 0.0002249744855039999, 0.00023658399129599988, 0.0002481934970879999, 0.0002598030028799999, 0.00027141250867199993, 0.00028302201446399995, 0.00030043627315199994, 0.00031436768010239993, 0.0003282990870527999, 0.0003422304940031999, 0.0003561619009535999, 0.00037009330790399987, 0.00038402471485439986, 0.00040492182527999986, 0.0004216395136204799, 0.0004383572019609599, 0.0004550748903014399, 0.00047179257864191993, 0.0004885102669823999, 0.0005052279553228799, 0.0005303044878335998, 0.0005503657138421758, 0.0005704269398507519, 0.0005904881658593279, 0.000610549391867904, 0.00063061061787648, 0.000660702456889344, 0.0006847759280996351, 0.0007088493993099263, 0.0007329228705202174, 0.0007569963417305086, 0.0007810698129407998, 0.0008171800197562366, 0.000846068185208586, 0.0008749563506609355, 0.0009038445161132849, 0.0009327326815656344, 0.0009760649297441585, 0.0010107307282869779, 0.001045396526829797, 0.0010800623253726163, 0.0011147281239154356, 0.0011667268217296647, 0.001208325779981048, 0.0012499247382324313, 0.0012915236964838146, 0.0013539221338608894, 0.0014038408837625492, 0.001453759633664209, 0.0015036783835658688, 0.0015785565084183587, 0.0016384590083003505, 0.0016983615081823424, 0.00178821525800533, 0.0018600982578637203, 0.0019319812577221105, 0.002039805757509696, 0.0021260653573397644, 0.002212324957169833, 0.002341714356914935, 0.002445225876711017, 0.0025487373965070986, 0.0027040046762012216, 0.0028282184999565197, 0.0030145392355894673, 0.0031635958240958254, 0.0033871807068553625, 0.003566048613062992, 0.0038343504723744363, 0.004048991959823592, 0.004370954190997325, 0.004628523975936312, 0.005014878653344792, 0.005401233330753272, 0.005787588008161752, 0.006367120024274472, 0.006946652040387191, 0.007526184056499911, 0.00839548208066899, 0.009264780104838069, 0.010568727141091689, 0.011872674177345308, 0.013828594731725739, 0.016762475563296384, 0.02116329681065235, 0.027764528681686298, 0.03766637648823722 ], "xaxis": "x", "y": [ 200, 197.9858044928, 196.4067891314626, 194.07595334497333, 192.25534898661533, 190.46879740430532, 188.71534993819054, 186.99409292105136, 185.30414607674047, 183.64466100591383, 182.01481975354585, 180.413833453115, 178.8409410427091, 176.52264155159475, 174.7158686464458, 172.94596814009458, 171.21182008364218, 169.51234954024133, 167.84652434187538, 166.21335297917756, 164.61188261516287, 163.04119721445474, 160.7300250631269, 158.93326473964117, 157.1765542323314, 155.45856600172303, 153.77803069527553, 152.133733987297, 150.52451362294565, 148.94925665108212, 146.6357169224966, 144.84211135489045, 143.09225548651855, 141.38456387891168, 139.71752700678886, 138.08970675790684, 136.4997322498795, 134.16957778233262, 132.36879532470405, 130.61621777514426, 128.90993008249367, 127.24811762984149, 125.62905971933556, 124.05112355869569, 121.74357627793043, 119.96590134278878, 118.24001728379018, 116.56368739309407, 114.93480237154793, 113.351371359806, 111.04158489742949, 109.2687305903879, 107.55237706353577, 105.88985862493844, 104.27867529774959, 102.7164801024925, 100.44336119220299, 98.7050418479391, 97.02682657844456, 95.40564341405201, 93.83862706351552, 91.56533911676678, 89.83453130782063, 88.16914727211656, 86.56553760884185, 85.02032056253428, 82.78537648667351, 81.09121389710347, 79.46648786673279, 77.9070066041123, 75.65986265590448, 73.96572967479426, 72.34768795251657, 70.80071472427237, 68.57997565365879, 66.91489951075998, 65.3311102130008, 63.06862999277249, 61.38426396067837, 59.79055059290303, 57.52526128383666, 55.85096377632318, 54.2752007633405, 52.0466837978649, 50.41148777357389, 48.880683692615165, 46.726553773792986, 45.157276312252364, 42.9651397869594, 41.38484933300463, 39.193940122296404, 37.63146143283778, 35.48182042695287, 33.965438176115484, 31.895273567682466, 30.450914577527918, 28.494240237134733, 26.806442549712752, 25.336314685381662, 23.399376307880704, 21.792923050674183, 20.440773545233533, 18.712754345180954, 17.34062951686442, 15.673056180321085, 14.440546857084291, 13.032171680702598, 11.6089773772302, 10.412710546541897, 9.677513749893356, 9.466795875764356 ], "yaxis": "y" }, { "hovertemplate": "Chemical=C
SYSTEM TIME=%{x}
concentration=%{y}", "legendgroup": "C", "line": { "color": "green", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "C", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 0, 8.398079999999997e-06, 1.5116543999999995e-05, 2.5194239999999993e-05, 3.325639679999999e-05, 4.131855359999999e-05, 4.9380710399999987e-05, 5.7442867199999985e-05, 6.550502399999998e-05, 7.356718079999997e-05, 8.162933759999996e-05, 8.969149439999995e-05, 9.775365119999994e-05, 0.00010984688639999994, 0.00011952147455999994, 0.00012919606271999994, 0.00013887065087999994, 0.00014854523903999993, 0.00015821982719999993, 0.00016789441535999992, 0.00017756900351999992, 0.0001872435916799999, 0.00020175547391999992, 0.0002133649797119999, 0.0002249744855039999, 0.00023658399129599988, 0.0002481934970879999, 0.0002598030028799999, 0.00027141250867199993, 0.00028302201446399995, 0.00030043627315199994, 0.00031436768010239993, 0.0003282990870527999, 0.0003422304940031999, 0.0003561619009535999, 0.00037009330790399987, 0.00038402471485439986, 0.00040492182527999986, 0.0004216395136204799, 0.0004383572019609599, 0.0004550748903014399, 0.00047179257864191993, 0.0004885102669823999, 0.0005052279553228799, 0.0005303044878335998, 0.0005503657138421758, 0.0005704269398507519, 0.0005904881658593279, 0.000610549391867904, 0.00063061061787648, 0.000660702456889344, 0.0006847759280996351, 0.0007088493993099263, 0.0007329228705202174, 0.0007569963417305086, 0.0007810698129407998, 0.0008171800197562366, 0.000846068185208586, 0.0008749563506609355, 0.0009038445161132849, 0.0009327326815656344, 0.0009760649297441585, 0.0010107307282869779, 0.001045396526829797, 0.0010800623253726163, 0.0011147281239154356, 0.0011667268217296647, 0.001208325779981048, 0.0012499247382324313, 0.0012915236964838146, 0.0013539221338608894, 0.0014038408837625492, 0.001453759633664209, 0.0015036783835658688, 0.0015785565084183587, 0.0016384590083003505, 0.0016983615081823424, 0.00178821525800533, 0.0018600982578637203, 0.0019319812577221105, 0.002039805757509696, 0.0021260653573397644, 0.002212324957169833, 0.002341714356914935, 0.002445225876711017, 0.0025487373965070986, 0.0027040046762012216, 0.0028282184999565197, 0.0030145392355894673, 0.0031635958240958254, 0.0033871807068553625, 0.003566048613062992, 0.0038343504723744363, 0.004048991959823592, 0.004370954190997325, 0.004628523975936312, 0.005014878653344792, 0.005401233330753272, 0.005787588008161752, 0.006367120024274472, 0.006946652040387191, 0.007526184056499911, 0.00839548208066899, 0.009264780104838069, 0.010568727141091689, 0.011872674177345308, 0.013828594731725739, 0.016762475563296384, 0.02116329681065235, 0.027764528681686298, 0.03766637648823722 ], "xaxis": "x", "y": [ 40, 41.0070977536, 41.796605434268706, 42.962023327513336, 43.87232550669233, 44.76560129784734, 45.642325030904736, 46.502953539474326, 47.34792696162977, 48.17766949704308, 48.99259012322707, 49.79308327344249, 50.57952947864544, 51.73867922420261, 52.64206567677707, 53.52701592995269, 54.39408995817889, 55.243825229879306, 56.076737829062274, 56.893323510411186, 57.69405869241852, 58.47940139277259, 59.634987468436506, 60.53336763017938, 61.41172288383427, 62.27071699913845, 63.1109846523622, 63.933133006351454, 64.73774318852713, 65.5253716744589, 66.68214153875165, 67.57894432255473, 68.45387225674068, 69.30771806054412, 70.14123649660553, 70.95514662104654, 71.75013387506021, 72.91521110883365, 73.81560233764793, 74.69189111242783, 75.54503495875312, 76.37594118507921, 77.18547014033219, 77.97443822065212, 79.12821186103476, 80.01704932860558, 80.87999135810489, 81.71815630345294, 82.53259881422602, 83.32431432009699, 84.47920755128524, 85.36563470480604, 86.22381146823211, 87.05507068753077, 87.8606623511252, 88.64175994875374, 89.77831940389851, 90.64747907603045, 91.48658671077771, 92.29717829297398, 93.08068646824222, 94.2173304416166, 95.08273434608968, 95.91542636394172, 96.71723119557907, 97.48983971873285, 98.60731175666324, 99.45439305144825, 100.26675606663359, 101.04649669794384, 102.17006867204775, 103.01713516260286, 103.8261560237417, 104.5996426378638, 105.71001217317058, 106.54255024461999, 107.33444489349958, 108.46568500361373, 109.30786801966079, 110.10472470354846, 111.23736935808164, 112.07451811183837, 112.86239961832972, 113.97665810106751, 114.79425611321302, 115.55965815369238, 116.63672311310347, 117.42136184387378, 118.51743010652027, 119.30757533349765, 120.40302993885176, 121.18426928358107, 122.25908978652353, 123.01728091194222, 124.05236321615872, 124.774542711236, 125.75287988143259, 126.59677872514358, 127.33184265730912, 128.3003118460596, 129.10353847466286, 129.77961322738318, 130.64362282740947, 131.32968524156774, 132.16347190983942, 132.77972657145781, 133.48391415964866, 134.19551131138485, 134.793644726729, 135.1612431250533, 135.26660206211778 ], "yaxis": "y" } ], "layout": { "autosize": true, "legend": { "title": { "text": "Chemical" }, "tracegroupgap": 0 }, "shapes": [ { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0, "x1": 0, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 8.398079999999997e-06, "x1": 8.398079999999997e-06, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 1.5116543999999995e-05, "x1": 1.5116543999999995e-05, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 2.5194239999999993e-05, "x1": 2.5194239999999993e-05, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 3.325639679999999e-05, "x1": 3.325639679999999e-05, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 4.131855359999999e-05, "x1": 4.131855359999999e-05, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 4.9380710399999987e-05, "x1": 4.9380710399999987e-05, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 5.7442867199999985e-05, "x1": 5.7442867199999985e-05, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 6.550502399999998e-05, "x1": 6.550502399999998e-05, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 7.356718079999997e-05, "x1": 7.356718079999997e-05, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 8.162933759999996e-05, "x1": 8.162933759999996e-05, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 8.969149439999995e-05, "x1": 8.969149439999995e-05, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 9.775365119999994e-05, "x1": 9.775365119999994e-05, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00010984688639999994, "x1": 0.00010984688639999994, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00011952147455999994, "x1": 0.00011952147455999994, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00012919606271999994, "x1": 0.00012919606271999994, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00013887065087999994, "x1": 0.00013887065087999994, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00014854523903999993, "x1": 0.00014854523903999993, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00015821982719999993, "x1": 0.00015821982719999993, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00016789441535999992, "x1": 0.00016789441535999992, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00017756900351999992, "x1": 0.00017756900351999992, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0001872435916799999, "x1": 0.0001872435916799999, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00020175547391999992, "x1": 0.00020175547391999992, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0002133649797119999, "x1": 0.0002133649797119999, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0002249744855039999, "x1": 0.0002249744855039999, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00023658399129599988, "x1": 0.00023658399129599988, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0002481934970879999, "x1": 0.0002481934970879999, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0002598030028799999, "x1": 0.0002598030028799999, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00027141250867199993, "x1": 0.00027141250867199993, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00028302201446399995, "x1": 0.00028302201446399995, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00030043627315199994, "x1": 0.00030043627315199994, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00031436768010239993, "x1": 0.00031436768010239993, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0003282990870527999, "x1": 0.0003282990870527999, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0003422304940031999, "x1": 0.0003422304940031999, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0003561619009535999, "x1": 0.0003561619009535999, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00037009330790399987, "x1": 0.00037009330790399987, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00038402471485439986, "x1": 0.00038402471485439986, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00040492182527999986, "x1": 0.00040492182527999986, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0004216395136204799, "x1": 0.0004216395136204799, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0004383572019609599, "x1": 0.0004383572019609599, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0004550748903014399, "x1": 0.0004550748903014399, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00047179257864191993, "x1": 0.00047179257864191993, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0004885102669823999, "x1": 0.0004885102669823999, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0005052279553228799, "x1": 0.0005052279553228799, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0005303044878335998, "x1": 0.0005303044878335998, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0005503657138421758, "x1": 0.0005503657138421758, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0005704269398507519, "x1": 0.0005704269398507519, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0005904881658593279, "x1": 0.0005904881658593279, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.000610549391867904, "x1": 0.000610549391867904, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00063061061787648, "x1": 0.00063061061787648, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.000660702456889344, "x1": 0.000660702456889344, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0006847759280996351, "x1": 0.0006847759280996351, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0007088493993099263, "x1": 0.0007088493993099263, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0007329228705202174, "x1": 0.0007329228705202174, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0007569963417305086, "x1": 0.0007569963417305086, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0007810698129407998, "x1": 0.0007810698129407998, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0008171800197562366, "x1": 0.0008171800197562366, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.000846068185208586, "x1": 0.000846068185208586, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0008749563506609355, "x1": 0.0008749563506609355, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0009038445161132849, "x1": 0.0009038445161132849, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0009327326815656344, "x1": 0.0009327326815656344, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0009760649297441585, "x1": 0.0009760649297441585, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0010107307282869779, "x1": 0.0010107307282869779, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.001045396526829797, "x1": 0.001045396526829797, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0010800623253726163, "x1": 0.0010800623253726163, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0011147281239154356, "x1": 0.0011147281239154356, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0011667268217296647, "x1": 0.0011667268217296647, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.001208325779981048, "x1": 0.001208325779981048, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0012499247382324313, "x1": 0.0012499247382324313, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0012915236964838146, "x1": 0.0012915236964838146, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0013539221338608894, "x1": 0.0013539221338608894, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0014038408837625492, "x1": 0.0014038408837625492, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.001453759633664209, "x1": 0.001453759633664209, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0015036783835658688, "x1": 0.0015036783835658688, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0015785565084183587, "x1": 0.0015785565084183587, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0016384590083003505, "x1": 0.0016384590083003505, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0016983615081823424, "x1": 0.0016983615081823424, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00178821525800533, "x1": 0.00178821525800533, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0018600982578637203, "x1": 0.0018600982578637203, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0019319812577221105, "x1": 0.0019319812577221105, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.002039805757509696, "x1": 0.002039805757509696, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0021260653573397644, "x1": 0.0021260653573397644, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.002212324957169833, "x1": 0.002212324957169833, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.002341714356914935, "x1": 0.002341714356914935, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.002445225876711017, "x1": 0.002445225876711017, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0025487373965070986, "x1": 0.0025487373965070986, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0027040046762012216, "x1": 0.0027040046762012216, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0028282184999565197, "x1": 0.0028282184999565197, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0030145392355894673, "x1": 0.0030145392355894673, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0031635958240958254, "x1": 0.0031635958240958254, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0033871807068553625, "x1": 0.0033871807068553625, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.003566048613062992, "x1": 0.003566048613062992, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.0038343504723744363, "x1": 0.0038343504723744363, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.004048991959823592, "x1": 0.004048991959823592, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.004370954190997325, "x1": 0.004370954190997325, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.004628523975936312, "x1": 0.004628523975936312, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.005014878653344792, "x1": 0.005014878653344792, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.005401233330753272, "x1": 0.005401233330753272, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.005787588008161752, "x1": 0.005787588008161752, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.006367120024274472, "x1": 0.006367120024274472, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.006946652040387191, "x1": 0.006946652040387191, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.007526184056499911, "x1": 0.007526184056499911, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.00839548208066899, "x1": 0.00839548208066899, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.009264780104838069, "x1": 0.009264780104838069, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.010568727141091689, "x1": 0.010568727141091689, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.011872674177345308, "x1": 0.011872674177345308, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.013828594731725739, "x1": 0.013828594731725739, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.016762475563296384, "x1": 0.016762475563296384, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.02116329681065235, "x1": 0.02116329681065235, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.027764528681686298, "x1": 0.027764528681686298, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "gray", "dash": "dot", "width": 1 }, "type": "line", "x0": 0.03766637648823722, "x1": 0.03766637648823722, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" } ], "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 2A <-> C (2nd order in A). Concentrations changes (time steps shown in dashed lines)" }, "xaxis": { "anchor": "y", "autorange": true, "domain": [ 0, 1 ], "range": [ -2.7294475716113928e-05, 0.03769367096395334 ], "title": { "text": "SYSTEM TIME" }, "type": "linear" }, "yaxis": { "anchor": "x", "autorange": true, "domain": [ 0, 1 ], "range": [ -1.1183821311376239, 210.58517800690197 ], "title": { "text": "concentration" }, "type": "linear" } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "dynamics.plot_history(colors=['red', 'green'], show_intervals=True,\n", " title=\"Reaction 2A <-> C (2nd order in A). Concentrations changes\")" ] }, { "cell_type": "markdown", "id": "fde6184c-b365-4ef3-aac7-ad7561671f2d", "metadata": {}, "source": [ "### The intersection of the two lines may be found as follows:" ] }, { "cell_type": "code", "execution_count": 20, "id": "e5370c40-4812-4bcd-aac0-949757513454", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Min abs distance found at data row: 60\n" ] }, { "data": { "text/plain": [ "(0.0009423643313311743, 93.33333333333331)" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.curve_intersection('A', 'C', t_start=0, t_end=0.01)" ] }, { "cell_type": "code", "execution_count": null, "id": "f288907f-4305-43c9-80f2-38f35d19fc56", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "5c3f8b4f-3a75-4a21-8579-13550bcebb3c", "metadata": {}, "source": [ "#### For additional diagnostic insight:\n", "`norm_A` and `norm_B` are computed quantities that are used to guide the adaptive time steps" ] }, { "cell_type": "code", "execution_count": 21, "id": "c75e9ff2", "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", "
START_TIMEactionstep_factorcaptiontime_stepDelta ADelta Cnorm_Anorm_B
00.000000ABORT0.50.002000NaNNaNNaNNaN
10.000000ABORT0.50.001000NaNNaNNaNNaN
20.000000ABORT0.6excessive norm value(s)0.000500-119.92000059.9600004494.002000NaN
30.000000ABORT0.6excessive norm value(s)0.000300-71.95200035.9760001617.840720NaN
40.000000ABORT0.6excessive norm value(s)0.000180-43.17120021.585600582.422659NaN
..............................
1150.011873OK (low)1.50.001956-1.4083750.7041880.6198500.097529
1160.013829OK (low)1.50.002934-1.4231940.7115970.6329630.109206
1170.016762OK (low)1.50.004401-1.1962670.5981330.4472040.103047
1180.021163OK (low)1.50.006601-0.7351970.3675980.1689110.070606
1190.027765OK (low)1.50.009902-0.2107180.1053590.0138760.021774
\n", "

120 rows × 9 columns

\n", "
" ], "text/plain": [ " START_TIME action step_factor caption time_step \\\n", "0 0.000000 ABORT 0.5 0.002000 \n", "1 0.000000 ABORT 0.5 0.001000 \n", "2 0.000000 ABORT 0.6 excessive norm value(s) 0.000500 \n", "3 0.000000 ABORT 0.6 excessive norm value(s) 0.000300 \n", "4 0.000000 ABORT 0.6 excessive norm value(s) 0.000180 \n", ".. ... ... ... ... ... \n", "115 0.011873 OK (low) 1.5 0.001956 \n", "116 0.013829 OK (low) 1.5 0.002934 \n", "117 0.016762 OK (low) 1.5 0.004401 \n", "118 0.021163 OK (low) 1.5 0.006601 \n", "119 0.027765 OK (low) 1.5 0.009902 \n", "\n", " Delta A Delta C norm_A norm_B \n", "0 NaN NaN NaN NaN \n", "1 NaN NaN NaN NaN \n", "2 -119.920000 59.960000 4494.002000 NaN \n", "3 -71.952000 35.976000 1617.840720 NaN \n", "4 -43.171200 21.585600 582.422659 NaN \n", ".. ... ... ... ... \n", "115 -1.408375 0.704188 0.619850 0.097529 \n", "116 -1.423194 0.711597 0.632963 0.109206 \n", "117 -1.196267 0.598133 0.447204 0.103047 \n", "118 -0.735197 0.367598 0.168911 0.070606 \n", "119 -0.210718 0.105359 0.013876 0.021774 \n", "\n", "[120 rows x 9 columns]" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dynamics.get_diagnostic_decisions_data()" ] }, { "cell_type": "code", "execution_count": null, "id": "b4226f78-aaad-44dd-9af7-e02df71acef9", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "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 }