Esempio n. 1
0
    def init_from_input(cls, section):
        """
        Initialize via section dictionary.

        Args:
            section (dict): section dictionary

        Returns:
            PySCFDriver: Driver object
        Raises:
            QiskitChemistryError: Invalid or missing section
        """
        if section is None or not isinstance(section, dict):
            raise QiskitChemistryError('Invalid or missing section {}'.format(section))

        params = section
        kwargs = {}
        for k, v in params.items():
            if k == 'unit':
                v = UnitsType(v)
            elif k == 'hf_method':
                v = HFMethodType(v)
            elif k == 'init_guess':
                v = InitialGuess(v)

            kwargs[k] = v

        logger.debug('init_from_input: %s', kwargs)
        return cls(**kwargs)
Esempio n. 2
0
    def init_from_input(cls, section):
        """
        Initialize via section dictionary.

        Args:
            params (dict): section dictionary

        Returns:
            Driver: Driver object
        """
        if section is None or not isinstance(section, dict):
            raise QiskitChemistryError(
                'Invalid or missing section {}'.format(section))

        params = section
        kwargs = {}
        for k, v in params.items():
            if k == PyQuanteDriver.KEY_UNITS:
                v = UnitsType(v)
            elif k == PyQuanteDriver.KEY_BASIS:
                v = BasisType(v)

            kwargs[k] = v

        logger.debug('init_from_input: {}'.format(kwargs))
        return cls(**kwargs)