Exemple #1
0
def species(label='', E0=None, states=None, thermo=None, lennardJones=None, molecularWeight=0.0, SMILES='', InChI=''):
    global speciesDict
    if label == '': raise InputError('Missing "label" attribute in species() block.')
    if E0 is not None: E0 = processQuantity(E0)[0]
    else: E0 = 0.0
    spec = Species(label=label, states=states, thermo=thermo, E0=E0, lennardJones=lennardJones)
    if InChI != '':
        spec.molecule = [Molecule(InChI=InChI)]
    elif SMILES != '':
        spec.molecule = [Molecule(SMILES=SMILES)]
    spec.molecularWeight = processQuantity(molecularWeight)[0]
    speciesDict[label] = spec
    logging.debug('Found species "%s"' % spec)
    # If the molecular weight was not specified but the structure was, then
    # get the molecular weight from the structure
    if spec.molecularWeight == 0.0 and spec.molecule is not None and len(spec.molecule) > 0:
        spec.molecularWeight = spec.molecule[0].getMolecularWeight()
Exemple #2
0
 
 # Read bath gas parameters
 bathGas = Species()
 bathGas.molecularWeight = float(readMeaningfulLine(f).split()[1]) / 1000.0
 bathGas.lennardJones = LennardJones(sigma=float(readMeaningfulLine(f).split()[1]), epsilon=float(readMeaningfulLine(f).split()[1]))
 
 # Read species data
 Nspec = int(readMeaningfulLine(f))
 speciesDict = {}
 for i in range(Nspec):
     spec = Species()
     # Read species label
     spec.label = readMeaningfulLine(f)
     speciesDict[spec.label] = spec
     if spec.label in moleculeDict:
         spec.molecule = [moleculeDict[spec.label]]
     # Read species E0
     data = readMeaningfulLine(f).split()
     assert data[0] == 'J/mol'
     spec.E0 = float(data[1])
     # Read and ignore species thermo data
     for j in range(10):
         data = readMeaningfulLine(f)
     # Read species collision parameters
     spec.molecularWeight = float(readMeaningfulLine(f).split()[1]) / 1000.0
     spec.lennardJones = LennardJones(sigma=float(readMeaningfulLine(f).split()[1]), epsilon=float(readMeaningfulLine(f).split()[1]))
     # Read species frequencies
     spec.states = StatesModel()
     data = readMeaningfulLine(f).split()
     assert data[1] == 'cm^-1'
     frequencies = []