當前位置: 首頁>>代碼示例>>Python>>正文


Python Species.isIsomorphic方法代碼示例

本文整理匯總了Python中species.Species.isIsomorphic方法的典型用法代碼示例。如果您正苦於以下問題:Python Species.isIsomorphic方法的具體用法?Python Species.isIsomorphic怎麽用?Python Species.isIsomorphic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在species.Species的用法示例。


在下文中一共展示了Species.isIsomorphic方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: loadChemkinFile

# 需要導入模塊: from species import Species [as 別名]
# 或者: from species.Species import isIsomorphic [as 別名]

#.........這裏部分代碼省略.........
        while line != '':        
            line = removeCommentFromLine(line)[0]
            line = line.strip()
            tokens = line.split()
            
            if 'SPECIES' in line:
                # List of species identifiers
                index = tokens.index('SPECIES')
                tokens = tokens[index+1:]
                while 'END' not in tokens:
                    line = f.readline()
                    line = removeCommentFromLine(line)[0]
                    line = line.strip()
                    tokens.extend(line.split())
                
                for token in tokens:
                    if token == 'END':
                        break
                    if token in speciesDict:
                        species = speciesDict[token]
                    else:
                        species = Species(label=token)
                        speciesDict[token] = species
                    speciesList.append(species)
                
                # Also always add in a few bath gases (since RMG-Java does)
                for label, smiles in [('Ar','[Ar]'), ('He','[He]'), ('Ne','[Ne]'), ('N2','N#N')]:
                    molecule = Molecule().fromSMILES(smiles)
                    for species in speciesList:
                        if species.label == label:
                            if len(species.molecule) == 0:
                                species.molecule = [molecule]
                            break
                        if species.isIsomorphic(molecule):
                            break
                    else:
                        species = Species(label=label, molecule=[molecule])
                        speciesList.append(species)
                        speciesDict[label] = species                            
                
            elif 'THERM' in line:
                # List of thermodynamics (hopefully one per species!)
                line = f.readline()
                thermo = ''
                while line != '' and 'END' not in line:
                    line = removeCommentFromLine(line)[0]
                    if len(line) >= 80:
                        if line[79] in ['1', '2', '3', '4']:
                            thermo += line
                            if line[79] == '4':
                                label, thermo = readThermoEntry(thermo)
                                try:
                                    speciesDict[label].thermo = thermo
                                except KeyError:
                                    if label in ['Ar', 'N2', 'He', 'Ne']:
                                        pass
                                    else:
                                        logging.warning('Skipping unexpected species "{0}" while reading thermodynamics entry.'.format(label))
                                thermo = ''
                    line = f.readline()
                
            elif 'REACTIONS' in line:
                # Reactions section
                energyUnits = 'CAL/MOL'
                moleculeUnits = 'MOLES'
                try:
開發者ID:sean-v8,項目名稱:RMG-Py,代碼行數:70,代碼來源:chemkin.py


注:本文中的species.Species.isIsomorphic方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。