Example #1
0
 def conditions(self, cond):
     if isinstance(cond, dict):
         self.conditions = Conditions(cond)
     elif isinstance(cond, Conditions):
         self._conditions = cond
     else:
         raise TypeError("Conditions must be a Conditions object")
Example #2
0
    def setUp(self):
        self.compound1 = compounds.Compound({
            "a1": "H",
            "a2": "O"
        }, {"b1": ("a1", "a2", {
            'order': 1,
            'chirality': None
        })}, {"id": "Hydroxide"})
        self.compound2 = compounds.Compound(
            {
                "a1": "H",
                "a2": "H",
                "a3": "O",
                "a4": "H"
            }, {
                "b1": ("a1", "a3", {
                    'order': 1,
                    'chirality': None
                }),
                "b2": ("a2", "a3", {
                    'order': 1,
                    'chirality': None
                }),
                "b3": ("a3", "a4", {
                    'order': 1,
                    'chirality': None
                })
            }, {"id": "Hydronium"})

        self.acid1 = Acid(self.compound2, 'a1', -1.74)
        self.base1 = Base(self.compound1, 'a2', 15.7)
        self.conditions1 = Conditions({})
        self.acidbase1 = AcidBase(self.acid1, self.base1, self.conditions1)
Example #3
0
    def setUp(self):
        self.compound1 = Compound({
            "a1": "H",
            "a2": "O"
        }, {"b1": ("a1", "a2", {
            'order': 1,
            'chirality': None
        })}, {"id": "Hydroxide"})
        self.compound2 = Compound({
            "a1": "H",
            "a2": "H",
            "a3": "O",
            "a4": "H"
        }, {
            "b1": ("a1", "a3", {
                'order': 1,
                'chirality': None
            }),
            "b2": ("a2", "a3", {
                'order': 1,
                'chirality': None
            }),
            "b3": ("a3", "a4", {
                'order': 1,
                'chirality': None
            })
        }, {"id": "Hydronium"})
        self.compound3 = Compound({
            'a1': 'H',
            'a2': 'O',
            'a3': 'H'
        }, {
            'b1': ('a1', 'a2', {
                'order': 1,
                'chirality': None
            }),
            'b2': ('a2', 'a3', {
                'order': 1,
                'chirality': None
            })
        }, {'id': "Water"})

        self.acid = Acid(self.compound2, 'a1', -1.74)
        self.base = Base(self.compound1, 'a2', 16)
        self.conj_acid = Acid(self.compound3, 'a3', 16)
        self.conditions = Conditions({})
Example #4
0
def build_reaction_conditions(molecules, solvent, **kwargs):
    """Generates a Conditions object based on various factors.

    Parameters
    ----------
    molecules : list
        A list of molecules present in the reaction.  Each of these should
        already have pertinent information, if possible.
    solvent : Solvent
        The solvent in the reaction.  Should have information such as type of
        solvent, pka, concentration, etc.

    Returns
    -------
    cond : Conditions
        The reaction conditions.
    """

    cond_dict = {'molecules': molecules, 'solvent': solvent}
    cond_dict.update(kwargs)
    cond = Conditions(cond_dict)
    return cond
Example #5
0
    def generate_conditions(self):
        """Generates the reaction conditions"""

        self.conditions = Conditions({})
        print self.conditions
Example #6
0
    def setUp(self):
        self.compound1 = compounds.Compound({
            "a1": "H",
            "a2": "H",
            "a3": "O"
        }, {
            "b1": ("a1", "a3", {
                'order': 1,
                'chirality': None
            }),
            "b2": ("a2", "a3", {
                'order': 1,
                'chirality': None
            })
        }, {"id": "Water"})
        self.compound2 = compounds.Compound(
            {
                "a1": "H",
                "a2": "H",
                "a3": "O",
                "a4": "H"
            }, {
                "b1": ("a1", "a3", {
                    'order': 1,
                    'chirality': None
                }),
                "b2": ("a2", "a3", {
                    'order': 1,
                    'chirality': None
                }),
                "b3": ("a3", "a4", {
                    'order': 1,
                    'chirality': None
                })
            }, {"id": "Hydronium"})
        self.acid1 = Acid(self.compound2, 'a1', -1.74)
        self.base1 = Base(self.compound1, 'a2', -1.74)
        self.conditions1 = Conditions({})
        self.acidbase1 = AcidBase(self.acid1, self.base1, self.conditions1)

        self.hydroiodic = Acid(
            compounds.Compound({
                "a1": "H",
                "a2": "I"
            }, {"b1": ("a1", "a2", {
                'order': 1,
                'chirality': None
            })}, {"id": "Hydroiodic acid"}), 'a1', -10)
        self.conditions2 = Conditions({
            'pka': -10,
            'acidic': True,
            'pka_molecule': self.hydroiodic,
            'pka_location': 'a1'
        })
        self.acidbase2 = AcidBase(self.acid1, self.base1, self.conditions2)

        self.hydroxide = Base(
            compounds.Compound({
                "a1": "H",
                "a2": "O",
                "a3": "Na"
            }, {
                "b1": ("a1", "a2", {
                    'order': 1,
                    'chirality': None
                }),
                "b2": ("a2", "a3", {
                    'order': 1,
                    'chirality': None
                })
            }, {"id": "Sodium Hydroxide"}), 'a2', 15.7)
        self.conditions3 = Conditions({
            'pka': 15.7,
            'basic': True,
            'pka_molecule': self.hydroxide,
            'pka_location': 'a2'
        })
        self.acidbase3 = AcidBase(self.acid1, self.base1, self.conditions3)