def getThermoData(self, solventName = ''):
        """
        Returns a `thermoData` object of the current Species object.

        If the thermo object already exists, it is either of the (Wilhoit, ThermoData)
        type, or it is a Future.

        If the type of the thermo attribute is Wilhoit, or ThermoData,
        then it is converted into a NASA format.

        If it is a Future, then a blocking call is made to retrieve the NASA object.
        If the thermo object did not exist yet, the thermo object is generated.        
        """

        from rmgpy.thermo.thermoengine import submit
        
        if self.thermo:
            if not isinstance(self.thermo, (NASA, Wilhoit, ThermoData)):
                self.thermo = self.thermo.result()
        else:
            submit(self, solventName)
            if not isinstance(self.thermo, (NASA, Wilhoit, ThermoData)):
                self.thermo = self.thermo.result()

        return self.thermo       
Exemple #2
0
    def get_thermo_data(self, solvent_name=''):
        """
        Returns a `thermoData` object of the current Species object.

        If the thermo object already exists, it is either of the (Wilhoit, ThermoData)
        type, or it is a Future.

        If the type of the thermo attribute is Wilhoit, or ThermoData,
        then it is converted into a NASA format.

        If it is a Future, then a blocking call is made to retrieve the NASA object.
        If the thermo object did not exist yet, the thermo object is generated.        
        """

        from rmgpy.thermo.thermoengine import submit

        if self.thermo:
            if not isinstance(self.thermo, (NASA, Wilhoit, ThermoData)):
                self.thermo = self.thermo.result()
        else:
            submit(self, solvent_name)
            if not isinstance(self.thermo, (NASA, Wilhoit, ThermoData)):
                self.thermo = self.thermo.result()

        return self.thermo
def funcSubmitGet():
    """
    Test if we can retrieve thermo of species after submitting some of them.
    """
    load()

    spcs = [
            Species().fromSMILES('C'),\
            Species().fromSMILES('CC'), \
            Species().fromSMILES('CCC')
            ]

    for spc in spcs:
        submit(spc)

    absent = Species().fromSMILES('[CH3]')
    data = absent.getThermoData()
    if not data: return False

    present = Species().fromSMILES('CC')
    data = present.getThermoData()
    if not data: return False

    random.shuffle(spcs)
    for spc in spcs:
        data = spc.getThermoData()
        if not data: return False

    return True
def funcSubmitGet():
    """
    Test if we can retrieve thermo of species after submitting some of them.
    """
    load()

    spcs = [
            Species().fromSMILES('C'),\
            Species().fromSMILES('CC'), \
            Species().fromSMILES('CCC')
            ]
    
    for spc in spcs:
        submit(spc)

    absent = Species().fromSMILES('[CH3]')
    data = absent.getThermoData()
    if not data: return False

    present = Species().fromSMILES('CC')
    data = present.getThermoData()
    if not data: return False

    random.shuffle(spcs)
    for spc in spcs:
        data = spc.getThermoData()
        if not data: return False        

    return True
def funcSubmit():
    """
    Test that we can submit a number of species.
    """
    load()

    spcs = [
            Species().fromSMILES('C'),\
            Species().fromSMILES('CC'), \
            Species().fromSMILES('CCC')
            ]

    for spc in spcs:
        submit(spc)

    return True
def funcSubmit():
    """
    Test that we can submit a number of species.
    """
    load()

    spcs = [
            Species().fromSMILES('C'),\
            Species().fromSMILES('CC'), \
            Species().fromSMILES('CCC')
            ]
    
    for spc in spcs:
        submit(spc)

    return True
