コード例 #1
0
ファイル: conceptual.py プロジェクト: ZhaoYilin/chemtools
    def from_molecule(cls, molecule, model, points):
        r"""
        Initialize class from `Molecule` object(s).

        Parameters
        ----------
        molecule : Molecule or Sequence of Molecule
            Instance of Molecule class, or sequence of Molecule class instances.
        model : str
            Energy model used to calculate local reactivity descriptors.
            Available models are "linear" and "quadratic".
        points : np.array
            Coordinates of points on which the local properties are evaluated given as a 2D
            array with 3 columns.
        """
        # check molecule
        molecule = check_arg_molecule(molecule)
        # if points is None:
        #     # make molecular grid which also checks for matching atomic numbers & coordinates
        #     grid = get_molecular_grid(molecule, grid=None)
        #     points, numbers, coords = grid.points, grid.numbers, grid.centers
        numbers = get_matching_attr(molecule, "numbers", 1.e-8)
        coords = get_matching_attr(molecule, "coordinates", 1.e-4)
        dict_dens = get_dict_density(molecule, points)
        return cls(dict_dens, model, coords, numbers)
コード例 #2
0
ファイル: conceptual.py プロジェクト: ZhaoYilin/chemtools
    def from_molecule(cls, molecule, model):
        r"""
        Initialize class from `Molecule` object(s).

        Parameters
        ----------
        molecule : Molecule or Sequence of Molecule
            Instance of Molecule class, or sequence of Molecule class instances.
        model : str
            Energy model used to calculate global reactivity descriptors.
        """
        # check molecule
        molecule = check_arg_molecule(molecule)
        # get atomic number and atomic coordinates
        number = get_matching_attr(molecule, "numbers", 1.e-8)
        coords = get_matching_attr(molecule, "coordinates", 1.e-4)
        dict_energy = get_dict_energy(molecule)
        return cls(dict_energy, model, coords, number)
コード例 #3
0
ファイル: conceptual.py プロジェクト: ZhaoYilin/chemtools
    def from_molecule(cls,
                      molecule,
                      model,
                      approach="FMR",
                      scheme="h",
                      **kwargs):
        r"""
        Initialize class from `Molecule` object(s).

        Parameters
        ----------
        molecule : Molecule or Sequence of Molecule
            Instance of Molecule class, or sequence of Molecule class instances.
        model : str
            Energy model used to calculate condensed reactivity descriptors.
            Available models are "linear" and "quadratic".
        approach : str, optional
            Choose between "FMR" (fragment of molecular response) or "RMF"
            (response of molecular fragment).
        scheme : str, optional
            Partitioning scheme. Options: "h", "hi", "mbis".
        kwargs : dict, optional
            Extra keyword arguments required for partitioning, like 'grid' and 'proatomdb'.
        """
        # check molecule
        molecule = check_arg_molecule(molecule)
        # check type of grid
        if "grid" in kwargs.keys() and not isinstance(kwargs["grid"],
                                                      MolecularGrid):
            raise ValueError(
                "Currently, only 'MolecularGrid' is supported for condensing!")
        # get atomic number & coordinates
        numbers = get_matching_attr(molecule, "numbers", 1.e-8)
        coords = get_matching_attr(molecule, "coordinates", 1.e-4)
        # get dictionary of populations
        dict_pops = get_dict_population(molecule, approach, scheme, **kwargs)
        return cls(dict_pops, model, coords, numbers)