Uncertainty in the XC Inputs on a Grid

This page describes how SCF estimates the uncertainty in the quantities the XC modules evaluate at the grid points: today the density, \(\rho_i\), and the values of the atomic orbitals (AOs), \(\phi_{\mu i}\); for GGAs and beyond also, e.g., the gradient of the density. An error model estimates the uncertainty of each value, and the value is returned with that uncertainty attached, as a UQ type. How that uncertainty reaches the XC energy and potential, and how the error of the grid itself is handled, is described in Uncertainty in the XC Energy and Potential.

In the notation of Uncertainty in the XC Energy and Potential, this page covers the input errors, \(\delta E^{Inputs}\) and \(\delta V^{Inputs}\): the uncertainty of the values at the grid points. The error of the grid, i.e., the screening of the quadrature and its incompleteness, is attached to the XC energy and potential instead.

As in Uncertainty in the XC Energy and Potential, the UQ type is assumed to be an asymmetric interval (see Assumption: Asymmetric Intervals): it stores a lower bound, an upper bound, and a mean, which need not be the midpoint. For the density at a grid point, the mean is \(\rho_i\) and the bounds are \(\rho_i - \delta\rho_i^-\) and \(\rho_i + \delta\rho_i^+\).

What are the Density and AOs on a Grid?

Let \(\vec{r}_i\) be the \(i\)-th of \(N_g\) grid points, \(\phi_\mu\) the \(\mu\)-th of \(N_b\) AOs, and \(P_{\mu\nu}\) the total (i.e., summed over spin) AO density matrix. The density at \(\vec{r}_i\) is:

\[\rho_i \equiv \rho\left(\vec{r}_i\right) = \sum_{\mu\nu}^{N_b} \phi_{\mu i} P_{\mu\nu} \phi_{\nu i} = \boldsymbol{\phi}_i^T \mathbf{P} \boldsymbol{\phi}_i\]

where \(\phi_{\mu i} = \phi_\mu\left(\vec{r}_i\right)\) is an element of the AO collocation matrix, \(\boldsymbol{\Phi}\), and \(\boldsymbol{\phi}_i\) is its \(i\)-th column.

In SCF the collocation matrix is computed by the AOs on a grid module, which satisfies simde::AOCollocationMatrix. It evaluates every AO at every grid point. The density is computed by the Density2Grid module, which satisfies simde::EDensityCollocationMatrix. Its inputs are the grid and the density (a simde::type::e_density and the AO basis set). The matrix the e_density holds is not \(\mathbf{P}\): it is the restricted density matrix, \(\mathbf{D}\), formed from products of the occupied orbitals without a spin factor. Assuming restricted orbitals, Density2Grid forms \(\mathbf{P} = 2\mathbf{D}\), gets the collocation matrix from its "AOs on a grid" submodule, forms \(\mathbf{X} = \mathbf{P}\boldsymbol{\Phi}\), and takes the column-wise dot product of \(\boldsymbol{\Phi}\) and \(\mathbf{X}\). Its result is a tensor with one element per grid point. Error models that work with the density matrix must likewise double the stored matrix, and its uncertainty, before using it as \(\mathbf{P}\).

The XC modules use both: the density as the argument of the functional, and the collocation matrix to assemble the AO matrix of the potential.

Why Inputs Lose Precision

The value of \(\rho_i\) is uncertain for four reasons. The first two introduce error when \(\rho_i\) is evaluated. The third is uncertainty inherited from \(\mathbf{P}\).

  1. Floating-point error. \(\rho_i\) is a sum of \(N_b^2\) terms of both signs, since off-diagonal elements of \(\mathbf{P}\) can be negative. Where the terms nearly cancel, the sum is much smaller than its largest terms and if care is not taken the small terms will be lost in the rounding error.

  2. Screening. Production evaluators skip AOs whose value at a point is below a threshold, and skip blocks of \(\mathbf{P}\) that are small. This means that even if the \(i\)-th grid point is retained, \(\rho_i\) may contain an error due to dropping contributions from the collocation matrix and/or \(\mathbf{P}\).

  3. Uncertainty already in the AO quantities. The AOs and the AO density matrix may already carry uncertainty. This uncertainty propagates to the collocation matrix and the \(\rho_i\) computed from it.

  4. Uncertain grid points. Grid points may be uncertain, e.g., due to the floating point arithmetic used to compute their weights and locations.

