コード例 #1
0
################################################################################


if __name__ == '__main__':
    
    parser = argparse.ArgumentParser()
    parser.add_argument('inputPath', metavar='INPUT', type=str, nargs=1,
        help='the input path of the RMG-Java database directory')
    parser.add_argument('outputPath', metavar='OUTPUT', type=str, nargs=1,
        help='output path for the desired RMG-Py database directory')   
    
    args = parser.parse_args()
    inputPath = args.inputPath[0]
    outputPath = args.outputPath[0]
    
    newPath = 'input'
    
    print 'Loading old RMG-Java database...'
    database = RMGDatabase()
    database.loadOld(inputPath)
    
    try:
        os.makedirs(outputPath)
    except:
        pass
    
    print 'Saving the new RMG-Py database...'
    database.save(outputPath)
    print "Done!"
コード例 #2
0
    
################################################################################

if __name__ == '__main__':
    
    #figure out the username
    user = getUsername()    
    # Comment out the line above and uncomment the one below, filling in user information manually if 
    # it cannot be obtained from git or you do not want to extract user info from git.
    # user = "******"        
        

    # Set the import and export paths
    oldPath = 'output/RMG_database'
    newPath = 'input'
    
    print 'Loading old RMG-Java database...'
    database = RMGDatabase()
    database.loadOld(oldPath)
    
    print 'Loading the current database to look for changes...'
    current_database = RMGDatabase()
    current_database.load(newPath)
    
    print 'Setting history of all entries in database...'
    setHistory(database, current_database, user=user)
      
    print 'Saving the new RMG-Py database...'
    database.save(newPath)
    print "Done!"
コード例 #3
0
        for label, entry in library.entries.iteritems():
            entry.history.append(event)
    
    groups = database.states.groups
    for label, entry in groups.entries.iteritems():
        entry.history.append(event)
    
    for label, entry in database.forbiddenStructures.entries.iteritems():
        entry.history.append(event)
    
################################################################################

if __name__ == '__main__':
    
    #figure out the username
    user = getUsername()

    # Set the import and export paths
    oldPath = 'output/RMG_database'
    newPath = 'input'
    
    print 'Loading old RMG-Java database...'
    database = RMGDatabase()
    database.loadOld(oldPath)
    
    print 'Setting history of all entries in database...'
    setHistory(database, user=user)
      
    print 'Saving the new RMG-Py database...'
    database.save(newPath)
コード例 #4
0
ファイル: importOldDatabase.py プロジェクト: ajalan/RMG-Py
    return groupValues, groupUncertainties

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

if __name__ == '__main__':

    # Parse the command-line arguments
    args = parseCommandLineArguments()
    inputDirectory = os.path.abspath(args.input[0])
    outputDirectory = os.path.abspath(args.output[0])
    
    # Load the old RMG-Java database
    print 'Loading old RMG-Java database...'
    database = RMGDatabase()
    database.loadOld(inputDirectory)

    # Generate kinetics group additivity values from old rate rules
    print 'Generating kinetics group additivity values...'
    Tdata = [300,400,500,600,800,1000,1500,2000]
    for familyLabel, family in database.kinetics.groups.iteritems():
        print '    %s...' % (familyLabel)

        # Determine units of generated rate coefficients
        numReactants = len(family.forwardTemplate.reactants)
        if numReactants == 1:
            kunits = 's^-1'
        elif numReactants == 2:
            kunits = 'm^3/(mol*s)'
        else:
            raise Exception("Unexpected number of reactants %i in forward template of reaction family %s." % (numReactants, familyLabel))