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
def species(label='', E0=None, states=None, lennardJones=None, molecularWeight=0.0):
    global speciesDict
    if E0 is not None: E0 = processQuantity(E0)[0]
    else: E0 = 0.0
    spec = Species(label=label, states=states, E0=E0, lennardJones=lennardJones)
    spec.molecularWeight = processQuantity(molecularWeight)[0]
    speciesDict[label] = spec
    logging.debug('Found species "%s"' % spec)
Exemple #3
0
        elif data[0].lower() == 'grainsize':
            assert data[2] == 'J/mol'
            Ngrains = 0
            grainSize = float(data[2])

        network = Network()

        # Read collision model
        data = readMeaningfulLine(f).split()
        assert data[0].lower() == 'singleexpdown'
        assert data[1] == 'J/mol'
        network.collisionModel = SingleExponentialDownModel(alpha0=float(data[2]), T0=298, n=0.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'