tightbinder.optimize.fit#

fit(model, kpoints, energy, penalization=None, map=None, x0=None, method=None, step=0.01)[source]#

Routine to fit the parameters of a SlaterKoster model to reproduce some given bands.

Parameters:
  • model (SlaterKoster) – SlaterKoster model to fit.

  • kpoints (ndarray) – Array (nk, 3) with the kpoints where the known bands are given.

  • energy (ndarray) – Matrix (n, nk) with the energy bands. n must match the dimension of the hamiltonian of the model.

  • penalization (ndarray) – Matrix (n, nk) to penalize specific bands or kpoints in the loss.

  • map (Callable) – Custom function to map the parameters to the model. Defaults to None.

  • x0 (list) – Initial guess for optimization. Defaults to automatic parameter extraction if None.

  • method (str) – Specify optimization method. To see available options, see scipy.minimize documentation.

  • step (float) – Value of change of parameters when minimizing. Defaults to 1e-2.

Return type:

SlaterKoster

Returns:

Model with the fitted parameters.