MO Integrals#

cuest.bindings.cuestDFMOIntegralsComputeWorkspaceQuery(
*,
handle: cuest.bindings.cuest.cuestHandle,
plan: cuest.bindings.cuest.cuestDFIntPlanHandle,
parameters: cuest.bindings.cuest.Parameters,
variableBufferSize: int,
temporaryWorkspaceDescriptor: int,
numCoefficientMatrices: int,
numLeftOrbitals: collections.abc.Sequence[int],
numRightOrbitals: collections.abc.Sequence[int],
leftCoefficientMatrices: cuest.bindings.cuest.Pointer,
rightCoefficientMatrices: cuest.bindings.cuest.Pointer,
outTensors: cuest.bindings.cuest.Pointer,
) → cuest.bindings.cuest.CuestStatus#

Query the temporary workspace required to transform the three-index density fitting tensor from the AO basis to the MO basis.

This function determines the workspace required to perform an AO → MO transformation of the DF three-index tensor with the given plan, coefficient matrices, and maximum workspace constraint. The output descriptor is filled on success and can be used to allocate host and device workspace buffers prior to calling the corresponding DF MO integral compute routine.

Some input pointers (coefficientMatrices and outTensors) are optional and may be NULL.

Parameters#

handle[in]cuestHandle

cuEST handle. Must not be NULL.

plan[in]cuestDFIntPlanHandle

Density-fitted integral plan (opaque handle) constructed with cuestDFIntPlanCreate(). Must not be NULL.

parameters[in]Parameters

Compute parameters handle (cuestDFMOIntegralsComputeParameters()) initialized by cuestParametersCreate() with CuestParametersType.CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS. Must not be NULL.

variableBufferSize[in]int

Determines the size of an internal scratch buffer used for certain transformations. A buffer of 2GB is a reasonable default value. Host memory is currently unused. Note that variableBufferSize does not limit total memory usage. The value of variableBufferSize must not change between WorkspaceQuery and Compute calls. Integer address of a cuestWorkspaceDescriptor_t structure (hostBufferSizeInBytes, deviceBufferSizeInBytes; both size_t), as implemented by WorkspaceDescriptor in cuda_utils.py.

temporaryWorkspaceDescriptor[out]int

Output descriptor for required temporary workspace sizes (host and device). Must not be NULL. Integer address of a cuestWorkspaceDescriptor_t structure (hostBufferSizeInBytes, deviceBufferSizeInBytes; both size_t), as implemented by WorkspaceDescriptor in cuda_utils.py.

numCoefficientMatrices[in]int

Number of pairs of coefficient matrices. Must be > 0.

numLeftOrbitals[in]List[int]

Number of molecular orbitals for each left coefficient matrix (size: numCoefficientMatrices) on the CPU. Each entry must be > 0. Must not be empty.

numRightOrbitals[in]List[int]

Number of molecular orbitals for each right coefficient matrix (size: numCoefficientMatrices) on the CPU. Each entry must be > 0. Must not be empty.

leftCoefficientMatricesPointer

Concatenated left coefficient matrices. Each matrix has shape (numLeftOrbitals[i] × nao) on the GPU. Total size: sum(numLeftOrbitals[i]) × nao. May be NULL.

rightCoefficientMatricesPointer

Concatenated right coefficient matrices. Each matrix has shape (numRightOrbitals[i] × nao) on the GPU. Total size: sum(numRightOrbitals[i]) × nao. May be NULL.

outTensorsPointer

Output concatenated MO integral tensors. Each tensor has shape (naux × numLeftOrbitals[i] × numRightOrbitals[i]) on the GPU. Total size: naux × sum(numRightOrbitals[i] × numLeftOrbitals[i]). May be NULL.

Returns#

