Molecular Orbital Basis Integrals in cuEST#
cuEST provides primitives for forming density-fitted (DF) integrals in the molecular orbital (MO) basis, and for evaluating derivative expressions involving them. See the Density Fitting section for an overview of the conventions used.
MO Integrals#
Within the DF approximation, the MO integrals for the (possibly range-separated) operator \(\eta\) are
The cuestDFMOIntegralsCompute() routine transforms the atomic orbital (AO)
basis DF factors to the MO basis using a pair of user-provided coefficient
matrices (left and right):
The output has shape [naux, nleft, nright]. The left coefficient matrix is
applied first, so the transformation is most efficient when nleft
\(\le\) nright. There is no restriction on the dimension of provided MO
spaces, but the AO dimension must be consistent with the orbital basis set used.
The transformation may be batched, allowing, e.g., occupied-virtual and
occupied-occupied factors to be generated in a single call. If the integral
plan was constructed in cached mode, its cached AO basis DF factors are used to
generate the transformed quantities; if sufficient memory is available, this is
the recommended approach, but the demands scale roughly quadratically with
system size. To save memory it is also possible to construct the integral plan
in integral-direct mode, which will result in the AO basis integrals being
recomputed on-the-fly as necessary.
MO Integral Derivatives#
Consider an energy expression written in terms of a four-index two-particle density matrix (TPDM), \(\Gamma^{rs}_{pq}\), contracted with the MO integrals.
The gradient with respect to nuclear coordinates \(x\) is taken at fixed MO coefficients and fixed \(\Gamma\).
This is the gradient provided by cuestDFMOIntegralsDerivativeCompute(). That
routine does not accept the four-index TPDM and it instead accepts the three-index
TPDM, formed by the user by contracting \(\mathbf{\Gamma}\) with DF integral factors
obtained from
cuestDFMOIntegralsCompute():
The precise nature of these DF integral factors depends on the details of the kernel, as we will discuss in the following subsections.
Simple Coulomb Kernels#
If we define \(J_{AB} = (A|B)\) and \(\tilde{B}_{pq}^A = \sum_C \left[J^{-1/2} \right]_{AC} (C|pq)\), a more explicit form of the energy expression above is
with the operator weighting term \(W_{AC} = \sum_{BD} \left[J^{-1/2} \right]_{AB} (B|\eta|D) \left[J^{-1/2} \right]_{DC}\).
For simple Coulomb kernels (\(f_{\rm HF} = 1\) and \(f_{\rm LRC} = 0\)), we have \((B|\eta|C) = J_{BC}\) and the weighting term becomes the identity \(W_{AD} = \delta_{AD}\). The \(\tilde{\mathbf{B}}\) are the DF factors of the simple Coulomb integrals and, for this simplified case, they are equivalent to the full DF factors \(\mathbf{B}\).
The resulting TPDM nuclear derivative term is
where pseudo-densities are the three-index TPDM back-transformed to the AO basis and metric-fitted,
and the two-index pseudo-density formed from the contraction of \(\Gamma\) with \(\tilde{B}\) over both MO indices,
This is all performed under the hood, and the equivalence of \(\tilde{\mathbf{B}}\) and \(\mathbf{B}\) for this special, but very common, case means there is no ambiguity in how terms are defined.
Symmetry and Batching#
A subtle detail of the preceding section is that by passing the pre-contracted
TPDM, we are only differentiating the first of the two DF factors, not the
factor that is pre-contracted with the four index TPDM. This is internally
accounted for by scaling the result, which tacitly assumes bra-ket symmetry of
the TPDM. For cases like \((ij|ab) \Gamma_{ij}^{ab}\) this assumption does
not hold and two terms should be explicitly computed instead:
\(\frac{1}{2}\left[ (ij|ab) \Gamma_{ij}^{ab} + (ab|ij)
\Gamma_{ab}^{ij}\right]\). As with cuestDFMOIntegralsCompute(),
cuestDFMOIntegralsDerivativeCompute() supports batching to allow these two
terms to be evaluated efficiently in a single call.
General Kernels#
For range-separated kernels (\(f_{\rm LRC} > 0\)), the weighting \(W\) is no longer simply the identity, and it is symmetrically folded into the \(\tilde{\mathbf{B}}\) factors to form the \(\mathbf{B}\) DF factors. The weighting term has a derivative associated with it, and an important consequence of this is that the TPDM must be dressed with the unweighted (Coulomb-only) DF factors
as opposed to the weighted DF factors representing the integral kernel of interest. The energy being differentiated is \(E = \sum_{pq}\sum_{AD} \tilde{B}^{A}_{pq} \, W_{AD} \, \Gamma^{D}_{pq}\) and the corresponding gradient expression becomes more elaborate than before:
The weighting enters the three-index pseudo-density,
and the two-index pseudo-densities are
with \(P[E,F] = \sum_{rs} \Gamma^{E}_{rs} \tilde{B}^{F}_{rs}\) as before.
By default, the integral plan caches the full weighted \(\mathbf{B}\)
factors so that the full DF integrals can be obtained by a single matrix
multiply. Trying to obtain \(\tilde{\mathbf{B}}\) from \(\mathbf{B}\)
is not numerically stable so we need to slightly change the caching behavior. If an integral plan with
cached integrals is to be used for computing MO derivatives, it must be
constructed with its CUEST_DFINTPLAN_PARAMETERS_CACHE_OPERATOR_WEIGHTING
flag set to CUEST_DFINTPLAN_PARAMETERS_CACHE_OPERATOR_WEIGHTING_NONE: this
instructs the plan to cache the \(\tilde{\mathbf{B}}\) instead of
\(\mathbf{B}\). When calling cuestDFMOIntegralsCompute() with such a
plan, setting its CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING
flag to CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING_FULL (the
default behavior) will apply any needed weighting terms on-the-fly to deliver
the full \(\mathbf{B}\) factors in the result. Setting that same
flag to CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING_NONE
yields the \(\tilde{\mathbf{B}}\) needed to form the three index TPDM as
described above.
Tip
While only strictly necessary when handling a non-Coulomb kernel, using
CUEST_DFINTPLAN_PARAMETERS_CACHE_OPERATOR_WEIGHTING_NONE when creating
the cuestDFIntPlan_t and
CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING_NONE argument
when calling cuestDFMOIntegralsCompute() in the simple Coulomb case has no
performance penalty. For this special case, the _FULL and _NONE
suffixed arguments have the exact same meaning. For consistency, we
therefore recommend these flags always be passed assuming the general case.