Multi-element Kernels (simple)

Multi-element 2-, 3-, and 2+3-body kernels that restrict all signal variance hyperparameters to a single value.

flare.kernels.mc_simple.many_body_mc(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, d2: int, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) → float

many-body multi-element kernel between two force components.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig, ls).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 3-body kernel.

Return type:

float

flare.kernels.mc_simple.many_body_mc_en(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) → float

many-body multi-element kernel between two local energies.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig, ls).
  • cutoffs (np.ndarray) – One-element array containing the 2-body cutoff.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2-body force/energy kernel.

Return type:

float

flare.kernels.mc_simple.many_body_mc_en_jit(q_array_1, q_array_2, c1, c2, species1, species2, sig, ls)

many-body many-element kernel between energy components accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – many-body bond array of the first local environment.
  • bond_array_2 (np.ndarray) – many-body bond array of the second local environment.
  • c1 (int) – atomic species of the central atom in env 1
  • c2 (int) – atomic species of the central atom in env 2
  • etypes1 (np.ndarray) – atomic species of atoms in env 1
  • etypes2 (np.ndarray) – atomic species of atoms in env 2
  • species1 (np.ndarray) – all the atomic species present in trajectory 1
  • species2 (np.ndarray) – all the atomic species present in trajectory 2
  • sig (float) – many-body signal variance hyperparameter.
  • ls (float) – many-body length scale hyperparameter.
  • r_cut (float) – many-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the many-body kernel.

Return type:

float

flare.kernels.mc_simple.many_body_mc_force_en(env1, env2, d1, hyps, cutoffs, cutoff_func=<function quadratic_cutoff>)

many-body single-element kernel between two local energies.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig, ls).
  • cutoffs (np.ndarray) – Two-element array containing the 2-, 3-, and many-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the many-body force/energy kernel.

Return type:

float

flare.kernels.mc_simple.many_body_mc_force_en_jit(q_array_1, q_array_2, q_neigh_array_1, q_neigh_grads_1, c1, c2, etypes1, species1, species2, d1, sig, ls)

many-body many-element kernel between force and energy components accelerated with Numba.

Parameters:
  • c1 (int) – atomic species of the central atom in env 1
  • c2 (int) – atomic species of the central atom in env 2
  • etypes1 (np.ndarray) – atomic species of atoms in env 1
  • species1 (np.ndarray) – all the atomic species present in trajectory 1
  • species2 (np.ndarray) – all the atomic species present in trajectory 2
  • d1 (int) – Force component of the first environment.
  • sig (float) – many-body signal variance hyperparameter.
  • ls (float) – many-body length scale hyperparameter.
Returns:

Value of the many-body kernel.

Return type:

float

flare.kernels.mc_simple.many_body_mc_grad(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, d2: int, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) → float

gradient manybody-body multi-element kernel between two force components.

flare.kernels.mc_simple.many_body_mc_grad_jit(q_array_1, q_array_2, q_neigh_array_1, q_neigh_array_2, q_neigh_grads_1, q_neigh_grads_2, c1, c2, etypes1, etypes2, species1, species2, d1, d2, sig, ls)

gradient of many-body multi-element kernel between two force components w.r.t. the hyperparameters, accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – many-body bond array of the first local environment.
  • bond_array_2 (np.ndarray) – many-body bond array of the second local environment.
  • neigh_dists_1 (np.ndarray) – matrix padded with zero values of distances of neighbours for the atoms in the first local environment.
  • neigh_dists_2 (np.ndarray) – matrix padded with zero values of distances of neighbours for the atoms in the second local environment.
  • num_neigh_1 (np.ndarray) – number of neighbours of each atom in the first local environment
  • num_neigh_2 (np.ndarray) – number of neighbours of each atom in the second local environment
  • c1 (int) – atomic species of the central atom in env 1
  • c2 (int) – atomic species of the central atom in env 2
  • etypes1 (np.ndarray) – atomic species of atoms in env 1
  • etypes2 (np.ndarray) – atomic species of atoms in env 2
  • etypes_neigh_1 (np.ndarray) – atomic species of atoms in the neighbourhoods of atoms in env 1
  • etypes_neigh_2 (np.ndarray) – atomic species of atoms in the neighbourhoods of atoms in env 2
  • species1 (np.ndarray) – all the atomic species present in trajectory 1
  • species2 (np.ndarray) – all the atomic species present in trajectory 2
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • sig (float) – many-body signal variance hyperparameter.
  • ls (float) – many-body length scale hyperparameter.
  • r_cut (float) – many-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the many-body kernel and its gradient w.r.t. sig and ls