status[out]CuestStatus
cuest.bindings.cuestDFMOIntegralsCompute(
*,
handle: cuest.bindings.cuest.cuestHandle,
plan: cuest.bindings.cuest.cuestDFIntPlanHandle,
parameters: cuest.bindings.cuest.Parameters,
variableBufferSize: int,
temporaryWorkspace: int,
numCoefficientMatrices: int,
numLeftOrbitals: collections.abc.Sequence[int],
numRightOrbitals: collections.abc.Sequence[int],
leftCoefficientMatrices: cuest.bindings.cuest.Pointer,
rightCoefficientMatrices: cuest.bindings.cuest.Pointer,
outTensors: cuest.bindings.cuest.Pointer,
) → cuest.bindings.cuest.CuestStatus#

Transform the three-index density fitting tensor from the AO basis to the MO basis.

This routine transforms three-index AO integrals into the MO basis within the density fitting representation. Pairs of coefficient matrices are taken as input.

Starting from a density-fitted representation of the AO integrals:

\[\left[ f_{\rm HF} (\mu\nu|\frac{1}{r}|\lambda\sigma) + f_{\rm LRC} (\mu\nu|\frac{{\rm erf}(\omega r)}{r}|\lambda\sigma) \right] = \sum_{A} B^{A}_{\mu\nu} B^{A}_{\lambda\sigma}\]

This function performs the transformation:

\[B^{A}_{ia} = \sum_{\mu\nu} B^{A}_{\mu\nu} C(L)_{i\mu} C(R)_{a\nu}\]

The resulting tensors can be used to directly construct 4-index MO integrals by contracting over the auxiliary index.

\[\left[ f_{\rm HF} (ia|\frac{1}{r}|jb) + f_{\rm LRC} (ia|\frac{{\rm erf}(\omega r)}{r}|jb) \right] = \sum_{A} B^{A}_{ia} B^{A}_{jb}\]

The transformation is most efficient when the MO dimension of C(L) is smaller than the MO dimension of C(R), as C(L) is applied first. The resulting tensor is transformed by the fitting metric.

Multiple MO integral tensors can be evaluated in a single function call. By default the resulting MO integral tensors respect the values of CUEST_DFINTPLAN_PARAMETERS_EXCHANGE_FRACTION, CUEST_DFINTPLAN_PARAMETERS_LRC_EXCHANGE_FRACTION, and CUEST_DFINTPLAN_PARAMETERS_LRC_EXCHANGE_OMEGA set in the cuestDFIntPlan_t.

As detailed in the documentation for cuestDFMOIntegralsDerivativeCompute(), each \(\mathbf{B}\) tensor can be expressed as a product of the factors arising from the fitting metric and an operator weighting term that describes the range-separated part of the kernel, if \(f_{\rm LRC} > 0\). Since v0.3.0, whether the tensors include the operator weighting can be specified by setting the CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING attribute in parameters:

This routine never modifies cuestDFIntPlan_t, so it may be called repeatedly with any CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING mode specified each time. The only restriction comes from what the plan’s cached three-center integrals can express: a cached plan created with CUEST_DFINTPLAN_PARAMETERS_CACHE_OPERATOR_WEIGHTING_FULL (the default) stores integral factors that include the \(\omega\) dependent weight terms, if \(f_{\rm LRC} > 0\); those cannot be removed, so an unweighted request against such a plan returns CUEST_STATUS_INVALID_PLAN. Create the plan with CUEST_DFINTPLAN_PARAMETERS_CACHE_OPERATOR_WEIGHTING_NONE if it is to serve both CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING modes. However, note that such a plan cannot build exchange matrices or J/K gradients, which need the cache to hold the full operator. Plans with \(f_{\rm LRC}=0\), and integral direct plans, serve both settings whatever their CUEST_DFINTPLAN_PARAMETERS_CACHE_OPERATOR_WEIGHTING setting.

This function supports the use of a cuestDFIntPlan_t constructed with the CUEST_DFINTPLAN_PARAMETERS_THREE_INDEX_INTEGRAL_DIRECT parameter set to either 0 or 1.

All required temporary workspace must be sized using the corresponding workspace query function. A variableBufferSize descriptor must also be provided to constrain the memory usage.