Exemple #7
0
def run_thermo_estimator(input_file, library_flag):
    """
    Estimate thermo for a list of species using RMG and the settings chosen inside a thermo input file.
    """

    rmg = RMG()
    rmg.load_thermo_input(input_file)

    rmg.database = RMGDatabase()
    path = os.path.join(settings['database.directory'])

    # forbidden structure loading
    rmg.database.load_thermo(os.path.join(path, 'thermo'),
                             rmg.thermo_libraries,
                             depository=False)

    if rmg.solvent:
        rmg.database.load_solvation(os.path.join(path, 'solvation'))
        Species.solvent_data = rmg.database.solvation.get_solvent_data(
            rmg.solvent)
        Species.solvent_name = rmg.solvent

    for species in rmg.initial_species:
        submit(species)

    if library_flag:
        library = ThermoLibrary(name='Thermo Estimation Library')
        for species in rmg.initial_species:
            library.load_entry(
                index=len(library.entries) + 1,
                label=species.label,
                molecule=species.molecule[0].to_adjacency_list(),
                thermo=species.get_thermo_data().to_thermo_data(),
                shortDesc=species.get_thermo_data().comment,
            )
        library.save(os.path.join(rmg.output_directory, 'ThermoLibrary.py'))

    # Save the thermo data to chemkin format output files and dictionary, with no reactions
    save_chemkin_file(os.path.join(rmg.output_directory, 'chem_annotated.inp'),
                      species=rmg.initial_species,
                      reactions=[])
    save_species_dictionary(os.path.join(rmg.output_directory,
                                         'species_dictionary.txt'),
                            species=rmg.initial_species)
Exemple #8
0
def runThermoEstimator(inputFile):
    """
    Estimate thermo for a list of species using RMG and the settings chosen inside a thermo input file.
    """

    rmg = RMG()
    rmg.loadThermoInput(inputFile)

    rmg.database = RMGDatabase()
    path = os.path.join(settings['database.directory'])

    # forbidden structure loading
    rmg.database.loadThermo(os.path.join(path, 'thermo'),
                            rmg.thermoLibraries,
                            depository=False)

    if rmg.solvent:
        rmg.database.loadSolvation(os.path.join(path, 'solvation'))
        Species.solventData = rmg.database.solvation.getSolventData(
            rmg.solvent)
        Species.solventName = rmg.solvent

    for species in rmg.initialSpecies:
        submit(species)

    # library = ThermoLibrary(name='Thermo Estimation Library')
    # for spc in rmg.initialSpecies:
    #     library.loadEntry(
    #         index = len(library.entries) + 1,
    #         label = species.label,
    #         molecule = species.molecule[0].toAdjacencyList(),
    #         thermo = species.getThermoData().toThermoData(),
    #         shortDesc = species.getThermoData().comment,
    #     )
    # library.save(os.path.join(rmg.outputDirectory,'ThermoLibrary.py'))

    # Save the thermo data to chemkin format output files and dictionary, with no reactions
    saveChemkinFile(os.path.join(rmg.outputDirectory, 'chem_annotated.inp'),
                    species=rmg.initialSpecies,
                    reactions=[])
    saveSpeciesDictionary(os.path.join(rmg.outputDirectory,
                                       'species_dictionary.txt'),
                          species=rmg.initialSpecies)
def runThermoEstimator(inputFile):
    """
    Estimate thermo for a list of species using RMG and the settings chosen inside a thermo input file.
    """
    
    rmg = RMG()
    rmg.loadThermoInput(inputFile)
    
    rmg.database = RMGDatabase()
    path = os.path.join(settings['database.directory'])

    # forbidden structure loading
    rmg.database.loadThermo(os.path.join(path, 'thermo'), rmg.thermoLibraries, depository=False)
   
    if rmg.solvent:
        rmg.database.loadSolvation(os.path.join(path, 'solvation'))
        Species.solventData = rmg.database.solvation.getSolventData(rmg.solvent)
        Species.solventName = rmg.solvent

    for species in rmg.initialSpecies:
        submit(species)

    # library = ThermoLibrary(name='Thermo Estimation Library')
    # for spc in rmg.initialSpecies:
    #     library.loadEntry(
    #         index = len(library.entries) + 1,
    #         label = species.label,
    #         molecule = species.molecule[0].toAdjacencyList(),
    #         thermo = species.getThermoData().toThermoData(),
    #         shortDesc = species.getThermoData().comment,
    #     )
    # library.save(os.path.join(rmg.outputDirectory,'ThermoLibrary.py'))
    

    # Save the thermo data to chemkin format output files and dictionary, with no reactions    
    saveChemkinFile(os.path.join(rmg.outputDirectory, 'chem_annotated.inp'), species=rmg.initialSpecies, reactions=[])
    saveSpeciesDictionary(os.path.join(rmg.outputDirectory, 'species_dictionary.txt'), species=rmg.initialSpecies)