Return type:

array

flare.kernels.mc_simple.many_body_mc_jit(q_array_1, q_array_2, q_neigh_array_1, q_neigh_array_2, q_neigh_grads_1, q_neigh_grads_2, c1, c2, etypes1, etypes2, species1, species2, d1, d2, sig, ls)

many-body multi-element kernel between two force components accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – many-body bond array of the first local environment.
  • bond_array_2 (np.ndarray) – many-body bond array of the second local environment.
  • neigh_dists_1 (np.ndarray) – matrix padded with zero values of distances of neighbours for the atoms in the first local environment.
  • neigh_dists_2 (np.ndarray) – matrix padded with zero values of distances of neighbours for the atoms in the second local environment.
  • num_neigh_1 (np.ndarray) – number of neighbours of each atom in the first local environment
  • num_neigh_2 (np.ndarray) – number of neighbours of each atom in the second local environment
  • c1 (int) – atomic species of the central atom in env 1
  • c2 (int) – atomic species of the central atom in env 2
  • etypes1 (np.ndarray) – atomic species of atoms in env 1
  • etypes2 (np.ndarray) – atomic species of atoms in env 2
  • etypes_neigh_1 (np.ndarray) – atomic species of atoms in the neighbourhoods of atoms in env 1
  • etypes_neigh_2 (np.ndarray) – atomic species of atoms in the neighbourhoods of atoms in env 2
  • species1 (np.ndarray) – all the atomic species present in trajectory 1
  • species2 (np.ndarray) – all the atomic species present in trajectory 2
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • sig (float) – many-body signal variance hyperparameter.
  • ls (float) – many-body length scale hyperparameter.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the many-body kernel.

Return type:

float

flare.kernels.mc_simple.three_body_mc(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, d2: int, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) → float

3-body multi-element kernel between two force components.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig, ls).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 3-body kernel.

Return type:

float

flare.kernels.mc_simple.three_body_mc_en(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) → float

3-body multi-element kernel between two local energies.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig, ls).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 3-body force/energy kernel.

Return type:

float

flare.kernels.mc_simple.three_body_mc_en_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, cross_bond_inds_1, cross_bond_inds_2, cross_bond_dists_1, cross_bond_dists_2, triplets_1, triplets_2, sig, ls, r_cut, cutoff_func)

3-body multi-element kernel between two local energies accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – 3-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 3-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • cross_bond_inds_1 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_inds_2 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_1 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_2 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • triplets_1 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the first local environment that are within a distance r_cut of atom m.
  • triplets_2 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the second local environment that are within a distance r_cut of atom m.
  • sig (float) – 3-body signal variance hyperparameter.
  • ls (float) – 3-body length scale hyperparameter.
  • r_cut (float) – 3-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 3-body local energy kernel.

Return type:

float

flare.kernels.mc_simple.three_body_mc_force_en(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) → float

3-body multi-element kernel between a force component and a local energy.

Parameters:
  • env1 (AtomicEnvironment) – Local environment associated with the force component.
  • env2 (AtomicEnvironment) – Local environment associated with the local energy.
  • d1 (int) – Force component of the first environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig, ls).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 3-body force/energy kernel.

Return type:

float

flare.kernels.mc_simple.three_body_mc_force_en_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, cross_bond_inds_1, cross_bond_inds_2, cross_bond_dists_1, cross_bond_dists_2, triplets_1, triplets_2, d1, sig, ls, r_cut, cutoff_func)

