forte2.gradients.utils#

Module Contents#

forte2.gradients.utils.flat_to_atom_gradient(gradient, natoms)#

Convert a flat atom-major Cartesian gradient to (natoms, 3) shape.

Parameters:
gradientarray_like

Flat gradient vector with shape (3 * natoms,).

natomsint

Number of atoms.

Returns:
NDArray

Gradient array with shape (natoms, 3).

forte2.gradients.utils.nuclear_repulsion_deriv(atoms)#

Compute point-charge nuclear repulsion derivatives.

The derivative is returned in Hartree/Bohr for coordinates in Bohr:

\[\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:
atomslist[tuple[float, Sequence[float]]]

Nuclear charges and Cartesian centers.

Returns:
NDArray

Nuclear repulsion derivative with shape (natoms, 3).

forte2.gradients.utils.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:
systemSystem

The system for which to compute the gradient.

D1NDArray

The one-electron density matrix with shape (nbasis, nbasis).

W1NDArray

The energy-weighted density matrix with shape (nbasis, nbasis).

W2NDArray

The two-electron derivative weight for the metric with shape (naux, naux).

W3NDArray

The two-electron derivative weight for the three-center integrals with shape (naux, nbasis, nbasis).

Returns:
NDArray

Total gradient with shape (natoms, 3).

forte2.gradients.utils.build_metric_inverted_three_center(system)#

Computes the three-center integrals with the Coulomb metric inverse applied.

Compute the quantity \(Z^{P}_{\mu\nu}\) defined as:

\[Z^{P}_{\mu\nu} = \sum_{Q} M^{-1}_{PQ} (Q|\mu\nu).\]
Parameters:
systemSystem

The system for which to compute the metric-inverted three-center integrals.

Returns:
NDArray

Metric-inverted three-center integrals with shape (naux, nbasis, nbasis).

forte2.gradients.utils.apply_inverse_metric(system, M, J)#

Apply the density fitting metric inverse to a three-center tensor.