MO Integrals#
- group DFMOIntegrals
Functions
- cuestStatus_t cuestDFMOIntegralsCompute(
- cuestHandle_t handle,
- cuestDFIntPlan_t plan,
- const cuestDFMOIntegralsComputeParameters_t parameters,
- const cuestWorkspaceDescriptor_t *variableBufferSize,
- cuestWorkspace_t *temporaryWorkspace,
- uint64_t numCoefficientMatrices,
- const uint64_t *numLeftOrbitals,
- const uint64_t *numRightOrbitals,
- const double *leftCoefficientMatrices,
- const double *rightCoefficientMatrices,
- double *outTensors
Transforms the 3-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, andCUEST_DFINTPLAN_PARAMETERS_LRC_EXCHANGE_OMEGAset in thecuestDFIntPlan_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 theCUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTINGattribute inparameters:CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING_FULL:(default) The tensors are fitted to the operator thecuestDFIntPlan_tdescribes, so that \( \sum_{A} B^{A}_{ia} B^{A}_{jb} \) reproduces the range-separated integrals given above, including both scale factors. AnycuestDFIntPlan_tcan serve this request.CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING_NONE:The integrals are fitted in the plan’s fitting metric only, without the operator weighting. The fitting metric is the unscaled Coulomb kernel, so that the returned tensors \( \sum_{A} \tilde{B}^{A}_{ia} \tilde{B}^{A}_{jb} \) reproduce \( (ia|\frac{1}{r}|jb) \), regardless of the scale factors set in thecuestDFIntPlan_t. Note that this suppresses the \( \sqrt{f_{\rm HF}} \) scaling thatCUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING_FULLapplies, so the two differ whenever \( f_{\rm HF} \neq 1 \), not only for a range-separated plan. This setting is required when obtaining integrals to form the three-index two-particle density matrices consumed bycuestDFMOIntegralsDerivativeCompute.
This routine never modifies
cuestDFIntPlan_t, so it may be called repeatedly with anyCUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTINGmode specified each time. The only restriction comes from what the plan’s cached three-center integrals can express: a cached plan created withCUEST_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 returnsCUEST_STATUS_INVALID_PLAN. Create the plan withCUEST_DFINTPLAN_PARAMETERS_CACHE_OPERATOR_WEIGHTING_NONEif it is to serve bothCUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTINGmodes. 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 theirCUEST_DFINTPLAN_PARAMETERS_CACHE_OPERATOR_WEIGHTINGsetting.This function supports the use of a
cuestDFIntPlan_tconstructed with theCUEST_DFINTPLAN_PARAMETERS_THREE_INDEX_INTEGRAL_DIRECTparameter set to either 0 or 1.All required temporary workspace must be sized using the corresponding workspace query function. A
variableBufferSizedescriptor must also be provided to constrain the memory usage.- Since
v0.2.0
- Parameters:
handle – [in] cuEST handle. Must not be NULL.
plan – [in] DF integral computation plan (opaque handle). Must not be NULL.
parameters – [in] Compute parameters (
cuestDFMOIntegralsComputeParameters_t). Must not be NULLCreate with
cuestParametersCreate()usingCUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS. Set attributes withcuestParametersConfigure().1 configurable attribute
CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTINGcuestDFMOIntegralsComputeParametersOperatorWeighting_tWhether the integrals carry the operator weighting.
Default:
CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING_FULL
variableBufferSize – [in] The variableBufferSize 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 the variableBufferSize does not limit total memory usage. The value of the variableBufferSize must not change between WorkspaceQuery and Compute calls.
temporaryWorkspace – [in] Temporary workspace buffers (preallocated for this operation using the query function). Must not be NULL.
numCoefficientMatrices – [in] Number of pairs of coefficient matrices. Must be > 0.
numLeftOrbitals – [in] Array of molecular orbital counts for each left coefficient matrix (size:
numCoefficientMatrices) on CPU. Each entry must be > 0. Must not be NULL.numRightOrbitals – [in] Array of molecular orbital counts for each right coefficient matrix (size:
numCoefficientMatrices) on CPU. Each entry must be > 0. Must not be NULL.leftCoefficientMatrices – [in] Concatenated left coefficient matrices. Each matrix has shape [
numLeftOrbitals[i], nao] on GPU. Total size: sum(numLeftOrbitals[i]) × nao. Must not be NULL.rightCoefficientMatrices – [in] Concatenated right coefficient matrices. Each matrix has shape [
numRightOrbitals[i], nao] on GPU. Total size: sum(numRightOrbitals[i]) × nao. Must not be NULL.outTensors – [out] Output concatenated MO integral tensors. Each tensor has shape [naux,
numLeftOrbitals[i],numRightOrbitals[i]] on GPU. Total size: naux × sum(numRightOrbitals[i] ×numLeftOrbitals[i]). Must not be NULL.
- Returns:
CUEST_STATUS_SUCCESSon success;CUEST_STATUS_INVALID_HANDLEif the cuEST handle is NULL;CUEST_STATUS_NULL_POINTERif any required pointer is NULL;CUEST_STATUS_INVALID_TYPEif opaque handles are not the correct type;CUEST_STATUS_INVALID_PLANif thecuestDFIntPlan_tis not correctly configured or in a dirty state;CUEST_STATUS_INVALID_ARGUMENTifnumCoefficientMatrices== 0, or anynumLeftOrbitals[i] == 0, or anynumRightOrbitals[i] == 0, or if a parameter value is invalid;CUEST_STATUS_EXCEPTIONorCUEST_STATUS_UNKNOWN_ERRORotherwise.
- cuestStatus_t cuestDFMOIntegralsComputeWorkspaceQuery(
- cuestHandle_t handle,
- cuestDFIntPlan_t plan,
- const cuestDFMOIntegralsComputeParameters_t parameters,
- const cuestWorkspaceDescriptor_t *variableBufferSize,
- cuestWorkspaceDescriptor_t *temporaryWorkspaceDescriptor,
- uint64_t numCoefficientMatrices,
- const uint64_t *numLeftOrbitals,
- const uint64_t *numRightOrbitals,
- const double *leftCoefficientMatrices,
- const double *rightCoefficientMatrices,
- double *outTensors
Query the temporary workspace required to transform the 3-index density fitting tensor from the AO basis to the MO basis.
This function determines the workspace required to perform an AO to MO transform of the DF 3-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
cuestDFMOIntegralsCompute.Some input pointers (
coefficientMatricesandoutTensors) are optional and may be NULL.- Since
v0.2.0
- Parameters:
handle – [in] cuEST handle. Must not be NULL.
plan – [in] DF integral computation plan (opaque handle). Must not be NULL.
parameters – [in] Compute parameters (
cuestDFMOIntegralsComputeParameters_t). Must not be NULLCreate with
cuestParametersCreate()usingCUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS. Set attributes withcuestParametersConfigure().1 configurable attribute
CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTINGcuestDFMOIntegralsComputeParametersOperatorWeighting_tWhether the integrals carry the operator weighting.
Default:
CUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING_FULL
variableBufferSize – [in] The variableBufferSize 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 the variableBufferSize does not limit total memory usage. The value of the variableBufferSize must not change between WorkspaceQuery and Compute calls.
temporaryWorkspaceDescriptor – [out] Output descriptor for required temporary workspace sizes (host and device). Must not be NULL.
numCoefficientMatrices – [in] Number of pairs of coefficient matrices. Must be > 0.
numLeftOrbitals – [in] Array of molecular orbital counts for each left coefficient matrix (size:
numCoefficientMatrices) on CPU. Each entry must be > 0. Must not be NULL.numRightOrbitals – [in] Array of molecular orbital counts for each right coefficient matrix (size:
numCoefficientMatrices) on CPU. Each entry must be > 0. Must not be NULL.leftCoefficientMatrices – Concatenated left coefficient matrices. Each matrix has shape [
numLeftOrbitals[i], nao] on GPU. Total size: sum(numLeftOrbitals[i]) × nao. May be NULL.rightCoefficientMatrices – Concatenated right coefficient matrices. Each matrix has shape [
numRightOrbitals[i], nao] on GPU. Total size: sum(numRightOrbitals[i]) × nao. May be NULL.outTensors – Output concatenated MO integral tensors. Each tensor has shape [naux,
numLeftOrbitals[i],numRightOrbitals[i]] on GPU. Total size: naux × sum(numRightOrbitals[i] ×numLeftOrbitals[i]). May be NULL.
- Returns:
CUEST_STATUS_SUCCESSon success;CUEST_STATUS_INVALID_HANDLEif the cuEST handle is NULL;CUEST_STATUS_NULL_POINTERif any required pointer is NULL;CUEST_STATUS_INVALID_TYPEif opaque handles are not the correct type;CUEST_STATUS_INVALID_PLANif thecuestDFIntPlan_tis not correctly configured or in a dirty state;CUEST_STATUS_INVALID_ARGUMENTifnumCoefficientMatrices== 0, or anynumLeftOrbitals[i] == 0, or anynumRightOrbitals[i] == 0, or if a parameter value is invalid;CUEST_STATUS_EXCEPTIONorCUEST_STATUS_UNKNOWN_ERRORotherwise.
- group DFMOIntegralsGrad
Functions
- cuestStatus_t cuestDFMOIntegralsDerivativeCompute(
- cuestHandle_t handle,
- cuestDFIntPlan_t plan,
- const cuestDFMOIntegralsDerivativeComputeParameters_t parameters,
- const cuestWorkspaceDescriptor_t *variableBufferSize,
- cuestWorkspace_t *temporaryWorkspace,
- uint64_t numCoefficientMatrices,
- const uint64_t *numLeftOrbitals,
- const uint64_t *numRightOrbitals,
- const double *leftCoefficientMatrices,
- const double *rightCoefficientMatrices,
- const double *threeCenterTPDMs,
- double *outGradient
Computes 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}\begin{aligned} (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{aligned} \end{split}\]where the unweighted factors and the operator weighting are
\[\begin{split}\begin{aligned} \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{aligned} \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
numCoefficientMatricesthree-index TPDMs, indexed by \( N \), and a pair of MO coefficient matrices corresponding to each. This routine then differentiates the scalar\[\begin{split}\begin{aligned} 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{aligned} \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}\begin{aligned} 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{aligned} \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_FRACTIONandCUEST_DFINTPLAN_PARAMETERS_LRC_EXCHANGE_OMEGAparameters 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
cuestDFMOIntegralsComputewith the same plan and theCUEST_DFMOINTEGRALSCOMPUTE_PARAMETERS_OPERATOR_WEIGHTING_NONEparameter. Nothing checks thatthreeCenterTPDMswere 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, withnumCoefficientMatrices= 2, \( \left[ C_\mathrm{occ}, C_\mathrm{vir} \right] \) as bothleftCoefficientMatricesandrightCoefficientMatrices, \( \left[ n_\mathrm{occ}, n_\mathrm{vir} \right] \) as bothnumLeftOrbitalsandnumRightOrbitals, and \( \left[ \Gamma_{ij}^A, \Gamma_{ab}^A \right] \) asthreeCenterTPDMs.The MO coefficients defining the spaces \( p,q \) are passed as
leftCoefficientMatricesandrightCoefficientMatricesrespectively; each is a contiguous array of MO coefficients concatenated along the (slow running) MO index for each of thenumCoefficientMatricesdensities in the batch, and the two spaces may differ in size. All MO coefficients must be consistent with the basis set used to create thecuestDFIntPlan_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 withCUEST_DFINTPLAN_PARAMETERS_CACHE_OPERATOR_WEIGHTING_NONE; otherwiseCUEST_STATUS_INVALID_PLANis returned. The same plan then serves thecuestDFMOIntegralsComputecalls that buildthreeCenterTPDMs. The MO basis integrals are transformed in batches over the \( p \) index whose width is governed byvariableBufferSize; avariableBufferSizetoo small to hold a single \( p \) batch returnsCUEST_STATUS_EXCEPTION; providing a largervariableBufferSizeresults in fewer batches needed to process the integrals and is particularly advantageous whenCUEST_DFINTPLAN_PARAMETERS_THREE_INDEX_INTEGRAL_DIRECTis nonzero.All required temporary workspaces must be sized using the corresponding workspace query function.
- Since
v0.3.0
- Parameters:
handle – [in] cuEST handle. Must not be NULL.
plan – [in] DF integral computation plan (opaque handle). Must not be NULL.
parameters – [in] Compute parameters (
cuestDFMOIntegralsDerivativeComputeParameters_t). Must not be NULL.Create with
cuestParametersCreate()usingCUEST_DFMOINTEGRALSDERIVATIVECOMPUTE_PARAMETERS. There are no configurable attributes.variableBufferSize – [in] The variableBufferSize determines the size of an internal scratch buffer used for MO integral transformations. A buffer of 2GB is a reasonable default value. Host memory is currently unused. Note that the variableBufferSize does not limit total memory usage. The value of the variableBufferSize must not change between WorkspaceQuery and Compute calls.
temporaryWorkspace – [in] Temporary workspace buffers (preallocated for this operation using the query function). Must not be NULL.
numCoefficientMatrices – [in] Number of density batches (pairs of coefficient matrices). Must be > 0.
numLeftOrbitals – [in] Array of molecular orbital counts for each left coefficient matrix (size:
numCoefficientMatrices) on CPU. Each entry must be > 0. Must not be NULL.numRightOrbitals – [in] Array of molecular orbital counts for each right coefficient matrix (size:
numCoefficientMatrices) on CPU. Each entry must be > 0. Must not be NULL.leftCoefficientMatrices – [in] Concatenated left coefficient matrices. Each matrix has shape [
numLeftOrbitals[i], nao] on GPU. Total size: sum(numLeftOrbitals[i]) × nao. Must not be NULL.rightCoefficientMatrices – [in] Concatenated right coefficient matrices. Each matrix has shape [
numRightOrbitals[i], nao] on GPU. Total size: sum(numRightOrbitals[i]) × nao. Must not be NULL.threeCenterTPDMs – [in] Concatenated three-center TPDMs. Each tensor has shape [naux,
numLeftOrbitals[i] *numRightOrbitals[i]] on GPU. Total size: naux × sum(numLeftOrbitals[i] *numRightOrbitals[i]). Read-only (not modified). Must not be NULL.outGradient – [out] Output gradient buffer (size: natom x 3) on GPU. Elements are overwritten with the computed gradient. Must not be NULL.
- Returns:
CUEST_STATUS_SUCCESSon success;CUEST_STATUS_INVALID_HANDLEif the cuEST handle is NULL;CUEST_STATUS_NULL_POINTERif any required pointer is NULL;CUEST_STATUS_INVALID_TYPEif opaque handles are not the correct type;CUEST_STATUS_INVALID_PLANif thecuestDFIntPlan_tis not correctly configured or in a dirty state;CUEST_STATUS_INVALID_ARGUMENTifnumCoefficientMatrices== 0, or anynumLeftOrbitals[i] == 0, or anynumRightOrbitals[i] == 0;CUEST_STATUS_EXCEPTIONorCUEST_STATUS_UNKNOWN_ERRORotherwise.
- cuestStatus_t cuestDFMOIntegralsDerivativeComputeWorkspaceQuery(
- cuestHandle_t handle,
- cuestDFIntPlan_t plan,
- const cuestDFMOIntegralsDerivativeComputeParameters_t parameters,
- const cuestWorkspaceDescriptor_t *variableBufferSize,
- cuestWorkspaceDescriptor_t *temporaryWorkspaceDescriptor,
- uint64_t numCoefficientMatrices,
- const uint64_t *numLeftOrbitals,
- const uint64_t *numRightOrbitals,
- const double *leftCoefficientMatrices,
- const double *rightCoefficientMatrices,
- const double *threeCenterTPDMs,
- double *outGradient
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,threeCenterTPDMsandoutGradient) are optional and may be NULL.- Since
v0.3.0
- Parameters:
handle – [in] cuEST handle. Must not be NULL.
plan – [in] DF integral computation plan (opaque handle). Must not be NULL.
parameters – [in] Compute parameters (
cuestDFMOIntegralsDerivativeComputeParameters_t). Must not be NULL.Create with
cuestParametersCreate()usingCUEST_DFMOINTEGRALSDERIVATIVECOMPUTE_PARAMETERS. There are no configurable attributes.variableBufferSize – [in] The variableBufferSize 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 the variableBufferSize does not limit total memory usage. The value of the variableBufferSize must not change between WorkspaceQuery and Compute calls.
temporaryWorkspaceDescriptor – [out] Output descriptor for required temporary workspace sizes (host and device). Must not be NULL.
numCoefficientMatrices – [in] Number of density batches (pairs of coefficient matrices). Must be > 0.
numLeftOrbitals – [in] Array of molecular orbital counts for each left coefficient matrix (size:
numCoefficientMatrices) on CPU. Each entry must be > 0. Must not be NULL.numRightOrbitals – [in] Array of molecular orbital counts for each right coefficient matrix (size:
numCoefficientMatrices) on CPU. Each entry must be > 0. Must not be NULL.leftCoefficientMatrices – Concatenated left coefficient matrices. Each matrix has shape [
numLeftOrbitals[i], nao] on GPU. May be NULL.rightCoefficientMatrices – Concatenated right coefficient matrices. Each matrix has shape [
numRightOrbitals[i], nao] on GPU. May be NULL.threeCenterTPDMs – Concatenated three-center TPDMs. Each tensor has shape [naux,
numLeftOrbitals[i] *numRightOrbitals[i]] on GPU. May be NULL.outGradient – Output gradient buffer (size: natom x 3) on GPU. May be NULL.
- Returns:
CUEST_STATUS_SUCCESSon success;CUEST_STATUS_INVALID_HANDLEif the cuEST handle is NULL;CUEST_STATUS_NULL_POINTERif any required pointer is NULL;CUEST_STATUS_INVALID_TYPEif opaque handles are not the correct type;CUEST_STATUS_INVALID_PLANif thecuestDFIntPlan_tis not correctly configured or in a dirty state;CUEST_STATUS_INVALID_ARGUMENTifnumCoefficientMatrices== 0, or anynumLeftOrbitals[i] == 0, or anynumRightOrbitals[i] == 0;CUEST_STATUS_EXCEPTIONorCUEST_STATUS_UNKNOWN_ERRORotherwise.