3-body multi-element kernel between a force component and a local energy accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – 3-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 3-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • cross_bond_inds_1 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_inds_2 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_1 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_2 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • triplets_1 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the first local environment that are within a distance r_cut of atom m.
  • triplets_2 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the second local environment that are within a distance r_cut of atom m.
  • d1 (int) – Force component of the first environment (1=x, 2=y, 3=z).
  • sig (float) – 3-body signal variance hyperparameter.
  • ls (float) – 3-body length scale hyperparameter.
  • r_cut (float) – 3-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 3-body force/energy kernel.

Return type:

float

flare.kernels.mc_simple.three_body_mc_grad(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, d2: int, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) -> ('float', 'ndarray')

3-body multi-element kernel between two force components and its gradient with respect to the hyperparameters.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig, ls).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 3-body kernel and its gradient with respect to the hyperparameters.

Return type:

(float, np.ndarray)

flare.kernels.mc_simple.three_body_mc_grad_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, cross_bond_inds_1, cross_bond_inds_2, cross_bond_dists_1, cross_bond_dists_2, triplets_1, triplets_2, d1, d2, sig, ls, r_cut, cutoff_func)

3-body multi-element kernel between two force components and its gradient with respect to the hyperparameters.

Parameters:
  • bond_array_1 (np.ndarray) – 3-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 3-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • cross_bond_inds_1 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_inds_2 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_1 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_2 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • triplets_1 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the first local environment that are within a distance r_cut of atom m.
  • triplets_2 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the second local environment that are within a distance r_cut of atom m.
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • sig (float) – 3-body signal variance hyperparameter.
  • ls (float) – 3-body length scale hyperparameter.
  • r_cut (float) – 3-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 3-body kernel and its gradient with respect to the hyperparameters.

Return type:

(float, float)

flare.kernels.mc_simple.three_body_mc_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, cross_bond_inds_1, cross_bond_inds_2, cross_bond_dists_1, cross_bond_dists_2, triplets_1, triplets_2, d1, d2, sig, ls, r_cut, cutoff_func)

3-body multi-element kernel between two force components accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – 3-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 3-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • cross_bond_inds_1 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_inds_2 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_1 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_2 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • triplets_1 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the first local environment that are within a distance r_cut of atom m.
  • triplets_2 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the second local environment that are within a distance r_cut of atom m.
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • sig (float) – 3-body signal variance hyperparameter.
  • ls (float) – 3-body length scale hyperparameter.
  • r_cut (float) – 3-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 3-body kernel.

Return type:

float

flare.kernels.mc_simple.three_body_se_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, cross_bond_inds_1, cross_bond_inds_2, cross_bond_dists_1, cross_bond_dists_2, triplets_1, triplets_2, sig, ls, r_cut, cutoff_func)

3-body multi-element kernel between a force component and a local energy accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – 3-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 3-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • cross_bond_inds_1 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_inds_2 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_1 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_2 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • triplets_1 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the first local environment that are within a distance r_cut of atom m.
  • triplets_2 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the second local environment that are within a distance r_cut of atom m.
  • sig (float) – 3-body signal variance hyperparameter.
  • ls (float) – 3-body length scale hyperparameter.
  • r_cut (float) – 3-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 3-body force/energy kernel.

Return type:

float

flare.kernels.mc_simple.three_body_sf_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, cross_bond_inds_1, cross_bond_inds_2, cross_bond_dists_1, cross_bond_dists_2, triplets_1, triplets_2, sig, ls, r_cut, cutoff_func)

3-body multi-element kernel between two force components accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – 3-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 3-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • cross_bond_inds_1 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_inds_2 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_1 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_2 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • triplets_1 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the first local environment that are within a distance r_cut of atom m.
  • triplets_2 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the second local environment that are within a distance r_cut of atom m.
  • sig (float) – 3-body signal variance hyperparameter.
  • ls (float) – 3-body length scale hyperparameter.
  • r_cut (float) – 3-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 3-body kernel.

