|
3 | 3 |
|
4 | 4 | """ |
5 | 5 | This script imports an RMG-Java database from the output directory and saves |
6 | | -it in the input directory. |
| 6 | +it in the user-specified database directory. |
| 7 | +
|
| 8 | +The outputDirectory can then be used to overwrite the existing RMG-database files. |
7 | 9 | """ |
8 | 10 |
|
9 | | -import math |
10 | | -import os.path |
11 | | -import sys |
12 | | -import time |
13 | | -import subprocess |
14 | 11 | import os |
| 12 | +import argparse |
15 | 13 |
|
16 | | -from rmgpy.kinetics import KineticsData |
17 | | -from rmgpy.data.kinetics import KineticsDatabase, KineticsGroups |
18 | 14 | from rmgpy.data.rmg import RMGDatabase |
19 | 15 |
|
20 | 16 | ################################################################################ |
21 | 17 |
|
22 | 18 |
|
23 | 19 | if __name__ == '__main__': |
24 | 20 |
|
25 | | - |
26 | | - # Set the import and export paths |
27 | | - oldPath = 'output/RMG_database' |
| 21 | + parser = argparse.ArgumentParser() |
| 22 | + parser.add_argument('inputPath', metavar='INPUT', type=str, nargs=1, |
| 23 | + help='the input path of the RMG-Java database directory') |
| 24 | + parser.add_argument('outputPath', metavar='OUTPUT', type=str, nargs=1, |
| 25 | + help='output path for the desired RMG-Py database directory') |
| 26 | + |
| 27 | + args = parser.parse_args() |
| 28 | + inputPath = args.inputPath[0] |
| 29 | + outputPath = args.outputPath[0] |
| 30 | + |
28 | 31 | newPath = 'input' |
29 | 32 |
|
30 | 33 | print 'Loading old RMG-Java database...' |
31 | 34 | database = RMGDatabase() |
32 | | - database.loadOld(oldPath) |
33 | | - |
| 35 | + database.loadOld(inputPath) |
| 36 | + |
| 37 | + try: |
| 38 | + os.makedirs(outputPath) |
| 39 | + except: |
| 40 | + pass |
| 41 | + |
34 | 42 | print 'Saving the new RMG-Py database...' |
35 | | - database.save(newPath) |
| 43 | + database.save(outputPath) |
36 | 44 | print "Done!" |
0 commit comments