Parameters#

handle[in]cuestHandle

cuEST handle. Must not be NULL.

plan[in]cuestDFIntPlanHandle

Density-fitted integral plan (opaque handle) constructed with cuestDFIntPlanCreate(). Must not be NULL.

parameters[in]Parameters

Compute parameters handle (cuestDFMOIntegralsComputeParameters()) initialized by cuestParametersCreate() with CuestParametersType.CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS. Must not be NULL.

variableBufferSize[in]int

Determines the size of an internal scratch buffer used for certain transformations. A buffer of 2GB is a reasonable default. Host memory is currently unused. Note that variableBufferSize does not limit total memory usage. The value must not change between WorkspaceQuery and Compute calls. Integer address of a cuestWorkspaceDescriptor_t structure (hostBufferSizeInBytes, deviceBufferSizeInBytes; both size_t), as implemented by WorkspaceDescriptor in cuda_utils.py.

temporaryWorkspace[in]int

Temporary workspace buffers (preallocated using the query function). Must not be NULL. Integer address of a cuestWorkspace_t structure (hostBuffer, hostBufferSizeInBytes, deviceBuffer, deviceBufferSizeInBytes), as implemented by Workspace in cuda_utils.py.

numCoefficientMatrices[in]int

Number of pairs of coefficient matrices. Must be > 0.

numLeftOrbitals[in]List[int]

Number of molecular orbitals for each left coefficient matrix (size: numCoefficientMatrices) on the CPU. Each entry must be > 0. Must not be empty.

numRightOrbitals[in]List[int]

Number of molecular orbitals for each right coefficient matrix (size: numCoefficientMatrices) on the CPU. Each entry must be > 0. Must not be empty.

leftCoefficientMatrices[in]Pointer

Concatenated left coefficient matrices. Each matrix has shape (numLeftOrbitals[i] × nao) on the GPU. Total size: sum(numLeftOrbitals[i]) × nao. Must not be NULL.

rightCoefficientMatrices[in]Pointer

Concatenated right coefficient matrices. Each matrix has shape (numRightOrbitals[i] × nao) on the GPU. Total size: sum(numRightOrbitals[i]) × nao. Must not be NULL.

outTensors[out]Pointer

Output concatenated MO integral tensors. Each tensor has shape (naux × numLeftOrbitals[i] × numRightOrbitals[i]) on the GPU. Total size: naux × sum(numLeftOrbitals[i] × numRightOrbitals[i]). Must not be NULL.

Returns#

status[out]CuestStatus
cuest.bindings.cuestDFMOIntegralsDerivativeComputeWorkspaceQuery(
*,
handle: cuest.bindings.cuest.cuestHandle,
plan: cuest.bindings.cuest.cuestDFIntPlanHandle,
parameters: cuest.bindings.cuest.Parameters,
variableBufferSize: int,
temporaryWorkspaceDescriptor: int,
numCoefficientMatrices: int,
numLeftOrbitals: collections.abc.Sequence[int],
numRightOrbitals: collections.abc.Sequence[int],
leftCoefficientMatrices: cuest.bindings.cuest.Pointer,
rightCoefficientMatrices: cuest.bindings.cuest.Pointer,
threeCenterTPDMs: cuest.bindings.cuest.Pointer,
outGradient: cuest.bindings.cuest.Pointer,
) → cuest.bindings.cuest.CuestStatus#

Query the temporary workspace required for a density-fitted MO/TPDM nuclear gradient computation.

This function determines the workspace required to evaluate the MO/TPDM gradient with the given plan, coefficient matrices, TPDMs, and maximum workspace constraint. The output descriptor is filled on success and can be used to allocate host and device workspace buffers prior to calling cuestDFMOIntegralsDerivativeCompute().

Some input pointers (leftCoefficientMatrices, rightCoefficientMatrices, threeCenterTPDMs and outGradient) are optional and may be NULL.

Parameters#

handle[in]cuestHandle

cuEST handle. Must not be NULL.