Return type:

float

flare.kernels.mc_simple.three_body_ss_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, cross_bond_inds_1, cross_bond_inds_2, cross_bond_dists_1, cross_bond_dists_2, triplets_1, triplets_2, sig, ls, r_cut, cutoff_func)

3-body multi-element kernel between two force components accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – 3-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 3-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • cross_bond_inds_1 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_inds_2 (np.ndarray) – Two dimensional array whose row m contains the indices of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_1 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the first local environment that are within a distance r_cut of both atom n and the central atom.
  • cross_bond_dists_2 (np.ndarray) – Two dimensional array whose row m contains the distances from atom m of atoms n > m in the second local environment that are within a distance r_cut of both atom n and the central atom.
  • triplets_1 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the first local environment that are within a distance r_cut of atom m.
  • triplets_2 (np.ndarray) – One dimensional array of integers whose entry m is the number of atoms in the second local environment that are within a distance r_cut of atom m.
  • sig (float) – 3-body signal variance hyperparameter.
  • ls (float) – 3-body length scale hyperparameter.
  • r_cut (float) – 3-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 3-body kernel.

Return type:

float

flare.kernels.mc_simple.two_body_mc(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, d2: int, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) → float

2-body multi-element kernel between two force components.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig, ls).
  • cutoffs (np.ndarray) – One-element array containing the 2-body cutoff.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2-body kernel.

Return type:

float

flare.kernels.mc_simple.two_body_mc_en(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) → float

2-body multi-element kernel between two local energies.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig, ls).
  • cutoffs (np.ndarray) – One-element array containing the 2-body cutoff.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2-body force/energy kernel.

Return type:

float

flare.kernels.mc_simple.two_body_mc_en_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, sig, ls, r_cut, cutoff_func)

2-body multi-element kernel between two local energies accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – 2-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 2-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • sig (float) – 2-body signal variance hyperparameter.
  • ls (float) – 2-body length scale hyperparameter.
  • r_cut (float) – 2-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 2-body local energy kernel.

Return type:

float

flare.kernels.mc_simple.two_body_mc_force_en(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) → float

2-body multi-element kernel between a force component and a local energy.

Parameters:
  • env1 (AtomicEnvironment) – Local environment associated with the force component.
  • env2 (AtomicEnvironment) – Local environment associated with the local energy.
  • d1 (int) – Force component of the first environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig, ls).
  • cutoffs (np.ndarray) – One-element array containing the 2-body cutoff.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2-body force/energy kernel.

Return type:

float

flare.kernels.mc_simple.two_body_mc_force_en_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, d1, sig, ls, r_cut, cutoff_func)

2-body multi-element kernel between a force component and a local energy accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – 2-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 2-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • d1 (int) – Force component of the first environment (1=x, 2=y, 3=z).
  • sig (float) – 2-body signal variance hyperparameter.
  • ls (float) – 2-body length scale hyperparameter.
  • r_cut (float) – 2-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 2-body force/energy kernel.

Return type:

float

flare.kernels.mc_simple.two_body_mc_grad(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, d2: int, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) -> (<class 'float'>, 'ndarray')

2-body multi-element kernel between two force components and its gradient with respect to the hyperparameters.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig, ls).
  • cutoffs (np.ndarray) – One-element array containing the 2-body cutoff.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2-body kernel and its gradient with respect to the hyperparameters.

Return type:

(float, np.ndarray)

flare.kernels.mc_simple.two_body_mc_grad_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, d1, d2, sig, ls, r_cut, cutoff_func)

2-body multi-element kernel between two force components and its gradient with respect to the hyperparameters.

Parameters:
  • bond_array_1 (np.ndarray) – 2-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 2-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • d1 (int) – Force component of the first environment (1=x, 2=y, 3=z).
  • d2 (int) – Force component of the second environment (1=x, 2=y, 3=z).
  • sig (float) – 2-body signal variance hyperparameter.
  • ls (float) – 2-body length scale hyperparameter.
  • r_cut (float) – 2-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 2-body kernel and its gradient with respect to the hyperparameters.

