kliff.dataset.weight

class kliff.dataset.weight.Weight(config_weight=1.0, energy_weight=1.0, forces_weight=1.0, stress_weight=1.0)[source]

Base class for weight.

This class mimics the behavior provided by the residual_data argument from the previous version. Subclass can implement

  • compute_weight

Parameters:
  • config_weight (float (optional)) – The weight for the entire configuration

  • energy_weight (float (optional)) – The weight for the energy

  • forces_weight (float (optional)) – The weight for the forces

  • stress_weight (float (optional)) – The weight for the stress

compute_weight(config)[source]
property config_weight
property energy_weight
property forces_weight
property stress_weight
to_dict()[source]
class kliff.dataset.weight.MagnitudeInverseWeight(config_weight=1.0, weight_params=None)[source]

Non-uniform weight that is computed from the data. The calculation follows Lenosky et al. (1997), with some modification in notation,

..math:

frac{1}{w_m^2} = c_1^2 + c_2^2 Vert f_m Vert ^2.

Parameters:
  • config_weight (float (optional)) – The weight for the entire configuration

  • weight_params (dict (optional)) – A dictionary containing parameters c1 and c2 for calculating the weight of each property. The supported key value pairs are: - energy_weight_params: float or array-like (default: [1.0, 0.0]) - forces_weight_params: float or array-like (default: [1.0, 0.0]) - stress_weight_params: float or array-like (default: [1.0, 0.0]) If a float is given, this number will be used to set c1, while c2 is set to zero. If an array-like with 2 elements is given, it should contain c1 as the first element and c2 as the second element.

References

[Lenosky1997]

T. J. Lenosky et al., “Highly optimized tight-binding model of silicon,” Phys. Rev. B, vol. 55, no. 3, pp. 15281544, Jan. 1997, doi: 10.1103/PhysRevB.55.1528.

default_weight_params = {'energy_weight_params': [1.0, 0.0], 'forces_weight_params': [1.0, 0.0], 'stress_weight_params': [1.0, 0.0]}
compute_weight(config)[source]

Compute the weights of the energy, forces, and stress data.

exception kliff.dataset.weight.WeightError(msg)[source]