plan[in]cuestDFIntPlanHandle

Density-fitted integral plan (opaque handle) constructed with cuestDFIntPlanCreate(). Must not be NULL.

parameters[in]Parameters

Compute parameters handle (cuestDFMOIntegralsDerivativeComputeParameters()) initialized by cuestParametersCreate() with CuestParametersType.CUEST_DFMOINTEGRALSDERIVATIVECOMPUTE_PARAMETERS. Must not be NULL.

variableBufferSize[in]int

Determines the size of an internal scratch buffer used for MO transformations. A buffer of 2GB is a reasonable default value. Host memory is currently unused. Note that variableBufferSize does not limit total memory usage. The value of variableBufferSize must not change between WorkspaceQuery and Compute calls. Integer address of a cuestWorkspaceDescriptor_t structure (hostBufferSizeInBytes, deviceBufferSizeInBytes; both size_t), as implemented by WorkspaceDescriptor in cuda_utils.py.

temporaryWorkspaceDescriptor[out]int

Output descriptor for required temporary workspace sizes (host and device). Must not be NULL. Integer address of a cuestWorkspaceDescriptor_t structure (hostBufferSizeInBytes, deviceBufferSizeInBytes; both size_t), as implemented by WorkspaceDescriptor in cuda_utils.py.

numCoefficientMatrices[in]int

Number of density batches (pairs of coefficient matrices). Must be > 0.

numLeftOrbitals[in]List[int]

Number of molecular orbitals for each left coefficient matrix (size: numCoefficientMatrices) on the CPU. Each entry must be > 0. Must not be empty.

numRightOrbitals[in]List[int]

Number of molecular orbitals for each right coefficient matrix (size: numCoefficientMatrices) on the CPU. Each entry must be > 0. Must not be empty.

leftCoefficientMatricesPointer

Concatenated left coefficient matrices. Each matrix has shape (numLeftOrbitals[i] × nao) on the GPU. May be NULL.

rightCoefficientMatricesPointer

Concatenated right coefficient matrices. Each matrix has shape (numRightOrbitals[i] × nao) on the GPU. May be NULL.

threeCenterTPDMsPointer

Concatenated three-center TPDMs. Each tensor has shape (naux × numLeftOrbitals[i] * numRightOrbitals[i]) on the GPU. May be NULL.

outGradientPointer

Output gradient buffer (size: natom × 3) on the GPU. May be NULL.

Returns#

status[out]CuestStatus
cuest.bindings.cuestDFMOIntegralsDerivativeCompute(
*,
handle: cuest.bindings.cuest.cuestHandle,
plan: cuest.bindings.cuest.cuestDFIntPlanHandle,
parameters: cuest.bindings.cuest.Parameters,
variableBufferSize: int,
temporaryWorkspace: int,
numCoefficientMatrices: int,
numLeftOrbitals: collections.abc.Sequence[int],
numRightOrbitals: collections.abc.Sequence[int],
leftCoefficientMatrices: cuest.bindings.cuest.Pointer,
rightCoefficientMatrices: cuest.bindings.cuest.Pointer,
threeCenterTPDMs: cuest.bindings.cuest.Pointer,
outGradient: cuest.bindings.cuest.Pointer,
) → cuest.bindings.cuest.CuestStatus#

Compute the nuclear gradient of a density-fitted energy expressed as a two-particle density matrix (TPDM) contracted through the three-center integrals, in the MO basis.

The molecular orbital (MO) basis integrals, density-fitted in the Coulomb metric, can be written as

\[\begin{split}(pq|\eta|rs) &\equiv f_{\rm HF} (pq|\frac{1}{r}|rs) + f_{\rm LRC} (pq|\frac{{\rm erf}(\omega r)}{r}|rs) \\ &\approx \sum_{ABCD} (pq|A) \left[ J^{-1} \right]_{AB} (B|\eta|C) \left[ J^{-1} \right]_{CD} (D|rs) \\ &= \sum_{AD} \tilde{B}^{A}_{pq} \, W_{AD} \, \tilde{B}^{D}_{rs} \\ &= \sum_{A} B^{A}_{pq} B^{A}_{rs},\end{split}\]

