Esempio n. 1
0
def getInput(name):
    """
    Returns the RMG input object that corresponds
    to the parameter name.

    First, the module level is queried. If this variable
    is empty, the broadcasted variables are queried.
    """
    global rmg

    if rmg:
        if name == 'speciesConstraints':
            return rmg.speciesConstraints
        elif name == 'quantumMechanics':
            return rmg.quantumMechanics
        else:
            raise Exception('Unrecognized keyword: {}'.format(name))
    else:
        try:
            obj = get(name)
            if obj:
                return obj
            else:
                raise Exception
        except Exception, e:
            logging.debug("Did not find a way to obtain the variable for {}.".format(name))
            raise e
Esempio n. 2
0
def getDB(name):
    """
    Returns the RMG database object that corresponds
    to the parameter name.

    First, the module level is queried. If this variable
    is empty, the broadcasted variables are queried.
    """
    global database

    if database:
        if name == 'kinetics':
            return database.kinetics
        elif name == 'thermo':
            return database.thermo
        elif name == 'transport':
            return database.transport
        elif name == 'solvation':
            return database.solvation
        elif name == 'statmech':
            return database.statmech
        elif name == 'forbidden':
            return database.forbiddenStructures
        else:
            raise Exception('Unrecognized database keyword: {}'.format(name))
    else:
        try:
            db = get(name)
            if db:
                return db
            else:
                raise Exception
        except Exception, e:
            logging.debug("Did not find a way to obtain the broadcasted database for {}.".format(name))
            raise e
Esempio n. 3
0
def retrieveReactions():
    """
    Reactions can be retrieved either through the global variable 'reactions' if parallel computing
    is not used.

    With the use of multiple workers, the reactions are retrieved from the previously broadcasted 
    constant.

    In any case, the references to the original reactions of the reaction model are assumed to be 
    broken.

    """
    global reactions    

    broadcastedReactions = get('reactions')
    if broadcastedReactions:
        reactions = broadcastedReactions
    return reactions
Esempio n. 4
0
def retrieveReactions():
    """
    Reactions can be retrieved either through the global variable 'reactions' if parallel computing
    is not used.

    With the use of multiple workers, the reactions are retrieved from the previously broadcasted 
    constant.

    In any case, the references to the original reactions of the reaction model are assumed to be 
    broken.

    """
    global reactions    

    broadcastedReactions = get('reactions')
    if broadcastedReactions:
        reactions = broadcastedReactions
    return reactions