xnn.krnn.common.sgdml_fit#

Closed-form fit of a (s)GDML force field.

The forces of the training geometries are interpolated by the gradient of the kernel expansion of SGDML: with the descriptor Jacobians J_i and H(D) = g(r) I + t(r) D D^T (g = -k'/r, t = g'/r), the force-force block of the kernel matrix is

K_ij = -J_i^T sum_q H(x_i - P_q x_j) P_q J_j

and the coefficients solve (K - lam I) alpha = F / s (Chmiela et al., Sci. Adv. 3, e1603015, 2017, eq. 2), with s the standard deviation of the force components. With energy_constraint the energies join the system as extra rows (negated, which keeps the matrix symmetric). The system is solved by a Cholesky factorization of the positive-definite lam I - K (an LU solve when that fails). The integration constant is the mean deviation of the predicted training energies from their labels.

Functions

closed_under_inversion(perms)

Whether the inverse of every permutation is in the set (the kernel matrix is then symmetric).

fit_sgdml(model, graphs[, sigma, lam, ...])

Fit a (s)GDML model to the forces (and energies) of its molecule.

force_rmse(model, graphs)

Root-mean-square error of the predicted forces over graphs.

kernel_matrix(model, x, u[, ...])

The kernel matrix of the training set.

kernel_rows(model, x, u, idx[, ...])

The rows of the kernel matrix (kernel_matrix()) of the training geometries idx.