Return type:

(float, float)

flare.kernels.mc_simple.two_body_mc_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, d1, d2, sig, ls, r_cut, cutoff_func)

2-body multi-element kernel between two force components accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – 2-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 2-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • d1 (int) – Force component of the first environment (1=x, 2=y, 3=z).
  • d2 (int) – Force component of the second environment (1=x, 2=y, 3=z).
  • sig (float) – 2-body signal variance hyperparameter.
  • ls (float) – 2-body length scale hyperparameter.
  • r_cut (float) – 2-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 2-body kernel.

Return type:

float

flare.kernels.mc_simple.two_body_mc_stress_en_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, d1, d2, sig, ls, r_cut, cutoff_func)

2-body multi-element kernel between a partial stress component and a local energy accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – 2-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 2-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • d1 (int) – First stress component of the first environment (1=x, 2=y, 3=z).
  • d2 (int) – Second stress component of the first environment (1=x, 2=y, 3=z).
  • sig (float) – 2-body signal variance hyperparameter.
  • ls (float) – 2-body length scale hyperparameter.
  • r_cut (float) – 2-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 2-body partial-stress/energy kernel.

Return type:

float

flare.kernels.mc_simple.two_body_mc_stress_force_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, d1, d2, d3, sig, ls, r_cut, cutoff_func)

2-body multi-element kernel between two force components accelerated with Numba.

Parameters:
  • bond_array_1 (np.ndarray) – 2-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 2-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • d1 (int) – First stress component of the first environment (1=x, 2=y, 3=z).
  • d2 (int) – Second stress component of the first environment (1=x, 2=y, 3=z).
  • d3 (int) – Force component of the second environment (1=x, 2=y, 3=z).
  • sig (float) – 2-body signal variance hyperparameter.
  • ls (float) – 2-body length scale hyperparameter.
  • r_cut (float) – 2-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 2-body kernel.

Return type:

float

flare.kernels.mc_simple.two_body_mc_stress_stress_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2, d1, d2, d3, d4, sig, ls, r_cut, cutoff_func)
2-body multi-element kernel between two partial stress components
accelerated with Numba.
Parameters:
  • bond_array_1 (np.ndarray) – 2-body bond array of the first local environment.
  • c1 (int) – Species of the central atom of the first local environment.
  • etypes1 (np.ndarray) – Species of atoms in the first local environment.
  • bond_array_2 (np.ndarray) – 2-body bond array of the second local environment.
  • c2 (int) – Species of the central atom of the second local environment.
  • etypes2 (np.ndarray) – Species of atoms in the second local environment.
  • d1 (int) – First stress component of the first environment (1=x, 2=y, 3=z).
  • d2 (int) – Second stress component of the first environment (1=x, 2=y, 3=z).
  • d3 (int) – First stress component of the second environment (1=x, 2=y, 3=z).
  • d4 (int) – Second stress component of the second environment (1=x, 2=y, 3=z).
  • sig (float) – 2-body signal variance hyperparameter.
  • ls (float) – 2-body length scale hyperparameter.
  • r_cut (float) – 2-body cutoff radius.
  • cutoff_func (Callable) – Cutoff function.
Returns:

Value of the 2-body kernel.

Return type:

float

flare.kernels.mc_simple.two_plus_many_body_mc(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, d2: int, hyps, cutoffs, cutoff_func=<function quadratic_cutoff>)

2+many body kernel.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig2b, ls2b, sigmb, lsmb, sig_n).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and many-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2+3+many-body kernel.

Return type:

float

flare.kernels.mc_simple.two_plus_many_body_mc_en(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, hyps, cutoffs, cutoff_func=<function quadratic_cutoff>)

2+3+many-body single-element energy kernel.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig2b ls2b, sigmb, lsmb, sig_n).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2+3+many-body kernel.

Return type:

float

