コード例 #1
0
ファイル: nasaTest.py プロジェクト: yplitw/RMG-Py
 def setUp(self):
     """
     A function run before each unit test in this class.
     """
     self.coeffs_low = [
         4.03055, -0.00214171, 4.90611e-05, -5.99027e-08, 2.38945e-11,
         -11257.6, 3.5613
     ]
     self.coeffs_high = [
         -0.307954, 0.0245269, -1.2413e-05, 3.07724e-09, -3.01467e-13,
         -10693, 22.628
     ]
     self.Tmin = 300.
     self.Tmax = 3000.
     self.Tint = 650.73
     self.E0 = -782292.  # J/mol.
     self.comment = "C2H6"
     self.nasa = NASA(
         polynomials=[
             NASAPolynomial(coeffs=self.coeffs_low,
                            Tmin=(self.Tmin, "K"),
                            Tmax=(self.Tint, "K")),
             NASAPolynomial(coeffs=self.coeffs_high,
                            Tmin=(self.Tint, "K"),
                            Tmax=(self.Tmax, "K")),
         ],
         Tmin=(self.Tmin, "K"),
         Tmax=(self.Tmax, "K"),
         E0=(self.E0, "J/mol"),
         comment=self.comment,
     )
コード例 #2
0
ファイル: inputTest.py プロジェクト: shihchengli/RMG-Py
 def test_species_atomic_nasa_polynomial(self):
     """
     Test loading a atom with NASA polynomials
     """
     label0 = "H(1)"
     kwargs = {
         "structure":
         SMILES('[H]'),
         "thermo":
         NASA(polynomials=[
             NASAPolynomial(coeffs=[2.5, 0, 0, 0, 0, 25473.7, -0.446683],
                            Tmin=(200, 'K'),
                            Tmax=(1000, 'K')),
             NASAPolynomial(coeffs=[2.5, 0, 0, 0, 0, 25473.7, -0.446683],
                            Tmin=(1000, 'K'),
                            Tmax=(6000, 'K'))
         ],
              Tmin=(200, 'K'),
              Tmax=(6000, 'K'),
              comment="""Thermo library: FFCM1(-)"""),
         "energyTransferModel":
         SingleExponentialDown(alpha0=(3.5886, 'kJ/mol'),
                               T0=(300, 'K'),
                               n=0.85)
     }
     spc0 = species(label0, **kwargs)
     self.assertEqual(spc0.label, label0)
     self.assertEqual(spc0.smiles, '[H]')
     self.assertTrue(spc0.has_statmech())
     self.assertEqual(spc0.thermo, kwargs['thermo'])
コード例 #3
0
ファイル: inputTest.py プロジェクト: shihchengli/RMG-Py
 def test_species_polyatomic_nasa_polynomial(self):
     """
     Test loading a species with NASA polynomials
     """
     label0 = "benzyl"
     kwargs = {
         "structure":
         SMILES('[c]1ccccc1'),
         "thermo":
         NASA(polynomials=[
             NASAPolynomial(coeffs=[
                 2.78632, 0.00784632, 7.97887e-05, -1.11617e-07,
                 4.39429e-11, 39695, 11.5114
             ],
                            Tmin=(100, 'K'),
                            Tmax=(943.73, 'K')),
             NASAPolynomial(coeffs=[
                 13.2455, 0.0115667, -2.49996e-06, 4.66496e-10,
                 -4.12376e-14, 35581.1, -49.6793
             ],
                            Tmin=(943.73, 'K'),
                            Tmax=(5000, 'K'))
         ],
              Tmin=(100, 'K'),
              Tmax=(5000, 'K'),
              comment="""Thermo library: Fulvene_H + radical(CbJ)"""),
         "energyTransferModel":
         SingleExponentialDown(alpha0=(3.5886, 'kJ/mol'),
                               T0=(300, 'K'),
                               n=0.85)
     }
     spc0 = species(label0, **kwargs)
     self.assertEqual(spc0.label, label0)
     self.assertTrue(spc0.has_statmech())
     self.assertEqual(spc0.thermo, kwargs['thermo'])
