Beispiel #1
0
    for i in range(len(reactionList)):
        reaction = reactionList[i]        
        entry = Entry(
                index = i+1,
                label = str(reaction),
                item = reaction,
                data = reaction.kinetics,
            )
        try:
    	    entry.longDesc = 'Originally from reaction library: ' + reaction.library + "\n" + reaction.kinetics.comment
	except AttributeError:
    	    entry.longDesc = reaction.kinetics.comment
        kineticsLibrary.entries[i+1] = entry
    
    # Mark as duplicates where there are mixed pressure dependent and non-pressure dependent duplicate kinetics
    # Even though CHEMKIN does not require a duplicate flag, RMG needs it.
    # Using flag markDuplicates = True
    kineticsLibrary.checkForDuplicates(markDuplicates=True)
    kineticsLibrary.convertDuplicatesToMulti()

    # Save in Py format
    databaseDirectory = settings['database.directory']
    try:
        os.makedirs(os.path.join(databaseDirectory, 'kinetics', 'libraries',name))
    except:
        pass
    
    thermoLibrary.save(os.path.join(databaseDirectory, 'thermo' ,'libraries', name + '.py'))
    kineticsLibrary.save(os.path.join(databaseDirectory, 'kinetics', 'libraries', name, 'reactions.py'))
    kineticsLibrary.saveDictionary(os.path.join(databaseDirectory, 'kinetics', 'libraries', name, 'dictionary.txt'))
         logging.warning('Species {0} did not contain any thermo data and was omitted from the thermo library.'.format(str(species)))
                     
 # load kinetics library entries                    
 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))
 
Beispiel #3
0
                .format(str(species)))

    # load kinetics library entries
    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