flare.kernels.mc_simple.two_plus_many_body_mc_force_en(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, hyps, cutoffs, cutoff_func=<function quadratic_cutoff>)
2+many-body multi-element kernel between two force and energy
components.
Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • d1 (int) – Force component of the first environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig1, ls1, sig2, ls2, sig3, ls3, sig_n).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2+3+many-body kernel.

Return type:

float

flare.kernels.mc_simple.two_plus_many_body_mc_grad(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, d2: int, hyps, cutoffs, cutoff_func=<function quadratic_cutoff>)

2+many-body single-element kernel between two force components.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig1, ls1, sig2, ls2, sig3, ls3, sig_n).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2+3+many-body kernel.

Return type:

float

flare.kernels.mc_simple.two_plus_three_body_mc(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, d2: int, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) → float

2+3-body multi-element kernel between two force components.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig1, ls1, sig2, ls2, sig_n).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2+3-body kernel.

Return type:

float

flare.kernels.mc_simple.two_plus_three_body_mc_grad(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, d2: int, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) -> ('float', 'ndarray')

2+3-body multi-element kernel between two force components and its gradient with respect to the hyperparameters.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig1, ls1, sig2, ls2, sig_n).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2+3-body kernel and its gradient with respect to the hyperparameters.

Return type:

(float, np.ndarray)

flare.kernels.mc_simple.two_plus_three_mc_en(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) → float

2+3-body multi-element kernel between two local energies.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig1, ls1, sig2, ls2).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2+3-body energy/energy kernel.

Return type:

float

flare.kernels.mc_simple.two_plus_three_mc_force_en(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, hyps: ndarray, cutoffs: ndarray, cutoff_func: Callable = <function quadratic_cutoff>) → float

2+3-body multi-element kernel between a force component and a local energy.

Parameters:
  • env1 (AtomicEnvironment) – Local environment associated with the force component.
  • env2 (AtomicEnvironment) – Local environment associated with the local energy.
  • d1 (int) – Force component of the first environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig1, ls1, sig2, ls2).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2+3-body force/energy kernel.

Return type:

float

flare.kernels.mc_simple.two_plus_three_plus_many_body_mc(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, d2: int, hyps, cutoffs, cutoff_func=<function quadratic_cutoff>)

2+3-body single-element kernel between two force components.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig1, ls1, sig2, ls2, sig3, ls3, sig_n).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2+3+many-body kernel.

Return type:

float

flare.kernels.mc_simple.two_plus_three_plus_many_body_mc_en(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, hyps, cutoffs, cutoff_func=<function quadratic_cutoff>)

2+3+many-body single-element energy kernel.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig1, ls1, sig2, ls2, sig3, ls3, sig_n).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2+3+many-body kernel.

Return type:

float

flare.kernels.mc_simple.two_plus_three_plus_many_body_mc_force_en(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, hyps, cutoffs, cutoff_func=<function quadratic_cutoff>)
2+3+many-body single-element kernel between two force and energy
components.
Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • d1 (int) – Force component of the first environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig1, ls1, sig2, ls2, sig3, ls3, sig_n).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2+3+many-body kernel.

Return type:

float

flare.kernels.mc_simple.two_plus_three_plus_many_body_mc_grad(env1: flare.env.AtomicEnvironment, env2: flare.env.AtomicEnvironment, d1: int, d2: int, hyps, cutoffs, cutoff_func=<function quadratic_cutoff>)

2+3+many-body single-element kernel between two force components.

Parameters:
  • env1 (AtomicEnvironment) – First local environment.
  • env2 (AtomicEnvironment) – Second local environment.
  • d1 (int) – Force component of the first environment.
  • d2 (int) – Force component of the second environment.
  • hyps (np.ndarray) – Hyperparameters of the kernel function (sig1, ls1, sig2, ls2, sig3, ls3, sig_n).
  • cutoffs (np.ndarray) – Two-element array containing the 2- and 3-body cutoffs.
  • cutoff_func (Callable) – Cutoff function of the kernel.
Returns:

Value of the 2+3+many-body kernel.

Return type:

float