本文整理汇总了Python中rmgpy.data.rmg.RMGDatabase.kinetics方法的典型用法代码示例。如果您正苦于以下问题:Python RMGDatabase.kinetics方法的具体用法?Python RMGDatabase.kinetics怎么用?Python RMGDatabase.kinetics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rmgpy.data.rmg.RMGDatabase
的用法示例。
在下文中一共展示了RMGDatabase.kinetics方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: convertPrIMe
# 需要导入模块: from rmgpy.data.rmg import RMGDatabase [as 别名]
# 或者: from rmgpy.data.rmg.RMGDatabase import kinetics [as 别名]
def convertPrIMe(family):
print 'Loading kinetics families...'
database = RMGDatabase()
database.kinetics = KineticsDatabase()
database.kinetics.loadFamilies('input/kinetics/families')
database.loadForbiddenStructures('input/forbiddenStructures.py')
for depository in database.kinetics.families[family].depositories:
if depository.label == '{0}/PrIMe'.format(family):
break
else:
raise Exception('Could not find PrIMe depository in {0} family.'.format(family))
entries = []
print 'Determining unique list of reactions...'
for entry0 in depository.entries.values():
for entry in entries:
if entry.item.isIsomorphic(entry0.item):
break
else:
entries.append(entry0)
print 'Found {0:d} unique reactions out of {1:d} entries.'.format(len(entries), len(depository.entries))
print 'Sorting unique reactions...'
entries.sort(key=lambda entry: sum([1 for r in entry.item.reactants for a in r.atoms if a.isNonHydrogen()]))
print 'Saving reactions...'
for index, entry in enumerate(entries):
label = entry.label
reaction = entry.item
# Determine degeneracy in both directions
reactions = database.kinetics.generateReactionsFromFamilies(reaction.reactants, reaction.products, only_families=[family])
if len(reactions) != 1:
print 'Warning: could not determine forward degeneracy for reaction #{0:d}.'.format(index+1)
forwardDegeneracy = 1
else:
forwardDegeneracy = reactions[0].degeneracy
reactions = database.kinetics.generateReactionsFromFamilies(reaction.products, reaction.reactants, only_families=[family])
if len(reactions) != 1:
print 'Warning: could not determine reverse degeneracy for reaction #{0:d}.'.format(index+1)
reverseDegeneracy = 1
else:
reverseDegeneracy = reactions[0].degeneracy
saveReaction('input/kinetics/families/{0}/training/{0}.py'.format(family, index+1), index+1, label, reaction, forwardDegeneracy, reverseDegeneracy)
示例2: loadDatabase
# 需要导入模块: from rmgpy.data.rmg import RMGDatabase [as 别名]
# 或者: from rmgpy.data.rmg.RMGDatabase import kinetics [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.thermo = ThermoDatabase()
database.kinetics = KineticsDatabase()
database.loadForbiddenStructures(os.path.join(settings.DATABASE_PATH, 'forbiddenStructures.py'))
if component in ['thermo', '']:
if section in ['depository', '']:
dirpath = os.path.join(settings.DATABASE_PATH, 'thermo', 'depository')
if isDirModified(dirpath):
database.thermo.loadDepository(dirpath)
resetDirTimestamps(dirpath)
if section in ['libraries', '']:
dirpath = os.path.join(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 favourite 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(settings.DATABASE_PATH, 'thermo', 'groups')
if isDirModified(dirpath):
database.thermo.loadGroups(dirpath)
resetDirTimestamps(dirpath)
if component in ['kinetics', '']:
if section in ['libraries', '']:
dirpath = os.path.join(settings.DATABASE_PATH, 'kinetics', 'libraries')
if isDirModified(dirpath):
database.kinetics.loadLibraries(dirpath)
resetDirTimestamps(dirpath)
if section in ['families', '']:
dirpath = os.path.join(settings.DATABASE_PATH, 'kinetics', 'families')
if isDirModified(dirpath):
database.kinetics.loadFamilies(dirpath)
resetDirTimestamps(dirpath)
return database
示例3: loadDatabase
# 需要导入模块: from rmgpy.data.rmg import RMGDatabase [as 别名]
# 或者: from rmgpy.data.rmg.RMGDatabase import kinetics [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