Exemplo n.º 1
0
import time
import math
import numpy
import pylab
import scipy.stats
import matplotlib
matplotlib.rc('mathtext', fontset='stixsans', default='regular')
import re
import rmgpy
from rmgpy.quantity import constants
from rmgpy.kinetics import Arrhenius, ArrheniusEP, KineticsData
from rmgpy.data.base import getAllCombinations
from rmgpy.species import Species

from importOldDatabase import getUsername
user = getUsername()

################################################################################

def loadDatabase():
    print 'Loading RMG database...'
    from rmgpy.data.rmg import RMGDatabase
    database = RMGDatabase()
    database.load('input')
    return database

def convertKineticsToPerSiteBasis(kinetics, degeneracy):
    """
    Given high-pressure-limit `kinetics` which includes reaction-path
    `degeneracy`, convert the kinetics to be on a per-site basis.
    """
        nargs=1,
        help='the input path of the RMG-Java kinetics library directory')
    parser.add_argument(
        'outputPath',
        metavar='OUTPUT',
        type=str,
        nargs=1,
        help=
        'the libraryname.py output file for the RMG-Py format kinetics library'
    )

    args = parser.parse_args()
    inputPath = args.inputPath[0]
    outputPath = args.outputPath[0]

    library = KineticsLibrary()
    library.loadOld(inputPath)

    # Assign history to entries
    user = getUsername()  # Pulls username from current git repository
    #user = '******'.format(name, email)   # If not in git repository, then enter user information manually
    event = [
        time.asctime(), user, 'action',
        '{0} imported this entry from the old RMG database.'.format(user)
    ]
    for label, entry in library.entries.iteritems():
        entry.history.append(event)

    # Save in Py format
    library.save(outputPath)
Exemplo n.º 3
0
    kineticsLibrary = KineticsLibrary()
    kineticsLibrary.entries = {}
    for i in range(len(reactionList)):
        reaction = reactionList[i]        
        entry = Entry(
                index = i+1,
                item = reaction,
                data = reaction.kinetics,
            )
        entry.longDesc = reaction.kinetics.comment
        kineticsLibrary.entries[i+1] = entry
    
    kineticsLibrary.checkForDuplicates()
    kineticsLibrary.convertDuplicatesToMulti()
        
    # Assign history to all entries
    user = getUsername()    # Pulls username from current git repository
    #user = '******'.format(name, email)   # If not in git repository, then enter user information manually
    event = [time.asctime(),user,'action','{0} imported this entry from the old RMG database.'.format(user)]
    for label, entry in thermoLibrary.entries.iteritems():
        entry.history.append(event)
    for label, entry in kineticsLibrary.entries.iteritems():
        entry.history.append(event)
        
    # Save in Py format
    if not os.path.exists(outputDir):
        os.makedirs(os.path.join(self.path))
    
    thermoLibrary.save(os.path.join(outputDir, 'chemkinThermoLibrary.py'), removeH=removeH)
    kineticsLibrary.save(os.path.join(outputDir, 'chemkinKineticsLibrary.py'), removeH=removeH)
Exemplo n.º 4
0
import os.path
import time
import math
import numpy
import pylab
import scipy.stats
import matplotlib
matplotlib.rc('mathtext', fontset='stixsans', default='regular')
import re
import rmgpy
from rmgpy.quantity import constants
from rmgpy.kinetics import Arrhenius, ArrheniusEP, KineticsData
from rmgpy.data.base import getAllCombinations

from importOldDatabase import getUsername
user = getUsername()

################################################################################

def loadDatabase():
    print 'Loading RMG database...'
    from rmgpy.data.rmg import RMGDatabase
    database = RMGDatabase()
    database.load('input')
    return database

def getRateCoefficientUnits(family):
    """
    For the given reaction `family`, return the units of its forward kinetics.
    This is hardcoding of reaction families, but at least it will fail loudly
    if it encounters an unexpected family.