當前位置: 首頁>>代碼示例>>Python>>正文


Python RMGDatabase.statmech方法代碼示例

本文整理匯總了Python中rmgpy.data.rmg.RMGDatabase.statmech方法的典型用法代碼示例。如果您正苦於以下問題:Python RMGDatabase.statmech方法的具體用法?Python RMGDatabase.statmech怎麽用?Python RMGDatabase.statmech使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rmgpy.data.rmg.RMGDatabase的用法示例。


在下文中一共展示了RMGDatabase.statmech方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: loadNecessaryDatabases

# 需要導入模塊: from rmgpy.data.rmg import RMGDatabase [as 別名]
# 或者: from rmgpy.data.rmg.RMGDatabase import statmech [as 別名]
def loadNecessaryDatabases():
    """
    loads transport and statmech databases
    """
    from rmgpy.data.statmech import StatmechDatabase
    from rmgpy.data.transport import TransportDatabase

    #only load if they are not there already.
    try:
        getDB('transport')
        getDB('statmech')
    except DatabaseError:
        logging.info("Databases not found. Making databases")
        db = RMGDatabase()
        db.statmech = StatmechDatabase()
        db.statmech.load(os.path.join(settings['database.directory'],'statmech'))

        db.transport = TransportDatabase()
        db.transport.load(os.path.join(settings['database.directory'],'transport'))
開發者ID:ReactionMechanismGenerator,項目名稱:RMG-Py,代碼行數:21,代碼來源:input.py

示例2: loadDatabase

# 需要導入模塊: from rmgpy.data.rmg import RMGDatabase [as 別名]
# 或者: from rmgpy.data.rmg.RMGDatabase import statmech [as 別名]
def loadDatabase(component='', section=''):
    """
    Load the requested `component` of the RMG database if modified since last loaded.
    """
    global database
    if not database:
        database = RMGDatabase()
        database.solvation = SolvationDatabase()
        database.thermo = ThermoDatabase()
        database.kinetics = KineticsDatabase()
        database.transport = TransportDatabase()
        database.statmech = StatmechDatabase()
        database.loadForbiddenStructures(os.path.join(rmgweb.settings.DATABASE_PATH, 'forbiddenStructures.py'))

    if component == 'initialize':
        return database
    if component in ['thermo', '']:
        if section in ['depository', '']:
            dirpath = os.path.join(rmgweb.settings.DATABASE_PATH, 'thermo', 'depository')
            if isDirModified(dirpath):
                database.thermo.loadDepository(dirpath)
                resetDirTimestamps(dirpath)
        if section in ['libraries', '']:
            dirpath = os.path.join(rmgweb.settings.DATABASE_PATH, 'thermo', 'libraries')
            if isDirModified(dirpath):
                database.thermo.loadLibraries(dirpath)
                # put them in our preferred order, so that when we look up thermo in order to estimate kinetics,
                # we use our favorite values first.
                preferred_order = ['primaryThermoLibrary','DFT_QCI_thermo','GRI-Mech3.0','CBS_QB3_1dHR','KlippensteinH2O2']
                new_order = [i for i in preferred_order if i in database.thermo.libraryOrder]
                for i in database.thermo.libraryOrder:
                    if i not in new_order: new_order.append(i) 
                database.thermo.libraryOrder = new_order
                resetDirTimestamps(dirpath)
        if section in ['groups', '']:
            dirpath = os.path.join(rmgweb.settings.DATABASE_PATH, 'thermo', 'groups')
            if isDirModified(dirpath):
                database.thermo.loadGroups(dirpath)
                resetDirTimestamps(dirpath)  
                              
    if component in ['transport', '']:
        if section in ['libraries', '']:
            dirpath = os.path.join(rmgweb.settings.DATABASE_PATH, 'transport', 'libraries')
            if isDirModified(dirpath):
                database.transport.loadLibraries(dirpath)
                resetDirTimestamps(dirpath)
        if section in ['groups', '']:
            dirpath = os.path.join(rmgweb.settings.DATABASE_PATH, 'transport', 'groups')
            if isDirModified(dirpath):
                database.transport.loadGroups(dirpath)
                resetDirTimestamps(dirpath)
                
    if component in ['solvation', '']:
        dirpath = os.path.join(rmgweb.settings.DATABASE_PATH, 'solvation')
        if isDirModified(dirpath):
            database.solvation.load(dirpath)
            resetDirTimestamps(dirpath)
                
    if component in ['kinetics', '']:
        if section in ['libraries', '']:
            dirpath = os.path.join(rmgweb.settings.DATABASE_PATH, 'kinetics', 'libraries')
            if isDirModified(dirpath):
                database.kinetics.loadLibraries(dirpath)
                resetDirTimestamps(dirpath)
        if section in ['families', '']:
            dirpath = os.path.join(rmgweb.settings.DATABASE_PATH, 'kinetics', 'families')
            if isDirModified(dirpath):
                database.kinetics.loadFamilies(dirpath, families = 'all', depositories = 'all')
                resetDirTimestamps(dirpath)
                
                # Make sure to load the entire thermo database prior to adding training values to the rules
                loadDatabase('thermo','')
                for family in database.kinetics.families.values():
                    oldentries = len(family.rules.entries)
                    family.addKineticsRulesFromTrainingSet(thermoDatabase=database.thermo)
                    newentries = len(family.rules.entries)
                    if newentries != oldentries:
                        print '{0} new entries added to {1} family after adding rules from training set.'.format(newentries-oldentries, family.label)
                    # Filling in rate rules in kinetics families by averaging...
                    family.fillKineticsRulesByAveragingUp()
                    
    if component in ['statmech', '']:
        dirpath = os.path.join(rmgweb.settings.DATABASE_PATH, 'statmech')
        if isDirModified(dirpath):
            database.statmech.load(dirpath)
            resetDirTimestamps(dirpath)

    return database
開發者ID:LifeOfHi,項目名稱:kineticmodelssite,代碼行數:90,代碼來源:tools.py


注:本文中的rmgpy.data.rmg.RMGDatabase.statmech方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。