コード例 #4
0
    def test_generate_isotopomers(self):
        """
        Test that the generation of isotopomers with N isotopes works.
        """
        from rmgpy.thermo.nasa import NASAPolynomial, NASA

        spc = Species().from_smiles('CC')

        polynomial = NASAPolynomial(coeffs=[1., 1., 1., 1., 1., 1., 1.],
                                    Tmin=(200, 'K'), Tmax=(1600, 'K'), E0=(1., 'kJ/mol'),
                                    comment='made up thermo')

        spc.thermo = NASA(polynomials=[polynomial], Tmin=(200, 'K'),
                          Tmax=(1600, 'K'), E0=(1., 'kJ/mol'),
                          comment='made up thermo')

        spcs = generate_isotopomers(spc, 0)
        self.assertEquals(len(spcs), 0)

        spcs = generate_isotopomers(spc)
        self.assertEquals(len(spcs), 1)

        spcs = generate_isotopomers(spc, 2)
        self.assertEquals(len(spcs), 2)

        spcs = generate_isotopomers(spc, 3)
        self.assertEquals(len(spcs), 2)
コード例 #5
0
    def test_correct_entropy(self):
        """
        Tests that correctEntropy effectively makes the isotopomer have the same
        thermo as isotopeless with the change in entropy corresponding to the
        symmetry difference.

        This example compares propane to a asymmetrically labeled propane.
        """
        from rmgpy.thermo.nasa import NASA, NASAPolynomial
        from copy import deepcopy
        from rmgpy import constants
        propanei = Species().from_adjacency_list("""
1  C u0 p0 c0 {2,S} {4,S} {5,S} {6,S}
2  C u0 p0 c0 {1,S} {3,S} {7,S} {8,S}
3  C u0 p0 c0 i13 {2,S} {9,S} {10,S} {11,S}
4  H u0 p0 c0 {1,S}
5  H u0 p0 c0 {1,S}
6  H u0 p0 c0 {1,S}
7  H u0 p0 c0 {2,S}
8  H u0 p0 c0 {2,S}
9  H u0 p0 c0 {3,S}
10 H u0 p0 c0 {3,S}
11 H u0 p0 c0 {3,S}
""")
        propane = Species().from_adjacency_list("""
1  C u0 p0 c0 {2,S} {4,S} {5,S} {6,S}
2  C u0 p0 c0 {1,S} {3,S} {7,S} {8,S}
3  C u0 p0 c0 {2,S} {9,S} {10,S} {11,S}
4  H u0 p0 c0 {1,S}
5  H u0 p0 c0 {1,S}
6  H u0 p0 c0 {1,S}
7  H u0 p0 c0 {2,S}
8  H u0 p0 c0 {2,S}
9  H u0 p0 c0 {3,S}
10 H u0 p0 c0 {3,S}
11 H u0 p0 c0 {3,S}
""")

        # get thermo of propane
        original_thermo = NASA(polynomials=[NASAPolynomial(
            coeffs=[1.10564, 0.0315339, -1.48274e-05, 3.39621e-09, -2.97953e-13, -14351.9, 18.775],
            Tmin=(100, 'K'), Tmax=(3370.6, 'K')), NASAPolynomial(
            coeffs=[-1.45473, 0.0241202, -6.87667e-06, 9.03634e-10, -4.48389e-14, -6688.59, 43.0459],
            Tmin=(3370.6, 'K'), Tmax=(5000, 'K'))], Tmin=(100, 'K'), Tmax=(5000, 'K'),
            comment="""Thermo group additivity estimation: group(Cs-CsCsHH) + gauche(Cs(CsCsRR)) + other(R) + group(Cs-CsHHH) + gauche(Cs(Cs(CsRR)RRR)) + other(R) + group(Cs-CsHHH) + gauche(Cs(Cs(CsRR)RRR)) + other(R)""")
        propane.thermo = deepcopy(original_thermo)
        propanei.thermo = deepcopy(original_thermo)

        correct_entropy(propanei, propane)

        self.assertAlmostEqual(propane.get_enthalpy(298), propanei.get_enthalpy(298))
        self.assertAlmostEqual(propanei.get_entropy(298) - propane.get_entropy(298), constants.R * np.log(2))