where the unweighted factors and the operator weighting are

\[\begin{split}\tilde{B}^{A}_{pq} &= \sum_{C} \left[ J^{-1/2} \right]_{AC} (C|pq), \\ W_{AD} &= \sum_{BC} \left[ J^{-1/2} \right]_{AB} (B|\eta|C) \left[ J^{-1/2} \right]_{DC}, \\ (B|\eta|C) &= f_{\rm HF} J_{BC} + f_{\rm LRC} (B|\frac{{\rm erf}(\omega r)}{r}|C), \\ J_{BC} &= (B|\frac{1}{r}|C),\end{split}\]

and the final step folds the operator weighting into the unweighted factors \(\tilde{B}\) to form the \(B\) factors. For kernels with \(f_{\rm LRC}=0\), \((B|\eta|C) = f_{\rm HF} J_{BC}\), the weighting \(W\) becomes simply an identity matrix scaled by \(f_{\rm HF}\), and \(B = \sqrt{f_{\rm HF}} \, \tilde{B}\). The \(\tilde{B}\) are therefore the density fitting factors of the bare Coulomb integrals.

The three-index two-particle density matrix (TPDM) is defined as

\[\Gamma^{A}_{pq} \equiv \sum_{rs} \Gamma^{rs}_{pq} \, \tilde B^{A}_{rs}\]

and this routine receives an ensemble of numCoefficientMatrices three-index TPDMs, indexed by \(N\), and a pair of MO coefficient matrices corresponding to each. This routine then differentiates the scalar

\[\begin{split}E &= \sum_{N} \sum_{pq}\sum_{AD} \tilde{B}^A_{pq} \, W_{AD} \, \Gamma[N]^{D}_{pq} \\ &= \sum_{N} \sum_{pqrs}\sum_{A} B^A_{pq} B^A_{rs} \Gamma[N]^{rs}_{pq}\end{split}\]

with respect to the nuclear coordinates \(R\) of the basis function centers, where the \(B\) are the factorized integrals with the operator weighting included, as defined above. The derivative is taken at fixed MO coefficients and with the four-index TPDM \(\Gamma[N]^{rs}_{pq}\) held fixed.

The resulting gradient overwrites outGradient.

The derivative of \(E\) can be written in the AO basis:

\[\frac{dE}{dx} = \sum_{A,\mu\nu} (A|\mu\nu)^{x} \, P_3[A,\mu\nu] + \sum_{AB} (A|B)^{x} \, P_2[A,B] + \sum_{AB} (A|\frac{{\rm erf}(\omega r)}{r}|B)^{x} \, P_2^{\omega}[A,B],\]

where \(x\) denotes a generic nuclear perturbation and \(\mu,\nu\) are AO indices. The three-index pseudo-density is \(\Gamma\) weighted, metric-fitted and back-transformed to the AO basis,

\[P_3[A,\mu\nu] = 2 \sum_{N} \sum_{pq} C_1[N]_{p\mu} \, C_2[N]_{q\nu} \sum_{BD} \left[ J^{-1/2} \right]_{BA} W_{BD} \, \Gamma[N]^{D}_{pq},\]

and the two-index pseudo-densities are metric-fitted sandwiches of the contraction of \(\Gamma\) against \(\tilde{B}\) over both MO indices,

\[\begin{split}P[E,F] &= \sum_{N} \sum_{rs} \Gamma[N]^{E}_{rs} \, \tilde{B}[N]^{F}_{rs}, \\ P_2[A,B] &= \sum_{EF} \left[ J^{-1/2} \right]_{EA} \left( f_{\rm HF} P[E,F] - 2 \sum_{G} P[E,G] \, W_{GF} \right) \left[ J^{-1/2} \right]_{FB}, \\ P_2^{\omega}[A,B] &= f_{\rm LRC} \sum_{EF} \left[ J^{-1/2} \right]_{EA} P[E,F] \left[ J^{-1/2} \right]_{FB}.\end{split}\]

