_predict_wkr#

mbgdml._gdml.predict._predict_wkr(r, r_desc_d_desc, lat_and_inv, glob_id, wkr_start_stop=None, chunk_size=None)[source]#

Compute (part) of a prediction.

Every prediction is a linear combination involving the training points used for this model. This function evaluates that combination for the range specified by wkr_start_stop. This workload can optionally be processed in chunks, which can be faster as it requires less memory to be allocated.

Note

It is sufficient to provide either the parameter r or r_desc_d_desc. The other one can be set to None.

Parameters:
  • r (numpy.ndarray) – An array of size 3N containing the Cartesian coordinates of each atom in the molecule.

  • r_desc_d_desc (tuple of numpy.ndarray) –

    A tuple made up of:

    (1) An array of size D containing the descriptors of dimension D for the molecule. (2) An array of size D x 3N containing the descriptor Jacobian for the molecules. It has dimension D with 3N partial derivatives with respect to the 3N Cartesian coordinates of each atom.

  • lat_and_inv (tuple of numpy.ndarray) – Tuple of 3 x 3 matrix containing lattice vectors as columns and its inverse.

  • glob_id (int) – Identifier of the global namespace that this function is supposed to be using (zero if only one instance of this class exists at the same time).

  • wkr_start_stop (tuple of int, optional) – Range defined by the indices of first and last (exclusive) sum element. The full prediction is generated if this parameter is not specified.

  • chunk_size (int, optional) – Chunk size. The whole linear combination is evaluated in a large vector operation instead of looping over smaller chunks if this parameter is left unspecified.

Returns:

Partial prediction of all force components and energy (appended to array as last element).

Return type:

numpy.ndarray