xnn.krnn.common.sgdml_fit.kernel_matrix#
- xnn.krnn.common.sgdml_fit.kernel_matrix(model, x, u, energy_constraint=False, full=True)[source]#
The kernel matrix of the training set.
The force block of training geometries
iandjis-sum_q [g_q J_i^T P_q J_j + t_q (J_i^T D_q) (D_q^T P_q J_j)]withD_q = x_i - P_q x_j. Every row of a descriptor Jacobian holds two atom blocks (u_don atoma_d,-u_don atomb_d), soJ_i^T P_q J_jis a sum of 3x3 outer productsu_i,d u_j,p(d)^Tplaced on the atom pairs, andJ_i^T D_qandD_q^T P_q J_jare the rows scaled byD_qand summed onto atoms. Both placements are products with sparse matrices of +1 and -1. The matrix is symmetric when the permutations are closed under inversion; only the blocksj >= iare formed then.- Parameters:
model (SGDML) – Supplies the kernel and the permutations.
x (Tensor) –
(M, D)training descriptors.u (Tensor) –
(M, D, 3)pair gradients of the descriptors (pair_gradients()).energy_constraint (bool, optional) – Append the (negated) energy rows and columns.
full (bool, optional) – Fill the whole matrix (the default).
Falseleaves the strict upper triangle of a symmetric matrix unset, which a Cholesky factorization does not read.
- Returns:
(3NM, 3NM), or(3NM + M, 3NM + M)with energies.- Return type:
Tensor