For \(f_{\rm LRC} = 0\) the weighting reduces to \(W = f_{\rm HF} I\), the attenuated term vanishes, and these become \(P_3 = 2 f_{\rm HF} \sum C_1 C_2 \left[ J^{-1/2} \right]^{T} \Gamma\) and \(P_2 = -f_{\rm HF} \left[ J^{-1/2} \right]^{T} P \left[ J^{-1/2} \right]\). The factor of two in \(P_3\) is discussed below. Every pseudo-density is accumulated over the whole batch before any derivative integral is evaluated, so grouping several TPDMs into one call costs a single set of derivative integral evaluations rather than one set per density.

The operator’s parameters \(f_{\rm HF}\), \(f_{\rm LRC}\), and \(\omega\) are taken from the CUEST_DFINTPLAN_PARAMETERS_EXCHANGE_FRACTION, CUEST_DFINTPLAN_PARAMETERS_LRC_EXCHANGE_FRACTION and CUEST_DFINTPLAN_PARAMETERS_LRC_EXCHANGE_OMEGA parameters respectively.

The operator weighting is supplied entirely by the integral plan passed to this routine. The \(\tilde B^{A}_{rs}\) used to form \(\Gamma^{A}_{pq}\) must therefore be the unweighted integrals, irrespective of the operator the plan describes. To obtain them, call cuestDFMOIntegralsCompute() with the same plan and the CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING_NONE parameter. Nothing checks that threeCenterTPDMs were built this way; TPDMs formed from weighted integrals, or from another plan, silently produce an incorrect gradient.

Note that no scale factors beyond those that define the integral kernel are applied on the caller’s behalf. Since the result is linear in threeCenterTPDMs, any pair symmetry or spin prefactor may be applied either by folding it into the supplied three-center TPDMs or by scaling the resulting gradient, as appropriate.

The factor of two in \(P_3\) above accounts for the fact that both \(\tilde{B}\) factors in the energy are differentiated, which is evaluated as the bra derivative doubled. Passing a ket-contracted TPDM therefore carries an implicit assumption that \(\Gamma[N]^{rs}_{pq} = \Gamma[N]^{pq}_{rs}\) (bra-ket symmetry). To process a term where this does not hold, e.g.

\[\sum_{ijab} (ij|\eta|ab) \, \Gamma^{ab}_{ij}\]

where \(i,j\) are occupied and \(a,b\) are virtual orbitals, a couple of strategies are possible. First, the full \(\Gamma_{pq}^{rs}\) could be formed, with \(\frac{1}{2} \Gamma_{ij}^{ab}\) placed in both its \((ij,ab)\) and \((ab,ij)\) blocks and zeros elsewhere. A more memory efficient approach is to form \(\Gamma_{ij}^A = \frac{1}{2} \sum_{a,b} \tilde{B}_{ab}^A \Gamma_{ij}^{ab}\) and \(\Gamma_{ab}^A = \frac{1}{2} \sum_{i,j} \tilde{B}_{ij}^A \Gamma_{ij}^{ab}\) and pass them as a batch of two, with numCoefficientMatrices = 2, \(\left[ C_\mathrm{occ}, C_\mathrm{vir} \right]\) as both leftCoefficientMatrices and rightCoefficientMatrices, \(\left[ n_\mathrm{occ}, n_\mathrm{vir} \right]\) as both numLeftOrbitals and numRightOrbitals, and \(\left[ \Gamma_{ij}^A, \Gamma_{ab}^A \right]\) as threeCenterTPDMs.

The MO coefficients defining the spaces \(p,q\) are passed as leftCoefficientMatrices and rightCoefficientMatrices respectively; each is a contiguous array of MO coefficients concatenated along the (slow running) MO index for each of the numCoefficientMatrices densities in the batch, and the two spaces may differ in size. All MO coefficients must be consistent with the basis set used to create the cuestDFIntPlan_t.

