Пример #1
0
# copy of this software and associated documentation files (the 'Software'),  #
# to deal in the Software without restriction, including without limitation   #
# the rights to use, copy, modify, merge, publish, distribute, sublicense,    #
# and/or sell copies of the Software, and to permit persons to whom the       #
# Software is furnished to do so, subject to the following conditions:        #
#                                                                             #
# The above copyright notice and this permission notice shall be included in  #
# all copies or substantial portions of the Software.                         #
#                                                                             #
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  #
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,    #
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING     #
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER         #
# DEALINGS IN THE SOFTWARE.                                                   #
#                                                                             #
###############################################################################
"""
This script machine writes all the families and groups (no libraries) so that RMG-database looks cleaner
and does not have duplicate indexes
"""

from rmgpy import settings
from rmgpy.data.rmg import RMGDatabase

database = RMGDatabase()
database.load(settings['database.directory'], kinetics_families='all')

database.save(settings['database.directory'])
################################################################################


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!"
Пример #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
    
################################################################################

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!"
# to deal in the Software without restriction, including without limitation   #
# the rights to use, copy, modify, merge, publish, distribute, sublicense,    #
# and/or sell copies of the Software, and to permit persons to whom the       #
# Software is furnished to do so, subject to the following conditions:        #
#                                                                             #
# The above copyright notice and this permission notice shall be included in  #
# all copies or substantial portions of the Software.                         #
#                                                                             #
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  #
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,    #
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING     #
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER         #
# DEALINGS IN THE SOFTWARE.                                                   #
#                                                                             #
###############################################################################

"""
This script machine writes all the families and groups (no libraries) so that RMG-database looks cleaner
and does not have duplicate indexes
"""

from rmgpy import settings
from rmgpy.data.rmg import RMGDatabase

database = RMGDatabase()
database.load(settings['database.directory'], kineticsFamilies = 'all')

database.save(settings['database.directory'])
Пример #6
0
                    comment='Fitted from RMG-Java rate rules',
                )
            else:
                entry.data = None

    # Add history item to each entry in each database (saying that JWA added them all!)
    print 'Setting history of all entries in database...'
    event = [time.asctime(),'jwallen','action','jwallen imported this entry from the old RMG database.']
    for depository in database.thermo.depository.values():
        for label, entry in depository.entries.iteritems():
            entry.history.append(event)
    for library in database.thermo.libraries.values():
        for label, entry in library.entries.iteritems():
            entry.history.append(event)
    for groups in database.thermo.groups.values():
        for label, entry in groups.entries.iteritems():
            entry.history.append(event)
    for depository in database.kinetics.depository.values():
        for label, entry in depository.entries.iteritems():
            entry.history.append(event)
    for library in database.kinetics.libraries.values():
        for label, entry in library.entries.iteritems():
            entry.history.append(event)
    for groups in database.kinetics.groups.values():
        for label, entry in groups.entries.iteritems():
            entry.history.append(event)

    # Save the new database
    print 'Saving the new RMG-Py database...'
    database.save(outputDirectory)