Exemplo n.º 1
0
class Universe:
    """Universe contains all fundamental particles and laws needed to get the universe to spin"""
    def __init__(self):
        self.moelcules = dict()
        cml = Cml.Reactions()
        cml.parse("data/reactions.cml")
        self.reactor = Reactor(cml.reactions)

    def react(self, reactants, effects):
        if len(reactants) < 2:
            return
        temp = 298
        effect_names = list()
        for effect in effects:
            effect_names.append(effect.name)
            if effect.supports("temp"):
                temp = effect.temp
        reaction = self.reactor.react(reactants, temp)

        if reaction == None:
            if Config.current.DEBUG: print("Did not react:", reactants)
            return None
        else:
            if Config.current.DEBUG:
                print(reaction.reactants, "+", effect_names, "->", reaction.products)
            return reaction
Exemplo n.º 2
0
class Universe:
    """Universe contains all fundamental particles and laws needed to get the universe to spin"""
    def __init__(self):
        self.moelcules = dict()
        cml = Cml.Reactions()
        cml.parse("data/reactions.cml")
        self.reactor = Reactor(cml.reactions)

    def react(self, reactants, effects):
        if len(reactants) < 2:
            return
        temp = 298
        effect_names = list()
        for effect in effects:
            effect_names.append(effect.name)
            if effect.supports("temp"):
                temp = effect.temp
        reaction = self.reactor.react(reactants, temp)

        if reaction == None:
            if Config.current.DEBUG: print("Did not react:", reactants)
            return None
        else:
            if Config.current.DEBUG:
                print(reaction.reactants, "+", effect_names, "->",
                      reaction.products)
            return reaction
Exemplo n.º 3
0
def setupSimpleReactor():
    r1 = Cml.Reaction(["H2SO4(aq)", "NaCl(s)", "NaCl(s)"],
                      ["HCl(g)", "HCl(g)", "Na2SO4(s)"])
    r2 = Cml.Reaction(["OH-", "H+"], ["H2O(l)"])
    return Reactor([r1, r2])
Exemplo n.º 4
0
 def __init__(self):
     self.moelcules = dict()
     cml = Cml.Reactions()
     cml.parse("data/reactions.cml")
     self.reactor = Reactor(cml.reactions)
Exemplo n.º 5
0
 def __init__(self):
     self.moelcules = dict()
     cml = Cml.Reactions()
     cml.parse("data/reactions.cml")
     self.reactor = Reactor(cml.reactions)
Exemplo n.º 6
0
 def setupRealReactor(self):
     cml = Cml.Reactions()
     cml.parse("data/reactions.cml")
     reactor = Reactor(cml.reactions)
     return reactor
Exemplo n.º 7
0
 def setupSimpleReactor(self):
     r1 = Cml.Reaction(["O", "H+"], ["OH-(aq)"])
     r2 = Cml.Reaction(["O", "O"], ["O2(g)"])
     return Reactor([r1, r2])