Predict

Helper functions which obtain forces and energies corresponding to atoms in structures. These functions automatically cast atoms into their respective atomic environments.

flare.bffs.gp.predict.predict_on_atom(param: Tuple[FLARE_Atoms, int, GaussianProcess])

Return the forces/std. dev. uncertainty associated with an individual atom in a structure, without necessarily having cast it to a chemical environment. In order to work with other functions, all arguments are passed in as a tuple.

Parameters

param (Tuple(FLARE_Atoms, integer, GaussianProcess)) – tuple of FLARE FLARE_Atoms, atom index, and Gaussian Process object

Returns

3-element force array and associated uncertainties

Return type

(np.ndarray, np.ndarray)

flare.bffs.gp.predict.predict_on_atom_efs(param)

Predict the local energy, forces, and partial stresses and predictive variances of a chemical environment.

flare.bffs.gp.predict.predict_on_atom_en(param: ~typing.Tuple[~flare.atoms.FLARE_Atoms, int, ~flare.bffs.gp.gp.GaussianProcess]) -> ('np.ndarray', 'np.ndarray', <class 'float'>)

Return the forces/std. dev. uncertainty / energy associated with an individual atom in a structure, without necessarily having cast it to a chemical environment. In order to work with other functions, all arguments are passed in as a tuple.

Parameters

param (Tuple(FLARE_Atoms, integer, GaussianProcess)) – tuple of FLARE FLARE_Atoms, atom index, and Gaussian Process object

Returns

3-element force array, associated uncertainties, and local energy

Return type

(np.ndarray, np.ndarray, float)

flare.bffs.gp.predict.predict_on_atom_en_std(param)

Predict local energy and predictive std of a chemical environment.

flare.bffs.gp.predict.predict_on_structure(structure: FLARE_Atoms, gp: GaussianProcess, n_cpus: Optional[int] = None, write_to_structure: bool = True, selective_atoms: Optional[List[int]] = None, skipped_atom_value=0)

Return the forces/std. dev. uncertainty associated with each individual atom in a structure. Forces are stored directly to the structure and are also returned.

Parameters
  • structure – FLARE structure to obtain forces for, with N atoms

  • gp – Gaussian Process model

  • write_to_structure – Write results to structure’s forces, std attributes

  • selective_atoms – Only predict on these atoms; e.g. [0,1,2] will only predict and return for those atoms

  • skipped_atom_value – What value to use for atoms that are skipped. Defaults to 0 but other options could be e.g. NaN. Will NOT write this to the structure if write_to_structure is True.

Returns

N x 3 numpy array of foces, Nx3 numpy array of uncertainties

Return type

(np.ndarray, np.ndarray)

flare.bffs.gp.predict.predict_on_structure_en(structure: FLARE_Atoms, gp: GaussianProcess, n_cpus: Optional[int] = None, write_to_structure: bool = True, selective_atoms: Optional[List[int]] = None, skipped_atom_value=0)

Return the forces/std. dev. uncertainty / local energy associated with each individual atom in a structure. Forces are stored directly to the structure and are also returned.

Parameters
  • structure – FLARE structure to obtain forces for, with N atoms

  • gp – Gaussian Process model

  • n_cpus – Dummy parameter passed as an argument to allow for flexibility when the callable may or may not be parallelized

Returns

N x 3 array of forces, N x 3 array of uncertainties, N-length array of energies

Return type

(np.ndarray, np.ndarray, np.ndarray)

flare.bffs.gp.predict.predict_on_structure_mgp(structure: FLARE_Atoms, mgp: MappedGaussianProcess, output=None, output_name=None, n_cpus: Optional[int] = None, write_to_structure: bool = True, selective_atoms: Optional[List[int]] = None, skipped_atom_value: Union[float, int] = 0, energy: bool = False) Union[Tuple[numpy.ndarray, numpy.ndarray, float], Tuple[numpy.ndarray, numpy.ndarray]]

Assign forces to structure based on an mgp

flare.bffs.gp.predict.predict_on_structure_par(structure: FLARE_Atoms, gp: GaussianProcess, n_cpus: Optional[int] = None, write_to_structure: bool = True, selective_atoms: Optional[List[int]] = None, skipped_atom_value=0)

Return the forces/std. dev. uncertainty associated with each individual atom in a structure. Forces are stored directly to the structure and are also returned.

Parameters
  • structure – FLARE structure to obtain forces for, with N atoms

  • gp – Gaussian Process model

  • n_cpus – Number of cores to parallelize over

  • write_to_structure – Write results to structure’s forces, std attributes

  • selective_atoms – Only predict on these atoms; e.g. [0,1,2] will only predict and return for those atoms

  • skipped_atom_value – What value to use for atoms that are skipped. Defaults to 0 but other options could be e.g. NaN. Will NOT write this to the structure if write_to_structure is True.

Returns

N x 3 array of forces, N x 3 array of uncertainties

Return type

(np.ndarray, np.ndarray)

flare.bffs.gp.predict.predict_on_structure_par_en(structure: FLARE_Atoms, gp: GaussianProcess, n_cpus: Optional[int] = None, write_to_structure: bool = True, selective_atoms: Optional[List[int]] = None, skipped_atom_value=0)

Return the forces/std. dev. uncertainty / local energy associated with each individual atom in a structure, parallelized over atoms. Forces are stored directly to the structure and are also returned.

Parameters
  • structure – FLARE structure to obtain forces for, with N atoms

  • gp – Gaussian Process model

  • n_cpus – Number of cores to parallelize over

Returns

N x 3 array of forces, N x 3 array of uncertainties, N-length array of energies

Return type

(np.ndarray, np.ndarray, np.ndarray)