コード例 #6
0
 def test_nasa_as_dict_minimal(self):
     """
     Test that NASA.as_dict does not contain empty, optional attributes
     """
     nasa_dict = NASA().as_dict()
     keys = list(nasa_dict.keys())
     self.assertNotIn('Tmin', keys)
     self.assertNotIn('Tmax', keys)
     self.assertNotIn('E0', keys)
     self.assertNotIn('Cp0', keys)
     self.assertNotIn('CpInf', keys)
     self.assertNotIn('label', keys)
     self.assertNotIn('comment', keys)
 def setUp(self):
     """
     A function run before each unit test in this class.
     """
     octyl_pri = Species(label="", thermo=NASA(polynomials=[
         NASAPolynomial(coeffs=[-0.772759,0.093255,-5.84447e-05,1.8557e-08,-2.37127e-12,-3926.9,37.6131], Tmin=(298,'K'), Tmax=(1390,'K')),
         NASAPolynomial(coeffs=[25.051,0.036948,-1.25765e-05,1.94628e-09,-1.12669e-13,-13330.1,-102.557], Tmin=(1390,'K'), Tmax=(5000,'K'))
         ],
         Tmin=(298,'K'), Tmax=(5000,'K'), Cp0=(33.2579,'J/(mol*K)'), CpInf=(577.856,'J/(mol*K)'),
         comment="""Thermo library: JetSurF0.2"""), molecule=[Molecule(SMILES="[CH2]CCCCCCC")])
     octyl_sec = Species(label="", thermo=NASA(polynomials=[
         NASAPolynomial(coeffs=[-0.304233,0.0880077,-4.90743e-05,1.21858e-08,-8.87773e-13,-5237.93,36.6583], Tmin=(298,'K'), Tmax=(1383,'K')),
         NASAPolynomial(coeffs=[24.9044,0.0366394,-1.2385e-05,1.90835e-09,-1.10161e-13,-14713.5,-101.345], Tmin=(1383,'K'), Tmax=(5000,'K'))
         ],
         Tmin=(298,'K'), Tmax=(5000,'K'), Cp0=(33.2579,'J/(mol*K)'), CpInf=(577.856,'J/(mol*K)'),
         comment="""Thermo library: JetSurF0.2"""), molecule=[Molecule(SMILES="CC[CH]CCCCC")])
     ethane = Species(label="", thermo=ThermoData(
         Tdata=([300,400,500,600,800,1000,1500],'K'), Cpdata=([10.294,12.643,14.933,16.932,20.033,22.438,26.281],'cal/(mol*K)'), H298=(12.549,'kcal/mol'), S298=(52.379,'cal/(mol*K)'),
         Cp0=(33.2579,'J/(mol*K)'), CpInf=(133.032,'J/(mol*K)'), comment="""Thermo library: CH"""),
         molecule=[Molecule(SMILES="C=C")])
     decyl = Species(label="", thermo=NASA(polynomials=[
         NASAPolynomial(coeffs=[-1.31358,0.117973,-7.51843e-05,2.43331e-08,-3.17523e-12,-9689.68,43.501], Tmin=(298,'K'), Tmax=(1390,'K')),
         NASAPolynomial(coeffs=[31.5697,0.0455818,-1.54995e-05,2.39711e-09,-1.3871e-13,-21573.8,-134.709], Tmin=(1390,'K'), Tmax=(5000,'K'))
         ],
         Tmin=(298,'K'), Tmax=(5000,'K'), Cp0=(33.2579,'J/(mol*K)'), CpInf=(719.202,'J/(mol*K)'),
         comment="""Thermo library: JetSurF0.2"""), molecule=[Molecule(SMILES="[CH2]CCCCCCCCC")])
     self.database = SolvationDatabase()
     self.database.load(os.path.join(settings['database.directory'], 'solvation'))
     self.solvent = 'octane'
     diffusionLimiter.enable(self.database.getSolventData(self.solvent), self.database)
     self.T = 298
     self.uni_reaction = Reaction(reactants=[octyl_pri], products=[octyl_sec])
     self.uni_reaction.kinetics = Arrhenius(A=(2.0, '1/s'), n=0, Ea=(0,'kJ/mol'))
     self.bi_uni_reaction = Reaction(reactants=[octyl_pri, ethane], products=[decyl])
     self.bi_uni_reaction.kinetics = Arrhenius(A=(1.0E-22, 'cm^3/molecule/s'), n=0, Ea=(0,'kJ/mol'))
     self.intrinsic_rates = {
         self.uni_reaction: self.uni_reaction.kinetics.getRateCoefficient(self.T, P=100e5),
         self.bi_uni_reaction: self.bi_uni_reaction.kinetics.getRateCoefficient(self.T, P=100e5),
         }
