Example #1
0
    def testToWilhoit(self):
        """
        Test if the entropy computed from other thermo implementations is close to what Wilhoit computes.
        """

        from rmgpy import settings
        from rmgpy.data.rmg import RMGDatabase, database
        from rmgpy.species import Species

        # Load databases
        database = RMGDatabase()
        database.loadThermo(os.path.join(settings['database.directory'],
                                         'thermo'),
                            thermoLibraries=['Narayanaswamy'])
        database.loadSolvation(
            os.path.join(settings['database.directory'], 'solvation'))

        spc = Species().fromSMILES('CC')
        spc.getThermoData()

        T = 1350.  # not 298K!

        # nasa to wilhoit
        nasa = spc.thermo
        Snasa = nasa.getEntropy(T)

        nasaToWh = nasa.toWilhoit()
        SnasaToWh = nasaToWh.getEntropy(T)

        self.assertAlmostEqual(Snasa, SnasaToWh, -1)
        self.assertEqual(nasa.comment, nasaToWh.comment)

        # wilhoit to nasa conversion done in nasaTest.py

        # thermo data to wilhoit:
        td = nasa.toThermoData()
        Std = td.getEntropy(T)

        wilhoit = td.toWilhoit(B=1000.)
        Swh = wilhoit.getEntropy(T)

        self.assertAlmostEqual(Std, Swh, -1)
        self.assertEqual(td.comment, wilhoit.comment)

        # wilhoit back to thermodata
        td = wilhoit.toThermoData()
        Std = td.getEntropy(T)

        self.assertAlmostEqual(Std, Swh, -1)
        self.assertEqual(td.comment, wilhoit.comment)
    def testToWilhoit(self):
        """
        Test if the entropy computed from other thermo implementations is close to what Wilhoit computes.
        """

        from rmgpy import settings
        from rmgpy.data.rmg import RMGDatabase, database
        from rmgpy.species import Species

        # Load databases
        database = RMGDatabase()
        database.loadThermo(os.path.join(settings['database.directory'], 'thermo'), thermoLibraries=['Narayanaswamy'])
        database.loadSolvation(os.path.join(settings['database.directory'], 'solvation'))

        spc = Species().fromSMILES('CC')
        spc.getThermoData()

        T = 1350.# not 298K!

        # nasa to wilhoit
        nasa = spc.thermo
        Snasa = nasa.getEntropy(T)

        nasaToWh = nasa.toWilhoit()
        SnasaToWh = nasaToWh.getEntropy(T)

        self.assertAlmostEqual(Snasa, SnasaToWh, -1)
        self.assertEqual(nasa.comment,nasaToWh.comment)

        # wilhoit to nasa conversion done in nasaTest.py

        # thermo data to wilhoit:
        td = nasa.toThermoData()
        Std = td.getEntropy(T)

        wilhoit = td.toWilhoit(B=1000.)        
        Swh = wilhoit.getEntropy(T)

        self.assertAlmostEqual(Std, Swh, -1)
        self.assertEqual(td.comment,wilhoit.comment)

        # wilhoit back to thermodata
        td = wilhoit.toThermoData()
        Std = td.getEntropy(T)

        self.assertAlmostEqual(Std, Swh, -1)
        self.assertEqual(td.comment,wilhoit.comment)
Example #3
0
    def testToNASA(self):
        """
        Test if the entropy computed from other thermo implementations is close to what NASA computes.
        """

        from rmgpy import settings
        from rmgpy.data.rmg import RMGDatabase, database
        from rmgpy.species import Species

        # Load databases
        database = RMGDatabase()
        database.loadThermo(os.path.join(settings['database.directory'],
                                         'thermo'),
                            thermoLibraries=['Narayanaswamy'])
        database.loadSolvation(
            os.path.join(settings['database.directory'], 'solvation'))

        spc = Species().fromSMILES('CC')
        spc.getThermoData()

        T = 1350.  # not 298K!

        # nasa to thermodata
        nasa = spc.thermo
        Snasa = nasa.getEntropy(T)

        td = nasa.toThermoData()
        Std = td.getEntropy(T)

        self.assertAlmostEqual(Snasa, Std, -1)
        self.assertEqual(td.comment, nasa.comment)

        # thermodata to nasa
        nasa = td.toNASA(Tmin=100.0, Tmax=5000.0, Tint=1000.0)
        Snasa = nasa.getEntropy(T)

        self.assertAlmostEqual(Snasa, Std, -1)
        self.assertEqual(td.comment, nasa.comment)

        # wilhoit to nasa
        wilhoit = nasa.toWilhoit()
        nasa = wilhoit.toNASA(Tmin=100.0, Tmax=5000.0, Tint=1000.0)
        Snasa = nasa.getEntropy(T)

        self.assertAlmostEqual(Snasa, Std, -1)
        self.assertEqual(wilhoit.comment, nasa.comment)
Example #4
0
    def testToNASA(self):
        """
        Test if the entropy computed from other thermo implementations is close to what NASA computes.
        """

        from rmgpy import settings
        from rmgpy.data.rmg import RMGDatabase, database
        from rmgpy.species import Species

        # Load databases
        database = RMGDatabase()
        database.loadThermo(os.path.join(settings['database.directory'], 'thermo'),thermoLibraries=['Narayanaswamy'])
        database.loadSolvation(os.path.join(settings['database.directory'], 'solvation'))

        spc = Species().fromSMILES('CC')
        spc.getThermoData()

        T = 1350.# not 298K!

        # nasa to thermodata
        nasa = spc.thermo
        Snasa = nasa.getEntropy(T)

        td = nasa.toThermoData()
        Std = td.getEntropy(T)

        self.assertAlmostEqual(Snasa, Std, -1)
        self.assertEqual(td.comment,nasa.comment)


        # thermodata to nasa
        nasa = td.toNASA(Tmin=100.0, Tmax=5000.0, Tint=1000.0)
        Snasa = nasa.getEntropy(T)

        self.assertAlmostEqual(Snasa, Std, -1)
        self.assertEqual(td.comment,nasa.comment)

        # wilhoit to nasa
        wilhoit=nasa.toWilhoit()
        nasa = wilhoit.toNASA(Tmin=100.0, Tmax=5000.0, Tint=1000.0)
        Snasa = nasa.getEntropy(T)

        self.assertAlmostEqual(Snasa, Std, -1)
        self.assertEqual(wilhoit.comment,nasa.comment)

        # nasa to wilhoi performed in wilhoitTest
Example #5
0
def setUpModule():
    """A function that is run ONCE before all unit tests in this module."""
    global database
    database = RMGDatabase()
    database.loadThermo(os.path.join(settings['database.directory'], 'thermo'))
Example #6
0
def setUpModule():
    """A function that is run ONCE before all unit tests in this module."""
    global database
    database = RMGDatabase()
    database.loadThermo(os.path.join(settings['database.directory'], 'thermo'))