Kernel Interface (for developers)

flare.kernels.utils.from_grad_to_mask(grad, hyps_mask=None)

Return gradient which only includes hyperparameters which are meant to vary

Parameters:
  • grad – original gradient vector
  • hyps_mask – dictionary for hyper-parameters
Returns:

newgrad

flare.kernels.utils.from_mask_to_args(hyps, cutoffs, hyps_mask=None)

Return the tuple of arguments needed for kernel function. The order of the tuple has to be exactly the same as the one taken by

the kernel function.
Parameters:
  • hyps (nd.array) – list of hyperparmeter values
  • hyps_mask (dictionary) – all the remaining parameters needed
  • cutoffs – cutoffs used
Returns:

args

flare.kernels.utils.kernel_str_to_array(kernel_name: str)

Args:

name (str): name for kernels. example: “2+3mc”

Returns:kernel function, kernel gradient, energy kernel, energy_and_force kernel
flare.kernels.utils.str_to_kernel_set(kernels: list = ['twobody', 'threebody'], component: str = 'sc', hyps_mask: dict = None)

return kernels and kernel gradient function base on a string. If it contains ‘sc’, it will use the kernel in sc module; otherwise, it uses the kernel in mc_simple; if sc is not included and multihyps is True, it will use the kernel in mc_sephyps module otherwise, it will use the kernel in the sc module

Args:

name (str): name for kernels. example: “2+3mc” multihyps (bool, optional): True for using multiple hyperparameter groups

Returns:kernel function, kernel gradient, energy kernel, energy_and_force kernel