The non-derivative three-center integrals needed to rebuild \(\tilde{B}\) are obtained either integral direct or from the AO quantities cached in the plan, according to CUEST_DFINTPLAN_PARAMETERS_THREE_INDEX_INTEGRAL_DIRECT. Like \(\tilde B^{A}_{rs}\) above, they must be unweighted, so a range-separated caching plan must be created with CUEST_DFINTPLAN_PARAMETERS_CACHE_OPERATOR_WEIGHTING_NONE; otherwise CUEST_STATUS_INVALID_PLAN is returned. The same plan then serves the cuestDFMOIntegralsCompute() calls that build threeCenterTPDMs. The MO basis integrals are transformed in batches over the \(p\) index whose width is governed by variableBufferSize; a variableBufferSize too small to hold a single \(p\) batch returns CUEST_STATUS_EXCEPTION; providing a larger variableBufferSize results in fewer batches needed to process the integrals and is particularly advantageous when CUEST_DFINTPLAN_PARAMETERS_THREE_INDEX_INTEGRAL_DIRECT is nonzero.

All required temporary workspace must be sized using the corresponding workspace query function.

Parameters#

handle[in]cuestHandle

cuEST handle. Must not be NULL.

plan[in]cuestDFIntPlanHandle

Density-fitted integral plan (opaque handle) constructed with cuestDFIntPlanCreate(). Must not be NULL.

parameters[in]Parameters

Compute parameters handle (cuestDFMOIntegralsDerivativeComputeParameters()) initialized by cuestParametersCreate() with CuestParametersType.CUEST_DFMOINTEGRALSDERIVATIVECOMPUTE_PARAMETERS. Must not be NULL.

variableBufferSize[in]int

Determines the size of an internal scratch buffer used for MO integral transformations. A buffer of 2GB is a reasonable default. Host memory is currently unused. Note that variableBufferSize does not limit total memory usage. The value must not change between WorkspaceQuery and Compute calls. Integer address of a cuestWorkspaceDescriptor_t structure (hostBufferSizeInBytes, deviceBufferSizeInBytes; both size_t), as implemented by WorkspaceDescriptor in cuda_utils.py.

temporaryWorkspace[in]int

Temporary workspace buffers (preallocated using the query function). Must not be NULL. Integer address of a cuestWorkspace_t structure (hostBuffer, hostBufferSizeInBytes, deviceBuffer, deviceBufferSizeInBytes), as implemented by Workspace in cuda_utils.py.

numCoefficientMatrices[in]int

Number of density batches (pairs of coefficient matrices). Must be > 0.

numLeftOrbitals[in]List[int]

Number of molecular orbitals for each left coefficient matrix (size: numCoefficientMatrices) on the CPU. Each entry must be > 0. Must not be empty.

numRightOrbitals[in]List[int]

Number of molecular orbitals for each right coefficient matrix (size: numCoefficientMatrices) on the CPU. Each entry must be > 0. Must not be empty.

leftCoefficientMatrices[in]Pointer

Concatenated left coefficient matrices. Each matrix has shape (numLeftOrbitals[i] × nao) on the GPU. Total size: sum(numLeftOrbitals[i]) × nao. Must not be NULL.

rightCoefficientMatrices[in]Pointer

Concatenated right coefficient matrices. Each matrix has shape (numRightOrbitals[i] × nao) on the GPU. Total size: sum(numRightOrbitals[i]) × nao. Must not be NULL.

threeCenterTPDMs[in]Pointer

Concatenated three-center TPDMs. Each tensor has shape (naux × numLeftOrbitals[i] * numRightOrbitals[i]) on the GPU. Total size: naux × sum(numLeftOrbitals[i] × numRightOrbitals[i]). Read-only (not modified). Must not be NULL.

outGradient[out]Pointer

Output gradient buffer (size: natom × 3) on the GPU. Elements are overwritten with the computed gradient. Must not be NULL.

Returns#

status[out]CuestStatus