deepmd.dpmodel.loss.ener_spin#
Classes#
Loss on energy, real force, magnetic force and virial for spin models. |
Module Contents#
- class deepmd.dpmodel.loss.ener_spin.EnergySpinLoss(starter_learning_rate: float = 1.0, start_pref_e: float = 0.0, limit_pref_e: float = 0.0, start_pref_fr: float = 0.0, limit_pref_fr: float = 0.0, start_pref_fm: float = 0.0, limit_pref_fm: float = 0.0, start_pref_v: float = 0.0, limit_pref_v: float = 0.0, start_pref_ae: float = 0.0, limit_pref_ae: float = 0.0, enable_atom_ener_coeff: bool = False, loss_func: str = 'mse', intensive_ener_virial: bool = False, **kwargs: Any)[source]#
Bases:
deepmd.dpmodel.loss.loss.LossLoss on energy, real force, magnetic force and virial for spin models.
- Parameters:
- starter_learning_rate
float The learning rate at the start of the training.
- start_pref_e
float The prefactor of energy loss at the start of the training.
- limit_pref_e
float The prefactor of energy loss at the end of the training.
- start_pref_fr
float The prefactor of real force loss at the start of the training.
- limit_pref_fr
float The prefactor of real force loss at the end of the training.
- start_pref_fm
float The prefactor of magnetic force loss at the start of the training.
- limit_pref_fm
float The prefactor of magnetic force loss at the end of the training.
- start_pref_v
float The prefactor of virial loss at the start of the training.
- limit_pref_v
float The prefactor of virial loss at the end of the training.
- start_pref_ae
float The prefactor of atomic energy loss at the start of the training.
- limit_pref_ae
float The prefactor of atomic energy loss at the end of the training.
- enable_atom_ener_coeffbool
if true, the energy will be computed as sum_i c_i E_i
- loss_func
str Loss function type: ‘mse’ or ‘mae’.
- intensive_ener_virialbool
If true, the MSE energy and virial terms use intensive normalization, i.e. an additional normalization by the square of the number of atoms (1/N^2) instead of the legacy (1/N) behavior. This keeps those MSE loss terms consistent with per-atom RMSE reporting and less dependent on system size. This option does not change the MAE formulation, which is handled separately. The default is false for backward compatibility with models trained using deepmd-kit <= 3.1.3.
- **kwargs
Other keyword arguments.
- starter_learning_rate
- call(learning_rate: float, natoms: int, model_dict: dict[str, deepmd.dpmodel.array_api.Array], label_dict: dict[str, deepmd.dpmodel.array_api.Array], mae: bool = False) tuple[deepmd.dpmodel.array_api.Array, dict[str, deepmd.dpmodel.array_api.Array]][source]#
Calculate loss from model results and labeled results.
- property label_requirement: list[deepmd.utils.data.DataRequirementItem][source]#
Return data label requirements needed for this loss calculation.
- classmethod deserialize(data: dict) EnergySpinLoss[source]#
Deserialize the loss module.