forte2.gradients.utils ====================== .. py:module:: forte2.gradients.utils Module Contents --------------- .. py:function:: flat_to_atom_gradient(gradient, natoms) Convert a flat atom-major Cartesian gradient to ``(natoms, 3)`` shape. :Parameters: **gradient** : array_like Flat gradient vector with shape ``(3 * natoms,)``. **natoms** : int Number of atoms. :Returns: NDArray Gradient array with shape ``(natoms, 3)``. .. !! processed by numpydoc !! .. py:function:: nuclear_repulsion_deriv(atoms) Compute point-charge nuclear repulsion derivatives. The derivative is returned in Hartree/Bohr for coordinates in Bohr: .. math:: \frac{\partial E_\mathrm{nuc}}{\partial R_{A\alpha}} = -\sum_{B \ne A} Z_A Z_B \frac{R_{A\alpha} - R_{B\alpha}}{|\mathbf{R}_A-\mathbf{R}_B|^3}. :Parameters: **atoms** : list[tuple[float, Sequence[float]]] Nuclear charges and Cartesian centers. :Returns: NDArray Nuclear repulsion derivative with shape ``(natoms, 3)``. .. !! processed by numpydoc !! .. py:function:: compute_gradient(system, D1, W1, W2, W3) Compute the total gradient from the one-electron density matrix and two-electron derivative weights. The returned gradient is in Hartree/Bohr for coordinates in Bohr. :Parameters: **system** : System The system for which to compute the gradient. **D1** : NDArray The one-electron density matrix with shape ``(nbasis, nbasis)``. **W1** : NDArray The energy-weighted density matrix with shape ``(nbasis, nbasis)``. **W2** : NDArray The two-electron derivative weight for the metric with shape ``(naux, naux)``. **W3** : NDArray The two-electron derivative weight for the three-center integrals with shape ``(naux, nbasis, nbasis)``. :Returns: NDArray Total gradient with shape ``(natoms, 3)``. .. !! processed by numpydoc !! .. py:function:: build_metric_inverted_three_center(system) Computes the three-center integrals with the Coulomb metric inverse applied. Compute the quantity :math:`Z^{P}_{\mu\nu}` defined as: .. math:: Z^{P}_{\mu\nu} = \sum_{Q} M^{-1}_{PQ} (Q|\mu\nu). :Parameters: **system** : System The system for which to compute the metric-inverted three-center integrals. :Returns: NDArray Metric-inverted three-center integrals with shape ``(naux, nbasis, nbasis)``. .. !! processed by numpydoc !! .. py:function:: apply_inverse_metric(system, M, J) Apply the density fitting metric inverse to a three-center tensor. .. !! processed by numpydoc !!