CAOS - Computer Assisted Organic Synthesis (in Python!)

Build status Coverage Status Documentation Status

CAOS is a useful tool for many organic chemists, but is often a hard one to use in practice. This library will seek to provide an easy method of predicting reactions.

Documentation

Is available at readthedocs.org.

Examples

Simple reactions can be performed in this way

from CAOS.dispatch import react
from CAOS.structures.molecule import Molecule

acid = Molecule(
    {'a1': 'H', 'a2': 'H', 'a3': 'H', 'a4': 'O'},
    {'b1': {'nodes': ('a1', 'a4'), 'order': 1},
     'b2': {'nodes': ('a2', 'a4'), 'order': 1},
     'b3': {'nodes': ('a3', 'a4'), 'order': 1}
    },
    **{'id': 'Hydronium'}
)

base = Molecule(
    {'a1': 'H', 'a2': 'O'},
    {'b1': {'nodes': ('a1', 'a2'), 'order': 1}},
    **{'id': 'Hydroxide'}
)

conditions = {
    'pkas': {'Hydronium': -1.74, 'Hydroxide': 15.7},
    'pka_points': {'Hydronium': 'a1', 'Hydroxide': 'a2'}
}

products = react([acid, base], conditions)

In this case, based on the information in the molecules and the conditions, the system will predict an acid base reaction that results in the creation of two water molecules and no salt.

Additionally, user-defined reaction mechanisms can be added to the system.

# aqueous_mechanism.py
from CAOS.dispatch import register_reaction_mechanism

def aqueous(reactants, conditions):
    return conditions.get('aqeuous', False)

@register_reaction_mechanism([aqueous])
def some_mechanism(reactants, conditions):
    # do something
    return products

# reaction.py
import aqueous_mechanism
from CAOS.dispatch import react
from CAOS.structures.molecule import Molecule

m1 = Molecule(...)
m2 = Molecule(...)
conditions = {'aqueous': True}

products = react([m1, m2], conditions)

Here the system would use the aqueous mechanism that you have defined, because the conditions match the aqueous requirement the mechanism was decorated with.

The system is under active development, and the goal is to eventually take as much of the work out of the hands of the user.

Todos:

  • [X] Add CI
  • [X] Add reaction registration and dispatch
  • [ ] Add loading molecules
  • [X] Add molecule inspection
  • [ ] Add common requirements functions
  • [ ] ???

CAOS is still in early stages of development. Information will be added as it becomes available.

Motivation

This is a project for my Fall 2015 DSLs class. It is loosely based off of a previous project however with the intent of being more modular, extensible, and language-like.

Licensing

CAOS is licensed using the MIT License.

The MIT License (MIT)

Copyright (c) 2015 Dan Obermiller

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Indices and tables