|
| 1 | +#!/usr/bin/env python |
| 2 | +# encoding: utf-8 |
| 3 | + |
| 4 | +""" |
| 5 | +This script imports an individual RMG-Java themo library from a local directory and saves the output |
| 6 | +thermo library py file into a path of the user's choosing. This library will be automatically |
| 7 | +saved to libraryname.py in the input/thermo/libraries directory and can |
| 8 | +be used directly as an RMG-Py thermo library. |
| 9 | +
|
| 10 | +usage: |
| 11 | +importJavaThermoLibrary.py [-h] INPUT LIBRARYNAME |
| 12 | +
|
| 13 | +positional arguments: |
| 14 | +INPUT the input path of the RMG-Java thermo library directory |
| 15 | +LIBRARYNAME the libraryname for the RMG-Py format thermo library |
| 16 | +
|
| 17 | +""" |
| 18 | + |
| 19 | +import argparse |
| 20 | +import os |
| 21 | +from rmgpy.data.thermo import ThermoLibrary |
| 22 | + |
| 23 | +if __name__ == '__main__': |
| 24 | + |
| 25 | + parser = argparse.ArgumentParser() |
| 26 | + parser.add_argument('inputPath', metavar='INPUT', type=str, nargs=1, |
| 27 | + help='the input path of the RMG-Java thermo library directory') |
| 28 | + parser.add_argument('libraryName', metavar='OUTPUT', type=str, nargs=1, |
| 29 | + help='the libraryName for the RMG-Py format thermo library') |
| 30 | + |
| 31 | + args = parser.parse_args() |
| 32 | + inputPath = args.inputPath[0] |
| 33 | + libraryName = args.libraryName[0] |
| 34 | + |
| 35 | + library = ThermoLibrary() |
| 36 | + library.loadOld( |
| 37 | + dictstr = os.path.join(inputPath, 'Dictionary.txt'), |
| 38 | + treestr = '', |
| 39 | + libstr = os.path.join(inputPath, 'Library.txt'), |
| 40 | + numParameters = 12, |
| 41 | + numLabels = 1, |
| 42 | + pattern = False, |
| 43 | + ) |
| 44 | + library.name = libraryName |
| 45 | + |
| 46 | + # Save in Py format |
| 47 | + library.save(os.path.join('input/thermo/libraries/', libraryName+'.py')) |
0 commit comments