def transitionState(label, *args, **kwargs): global transitionStateDict if label in transitionStateDict: raise ValueError( 'Multiple occurrences of transition state with label {0!r}.'. format(label)) logging.info('Loading transition state {0}...'.format(label)) ts = TransitionState(label=label) transitionStateDict[label] = ts if len(args) == 1 and len(kwargs) == 0: # The argument is a path to a conformer input file path = args[0] job = StatMechJob(species=ts, path=path) jobList.append(job) elif len(args) == 0 and len(kwargs) > 0: # The species parameters are given explicitly E0 = None modes = [] spinMultiplicity = 1 opticalIsomers = 1 frequency = None for key, value in kwargs.items(): if key == 'E0': E0 = value elif key == 'modes': modes = value elif key == 'spinMultiplicity': spinMultiplicity = value elif key == 'opticalIsomers': opticalIsomers = value elif key == 'frequency': frequency = value else: raise TypeError( 'transitionState() got an unexpected keyword argument {0!r}.' .format(key)) ts.conformer = Conformer(E0=E0, modes=modes, spinMultiplicity=spinMultiplicity, opticalIsomers=opticalIsomers) ts.frequency = frequency return ts
def species(label, *args, **kwargs): global speciesDict, jobList if label in speciesDict: raise ValueError( 'Multiple occurrences of species with label {0!r}.'.format(label)) logging.info('Loading species {0}...'.format(label)) spec = Species(label=label) speciesDict[label] = spec if len(args) == 1: # The argument is a path to a conformer input file path = args[0] job = StatMechJob(species=spec, path=path) jobList.append(job) if len(kwargs) > 0: # The species parameters are given explicitly structure = None E0 = None modes = [] spinMultiplicity = 1 opticalIsomers = 1 molecularWeight = None collisionModel = None energyTransferModel = None thermo = None for key, value in kwargs.items(): if key == 'structure': structure = value elif key == 'E0': E0 = value elif key == 'modes': modes = value elif key == 'spinMultiplicity': spinMultiplicity = value elif key == 'opticalIsomers': opticalIsomers = value elif key == 'molecularWeight': molecularWeight = value elif key == 'collisionModel': collisionModel = value elif key == 'energyTransferModel': energyTransferModel = value elif key == 'thermo': thermo = value else: raise TypeError( 'species() got an unexpected keyword argument {0!r}.'. format(key)) if structure: spec.molecule = [structure] spec.conformer = Conformer(E0=E0, modes=modes, spinMultiplicity=spinMultiplicity, opticalIsomers=opticalIsomers) spec.molecularWeight = molecularWeight spec.transportData = collisionModel spec.energyTransferModel = energyTransferModel spec.thermo = thermo return spec