Statement of Need

In Uncertainty in the XC Energy and Potential the uncertainty in the XC energy and potential due to their inputs follows from evaluating them with UQ types. That requires the inputs to carry their uncertainty, i.e., an error model for each input. None exists today. Sources of error were listed above.

Considerations

  1. Same inputs as the modules they replace

    • The modules that attach the uncertainty must be drop-in replacements for Density2Grid and AOs on a grid, so that the XC modules do not change. They therefore satisfy simde::EDensityCollocationMatrix and simde::AOCollocationMatrix.

  2. The evaluator is a choice

    • The algorithm that evaluates the quantity (Density2Grid today, a screened or GPU evaluator later) is chosen independently of the algorithm that estimates its uncertainty.

  3. The error model is a choice

    • Rigorous bounds, cheap bounds, and estimates all have uses. As in Uncertainty in the XC Energy and Potential, each source of uncertainty has its own error model, which is a submodule of the module that attaches the uncertainty, and the user chooses one by binding that submodule.

  4. Uncertainty at the grid points only

    • The error models estimate the uncertainty of the values at the grid points, not their variation between grid points, nor the effect of dropping grid points. Both belong to the error of the grid (see Uncertainty in the XC Energy and Potential).

  5. Sound physical constraints

    • The density is non-negative. Any uncertain density returned must keep its lower bound at or above zero, by intersecting with \([0, \infty)\), which can only remove values that can not be the true one. With an asymmetric interval this leaves the mean unchanged.

  6. Only sources of uncertainty know the uncertain type

    • As in Designing QCUP-SCF, the uncertain type comes from a UQ Initializer submodule rather than an input of its own. As in Uncertainty in the XC Energy and Potential, the error models create the uncertainty, so they are the modules that call UQ Initializer; the wrappers only receive results that are already uncertain.

  7. Ordinary DFT is unaffected

    • Nothing changes unless the user binds the new modules.

Grid Input UQ Implementation

Note

The initial implementation of QCUP-DFT will assume that the AOs and the AO density matrix have no uncertainty. Thus the modules in this section are not actually implemented yet, but the design is here to show how they are envisioned to work.

SCF will add two modules, UQ Density2Grid and UQ AOs on a grid, that follow the pattern of UQ XC Energy and UQ XC Potential in Uncertainty in the XC Energy and Potential. Each satisfies the same property type as the module it wraps, runs that module through an evaluator submodule, passes the result to one error-model submodule per source of uncertainty, and returns the uncertain result the error models produce. They are ordinary modules, not PluginPlay drivers because they only manage their inputs and their submodules.

The error models satisfy the XCUncertain<U> property type of Uncertainty in the XC Energy and Potential, with U the property type of the evaluator, i.e., XCUncertain<simde::EDensityCollocationMatrix> and XCUncertain<simde::AOCollocationMatrix>. Their inputs are the inputs of U followed by the result of the evaluator, so the evaluator is not run a second time. Their results are the result of the evaluator with uncertainties applied, i.e., each error model calls UQ Initializer, keeps the evaluator’s result as the mean, and attaches its deviations. The density error models also pin the lower bound at zero.

Further Considerations

  • GGAs and beyond. GGAs also need \(\nabla\rho_i = 2\sum_{\mu\nu}\nabla\phi_{\mu i}P_{\mu\nu}\phi_{\nu i}\) on the grid, and the gradient of the collocation matrix. The same strategies apply, with the gradient of the collocation matrix in place of one factor of it. Meta-GGAs add the kinetic-energy density, which is non-negative like the density and needs its lower bound pinned the same way.