Skip to main content

Simulate reactions from proposed steps/mechanisms

Project description

logo


Reaction Mechanizer

Tests

Reaction Mechanizer is a Python tool that can be used to simulate chemical reactions.

Table of Contents

  1. Theory
  2. Documentation
  3. Requirements
  4. Installation
  5. Usage

Theory

The rates at which steps in a reaction occur are governed by differential equations. For example, consider the equilibrium step:

A+B<--->C+D

Without loss of generality, if we focus solely on species C, notice that the rate of production of C is jointly proportional to the concentrations of A and B (more likely for the forward reaction to go through as the amount of interactions increase). However, the rate is also dictated by the reverse reaction, which is proportional to the interactions between C and D. So, the overall rate law for C is:

dC/dt=k1*A*B - k2*C*D

A system of ODEs can be built for any step, and any full mechanism (a combination of steps).

Documentation

Compiled documentation for this whole package is hosted here.

Requirements

Reaction Mechanizer requires Python 3.8 in addition to the following libraries:

  • matplotlib
  • seaborn
  • scipy
  • pandas
  • numpy

Specific version requirements are in requirements.txt

Installation

This version is a pre-release, so Reaction Mechanizer can only be manually installed from source.

git clone https://github.com/ArmaanAhmed22/ReactionMechanizer.git && cd ReactionMechanizer && pip install .

Usage

Reaction Mechanizer can either simulate a SimpleStep or a ReactionMechanism. Either can be created from a string:

from reaction_mechanism.pathway.reaction import SimpleStep, ReactionMechanism

ss = SimpleStep.str_to_step("2A+1/2B->1/3C+D")

rm = ReactionMechanism.str_to_mechanism(
"""A->X+Y
X->Z
Z+Y->B"""
)

From an initial state, the step/mechanism progression can be seen using the ReactionVisualizer class as follows:

from reaction_mechanism.drawing.mechanism_reaction_visualizer import ReactionVisualizer, ReactionEvent
vis = ReactionVisualizer(rm)  #or ReactionVisualizer(ss)
dataframe = vis.progress_reaction({"A": 1, "X": 0, "Y":0, "Z": 0, "B":0.1}, 1000, 5000, events=[(200, ReactionEvent.CHANGE_CONCENTRATION, ("A", 1))], out = "out.png")
"""Arguments:
1) initial state of species
2) time
3) granularity (how many times to evaluate the differential equations to derive our answer)
4) [optional] any events (ie adding certain species) that occur in the middle of the reaction (here, at time=200, with an increase of concentration of 1 for "A")
5) Where to save output file"""

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ReactionMechanizer-1.0.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ReactionMechanizer-1.0.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file ReactionMechanizer-1.0.0.tar.gz.

File metadata

  • Download URL: ReactionMechanizer-1.0.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for ReactionMechanizer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f52e96bec419433d62872e9f8b223e6d7ad0b88c6daf389aeb44b145a3f60079
MD5 16ab36c110a3c9e94b80981a20596d79
BLAKE2b-256 ef683195ca9e8660b535a60adda50a67225e9f07e3eb4101c62ca23e7dad7304

See more details on using hashes here.

File details

Details for the file ReactionMechanizer-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ReactionMechanizer-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for ReactionMechanizer-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b87e03b42f333e5ed46a8f1fad211dac3f5532806f20743f170039efb206d0d4
MD5 bd6fa21e4ac07d366dbc74ab9fe8d243
BLAKE2b-256 3ab50845999191161b4f2268d196e7531fb3f3bcf4fe1ccb4ba61ae8dc7972c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page