コード例 #8
0
 def setUp(self):
     """
     A function run before each unit test in this class.
     """
     octyl_pri = Species(
         label="",
         thermo=NASA(polynomials=[
             NASAPolynomial(coeffs=[
                 -0.772759, 0.093255, -5.84447e-05, 1.8557e-08,
                 -2.37127e-12, -3926.9, 37.6131
             ],
                            Tmin=(298, 'K'),
                            Tmax=(1390, 'K')),
             NASAPolynomial(coeffs=[
                 25.051, 0.036948, -1.25765e-05, 1.94628e-09, -1.12669e-13,
                 -13330.1, -102.557
             ],
                            Tmin=(1390, 'K'),
                            Tmax=(5000, 'K'))
         ],
                     Tmin=(298, 'K'),
                     Tmax=(5000, 'K'),
                     Cp0=(33.2579, 'J/(mol*K)'),
                     CpInf=(577.856, 'J/(mol*K)'),
                     comment="""Thermo library: JetSurF0.2"""),
         molecule=[Molecule(SMILES="[CH2]CCCCCCC")])
     octyl_sec = Species(
         label="",
         thermo=NASA(polynomials=[
             NASAPolynomial(coeffs=[
                 -0.304233, 0.0880077, -4.90743e-05, 1.21858e-08,
                 -8.87773e-13, -5237.93, 36.6583
             ],
                            Tmin=(298, 'K'),
                            Tmax=(1383, 'K')),
             NASAPolynomial(coeffs=[
                 24.9044, 0.0366394, -1.2385e-05, 1.90835e-09, -1.10161e-13,
                 -14713.5, -101.345
             ],
                            Tmin=(1383, 'K'),
                            Tmax=(5000, 'K'))
         ],
                     Tmin=(298, 'K'),
                     Tmax=(5000, 'K'),
                     Cp0=(33.2579, 'J/(mol*K)'),
                     CpInf=(577.856, 'J/(mol*K)'),
                     comment="""Thermo library: JetSurF0.2"""),
         molecule=[Molecule(SMILES="CC[CH]CCCCC")])
     ethane = Species(label="",
                      thermo=ThermoData(
                          Tdata=([300, 400, 500, 600, 800, 1000,
                                  1500], 'K'),
                          Cpdata=([
                              10.294, 12.643, 14.933, 16.932, 20.033,
                              22.438, 26.281
                          ], 'cal/(mol*K)'),
                          H298=(12.549, 'kcal/mol'),
                          S298=(52.379, 'cal/(mol*K)'),
                          Cp0=(33.2579, 'J/(mol*K)'),
                          CpInf=(133.032, 'J/(mol*K)'),
                          comment="""Thermo library: CH"""),
                      molecule=[Molecule(SMILES="C=C")])
     decyl = Species(label="",
                     thermo=NASA(polynomials=[
                         NASAPolynomial(coeffs=[
                             -1.31358, 0.117973, -7.51843e-05, 2.43331e-08,
                             -3.17523e-12, -9689.68, 43.501
                         ],
                                        Tmin=(298, 'K'),
                                        Tmax=(1390, 'K')),
                         NASAPolynomial(coeffs=[
                             31.5697, 0.0455818, -1.54995e-05, 2.39711e-09,
                             -1.3871e-13, -21573.8, -134.709
                         ],
                                        Tmin=(1390, 'K'),
                                        Tmax=(5000, 'K'))
                     ],
                                 Tmin=(298, 'K'),
                                 Tmax=(5000, 'K'),
                                 Cp0=(33.2579, 'J/(mol*K)'),
                                 CpInf=(719.202, 'J/(mol*K)'),
                                 comment="""Thermo library: JetSurF0.2"""),
                     molecule=[Molecule(SMILES="[CH2]CCCCCCCCC")])
     acetone = Species(label="",
                       thermo=NASA(polynomials=[
                           NASAPolynomial(coeffs=[
                               3.75568, 0.0264934, -6.55661e-05,
                               1.94971e-07, -1.82059e-10, -27905.3, 9.0162
                           ],
                                          Tmin=(10, 'K'),
                                          Tmax=(422.477, 'K')),
                           NASAPolynomial(coeffs=[
                               0.701289, 0.0344988, -1.9736e-05,
                               5.48052e-09, -5.92612e-13, -27460.6, 23.329
                           ],
                                          Tmin=(422.477, 'K'),
                                          Tmax=(3000, 'K'))
                       ],
                                   Tmin=(10, 'K'),
                                   Tmax=(3000, 'K'),
                                   E0=(-232.025, 'kJ/mol'),
                                   Cp0=(33.2579, 'J/(mol*K)'),
                                   CpInf=(232.805, 'J/(mol*K)')),
                       molecule=[Molecule(SMILES="CC(=O)C")])
     peracetic_acid = Species(label="",
                              thermo=NASA(polynomials=[
                                  NASAPolynomial(coeffs=[
                                      3.81786, 0.016419, 3.32204e-05,
                                      -8.98403e-08, 6.63474e-11, -42057.8,
                                      9.65245
                                  ],
                                                 Tmin=(10, 'K'),
                                                 Tmax=(354.579, 'K')),
                                  NASAPolynomial(coeffs=[
                                      2.75993, 0.0283534, -1.72659e-05,
                                      5.08158e-09, -5.77773e-13, -41982.8,
                                      13.6595
                                  ],
                                                 Tmin=(354.579, 'K'),
                                                 Tmax=(3000, 'K'))
                              ],
                                          Tmin=(10, 'K'),
                                          Tmax=(3000, 'K'),
                                          E0=(-349.698, 'kJ/mol'),
                                          Cp0=(33.2579, 'J/(mol*K)'),
                                          CpInf=(199.547, 'J/(mol*K)')),
                              molecule=[Molecule(SMILES="CC(=O)OO")])
     acetic_acid = Species(label="",
                           thermo=NASA(polynomials=[
                               NASAPolynomial(coeffs=[
                                   3.97665, 0.00159915, 8.5542e-05,
                                   -1.76486e-07, 1.20201e-10, -53911.5,
                                   8.99309
                               ],
                                              Tmin=(10, 'K'),
                                              Tmax=(375.616, 'K')),
                               NASAPolynomial(coeffs=[
                                   1.57088, 0.0272146, -1.67357e-05,
                                   5.01453e-09, -5.82273e-13, -53730.7,
                                   18.2442
                               ],
                                              Tmin=(375.616, 'K'),
                                              Tmax=(3000, 'K'))
                           ],
                                       Tmin=(10, 'K'),
                                       Tmax=(3000, 'K'),
                                       E0=(-448.245, 'kJ/mol'),
                                       Cp0=(33.2579, 'J/(mol*K)'),
                                       CpInf=(182.918, 'J/(mol*K)')),
                           molecule=[Molecule(SMILES="CC(=O)O")])
     criegee = Species(label="",
                       thermo=NASA(polynomials=[
                           NASAPolynomial(coeffs=[
                               3.23876, 0.0679583, -3.35611e-05,
                               7.91519e-10, 3.13038e-12, -77986, 13.6438
                           ],
                                          Tmin=(10, 'K'),
                                          Tmax=(1053.46, 'K')),
                           NASAPolynomial(coeffs=[
                               9.84525, 0.0536795, -2.86165e-05,
                               7.39945e-09, -7.48482e-13, -79977.6, -21.4187
                           ],
                                          Tmin=(1053.46, 'K'),
                                          Tmax=(3000, 'K'))
                       ],
                                   Tmin=(10, 'K'),
                                   Tmax=(3000, 'K'),
                                   E0=(-648.47, 'kJ/mol'),
                                   Cp0=(33.2579, 'J/(mol*K)'),
                                   CpInf=(457.296, 'J/(mol*K)')),
                       molecule=[Molecule(SMILES="CC(=O)OOC(C)(O)C")])
     self.database = SolvationDatabase()
     self.database.load(
         os.path.join(settings['database.directory'], 'solvation'))
     self.solvent = 'octane'
     diffusionLimiter.enable(self.database.getSolventData(self.solvent),
                             self.database)
     self.T = 298
     self.uni_reaction = Reaction(reactants=[octyl_pri],
                                  products=[octyl_sec])
     self.uni_reaction.kinetics = Arrhenius(A=(2.0, '1/s'),
                                            n=0,
                                            Ea=(0, 'kJ/mol'))
     self.bi_uni_reaction = Reaction(reactants=[octyl_pri, ethane],
                                     products=[decyl])
     self.bi_uni_reaction.kinetics = Arrhenius(A=(1.0E-22,
                                                  'cm^3/molecule/s'),
                                               n=0,
                                               Ea=(0, 'kJ/mol'))
     self.tri_bi_reaction = Reaction(
         reactants=[acetone, peracetic_acid, acetic_acid],
         products=[criegee, acetic_acid])
     self.tri_bi_reaction.kinetics = Arrhenius(A=(1.07543e-11,
                                                  'cm^6/(mol^2*s)'),
                                               n=5.47295,
                                               Ea=(-38.5379, 'kJ/mol'))
     self.intrinsic_rates = {
         self.uni_reaction:
         self.uni_reaction.kinetics.getRateCoefficient(self.T, P=100e5),
         self.bi_uni_reaction:
         self.bi_uni_reaction.kinetics.getRateCoefficient(self.T, P=100e5),
         self.tri_bi_reaction:
         self.tri_bi_reaction.kinetics.getRateCoefficient(self.T, P=100e5),
     }