:py:mod:`bfit.model` ==================== .. py:module:: bfit.model .. autoapi-nested-parse:: Models used for fitting. .. !! processed by numpydoc !! Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: bfit.model.AtomicGaussianDensity bfit.model.MolecularGaussianDensity .. py:class:: AtomicGaussianDensity(points, center=None, num_s=1, num_p=0, normalize=False) Gaussian density model for modeling the electronic density of a single atom. Atomic Gaussian density is a linear combination of Gaussian functions of S-type and p-type functions: .. math:: f(x) := \sum_i c_i e^{-\alpha_i |x - c|^2} + \sum_j d_j |x - c|^2 e^{-\beta_j |x - c|^2} where :math:`c_i, d_i` are the coefficients of s-type and p-type Gaussian functions, :math:`\alpha_i, \beta_j` are teh exponents of the s-type and p-type Gaussian functions, :math:`c` is the center of all Gaussian functions. :math:`x` is the real coordinates, can be multi-dimensional. Construct class representing atomic density modeled as Gaussian functions. :param points: Grid points where N is the number of points and D is the number of dimensions. :type points: ndarray, (N, D) :param center: The D-dimensional coordinates of the single center. If `None`, then the center is the origin of all zeros. :type center: ndarray (D,), optional :param num_s: Number of s-type Gaussian basis functions. :type num_s: int, optional :param num_p: Number of p-type Gaussian basis functions. :type num_p: int, optional :param normalize: Whether to normalize Gaussian basis functions. :type normalize: bool, optional .. !! processed by numpydoc !! .. py:method:: points(self) :property: Return the grid points. .. !! processed by numpydoc !! .. py:method:: radii(self) :property: Return the distance of grid points from center of Gaussian(s). .. !! processed by numpydoc !! .. py:method:: num_s(self) :property: Return the number of s-type Gaussian basis functions. .. !! processed by numpydoc !! .. py:method:: num_p(self) :property: Return the number of p-type Gaussian basis functions. .. !! processed by numpydoc !! .. py:method:: nbasis(self) :property: Return the total number of Gaussian basis functions. .. !! processed by numpydoc !! .. py:method:: natoms(self) :property: Return the number of basis functions centers. .. !! processed by numpydoc !! .. py:method:: prefactor(self) :property: Obtain list of exponents for the prefactors. .. !! processed by numpydoc !! .. py:method:: change_numb_s_and_numb_p(self, new_s, new_p) Change the number of s-type and p-type Gaussians. :param new_s: New number of s-type Gaussians. :type new_s: int :param new_p: New number of p-type Gaussians. :type new_p: int .. !! processed by numpydoc !! .. py:method:: evaluate(self, coeffs, expons, deriv=False) Compute linear combination of Gaussian basis & its derivatives on the grid points. .. math:: f(x):= \sum_i c_i e^{-\alpha_i |x - c|^2} + \sum_j d_j |x - c|^2 e^{-\beta_j |x - c|^2} where :math:`c_i, d_i` are the coefficients of s-type and p-type Gaussian functions, :math:`\alpha_i, \beta_j` are teh exponents of the s-type and p-type Gaussian functions, :math:`c` is the center of all Gaussian functions. :math:`x` is the real coordinates, can be multi-dimensional. :param coeffs: The coefficients :math:`c_i` of `num_s` s-type Gaussian basis functions followed by the coefficients :math:`d_j` of `num_p` p-type Gaussian basis functions. :type coeffs: ndarray(`nbasis`,) :param expons: The exponents :math:`\alpha_i` of `num_s` s-type Gaussian basis functions followed by the exponents :math:`\beta_j` of `num_p` p-type Gaussian basis functions. :type expons: ndarray(`nbasis`,) :param deriv: Whether to compute derivative of Gaussian basis functions w.r.t. coefficients & exponents. :type deriv: bool, optional :returns: * **g** (*ndarray, (N,)*) -- The linear combination of Gaussian basis functions evaluated on the grid points. * **dg** (ndarray, (N, 2 * `nbasis`)) -- The derivative of a linear combination of Gaussian basis functions w.r.t. coefficients & exponents, respectively, evaluated on the grid points. Only returned if `deriv=True`. .. !! processed by numpydoc !! .. py:class:: MolecularGaussianDensity(points, coords, basis, normalize=False) Molecular Atom-Centered Gaussian Density Model. The Molecular Gaussian Density model is based on multiple centers each associated with a Gaussian density model (s or p-type) of any dimension. .. math:: f(x) := \sum_j \bigg[ \sum_{i =1}^{M^s_j} c_{ji} e^{-\alpha_{ji} |x - m_j|^2} + \sum_{i=1}^{M_j^p}d_{ji} |x - m_j|^2 e^{-\beta_{ji} |x - m_j|^2} \bigg] where :math:`c_{ji}, d_{ji}` are the ith coefficients of s-type and p-type functions of the jth center, :math:`\alpha_{ji}, \beta_{ji}` are the ith exponents of S-type and P-type functions of the jth center, :math:`M_j^s, M_j^p` is the total number of s-type or p-type Gaussians functions of the jth center respectively, :math:`m_j` is the coordinate of the jth center, and :math:`x` is the real coordinates of the point. It can be of any dimension. Construct the MolecularGaussianDensity class. :param points: The grid points, where N is the number of grid points and D is the dimension. :type points: ndarray, (N, D) :param coords: The atomic coordinates (M centers) on which Gaussian basis are centered. :type coords: ndarray, (M, D) :param basis: The number of S-type & P-type Gaussian basis functions placed on each center. :type basis: ndarray, (M, 2) :param normalize: Whether to normalize Gaussian basis functions. :type normalize: bool, optional .. !! processed by numpydoc !! .. py:method:: points(self) :property: Get grid points. .. !! processed by numpydoc !! .. py:method:: nbasis(self) :property: Get the total number of Gaussian basis functions. .. !! processed by numpydoc !! .. py:method:: radii(self) :property: Get the distance of grid points from center of each basis function. .. !! processed by numpydoc !! .. py:method:: natoms(self) :property: Get number of basis functions centers. .. !! processed by numpydoc !! .. py:method:: prefactor(self) :property: Get the pre-factor of Gaussian basis functions to make it normalized. Only used if attribute `normalize` is true. .. !! processed by numpydoc !! .. py:method:: assign_basis_to_center(self, index) Assign the Gaussian basis function to the atomic center. :param index: The index of Gaussian basis function. :type index: int :returns: **index** -- The index of atomic center. :rtype: int .. !! processed by numpydoc !! .. py:method:: evaluate(self, coeffs, expons, deriv=False) Compute linear combination of Gaussian basis & its derivatives on the grid points. The Molecular Gaussian is defined to be: .. math:: f(x) := \sum_j \bigg[ \sum_{i =1}^{M^s_j} c_{ji} e^{-\alpha_{ji} |x - m_j|^2} + \sum_{i=1}^{M_j^p}d_{ji} |x - m_j|^2 e^{-\beta_{ji} |x - m_j|^2} \bigg] where :math:`c_{ji}, d_{ji}` are the ith coefficients of s-type and p-type functions of the jth center, :math:`\alpha_{ji}, \beta_{ji}` are the ith exponents of S-type and P-type functions of the jth center, :math:`M_j^s, M_j^p` is the total number of s-type or p-type Gaussians functions of the jth center respectively, :math:`m_j` is the coordinate of the jth center, and :math:`x` is the real coordinates of the point. It can be of any dimension. :param coeffs: The coefficients of `num_s` s-type Gaussian basis functions followed by the coefficients of `num_p` p-type Gaussian basis functions for an atom, then repeat for the next atom. :type coeffs: ndarray, (`nbasis`,) :param expons: The exponents of `num_s` s-type Gaussian basis functions followed by the exponents of `num_p` p-type Gaussian basis functions for an atom, then repeat for the next atom. :type expons: ndarray, (`nbasis`,) :param deriv: Whether to compute derivative of Gaussian basis functions w.r.t. coefficients & exponents. :type deriv: bool, optional :returns: * **g** (*ndarray, (N,)*) -- The linear combination of Gaussian basis functions evaluated on the grid points. * **dg** (ndarray, (N, `nbasis`)) -- The derivative of linear combination of Gaussian basis functions w.r.t. coefficients & exponents, respectively, evaluated on the grid points. Only returned if `deriv=True`. .. !! processed by numpydoc !!