예제 #1
0
파일: input.py 프로젝트: qize/RMG-Py
def transitionState(label, *args, **kwargs):
    """Load a transition state from an input file"""
    global transition_state_dict
    if label in transition_state_dict:
        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)
    transition_state_dict[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)
        job_list.append(job)

    elif len(args) == 0:
        # The species parameters are given explicitly
        E0 = None
        modes = []
        spin_multiplicity = 1
        optical_isomers = 1
        frequency = None
        for key, value in kwargs.items():
            if key == 'E0':
                E0 = value
            elif key == 'modes':
                modes = value
            elif key == 'spinMultiplicity':
                spin_multiplicity = value
            elif key == 'opticalIsomers':
                optical_isomers = value
            elif key == 'frequency':
                frequency = value
            else:
                raise TypeError(
                    'transition_state() got an unexpected keyword argument {0!r}.'
                    .format(key))

        ts.conformer = Conformer(E0=E0,
                                 modes=modes,
                                 spin_multiplicity=spin_multiplicity,
                                 optical_isomers=optical_isomers)
        ts.frequency = frequency
    else:
        if len(args) == 0 and len(kwargs) == 0:
            raise InputError(
                'The transition_state needs to reference a quantum job file or contain kinetic information.'
            )
        raise InputError(
            'The transition_state can only link a quantum job or directly input information, not both.'
        )

    return ts
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
예제 #3
0
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:
        # 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
    else:
        if len(args) == 0 and len(kwargs) == 0:
            raise InputError('The transitionState needs to reference a quantum job file or contain kinetic information.')
        raise InputError('The transitionState can only link a quantum job or directly input information, not both.')

    return ts