deepmd.pt.loss.ener#

Classes#

EnergyStdLoss

Helper class that provides a standard way to create an ABC using

EnergyHessianStdLoss

Helper class that provides a standard way to create an ABC using

Functions#

custom_huber_loss(predictions, targets[, delta])

Module Contents#

deepmd.pt.loss.ener.custom_huber_loss(predictions, targets, delta=1.0)[source]#
class deepmd.pt.loss.ener.EnergyStdLoss(starter_learning_rate=1.0, start_pref_e=0.0, limit_pref_e=0.0, start_pref_f=0.0, limit_pref_f=0.0, start_pref_v=0.0, limit_pref_v=0.0, start_pref_ae: float = 0.0, limit_pref_ae: float = 0.0, start_pref_pf: float = 0.0, limit_pref_pf: float = 0.0, relative_f: float | None = None, enable_atom_ener_coeff: bool = False, start_pref_gf: float = 0.0, limit_pref_gf: float = 0.0, numb_generalized_coord: int = 0, use_l1_all: bool = False, inference=False, use_huber=False, huber_delta=0.01, **kwargs)[source]#

Bases: deepmd.pt.loss.loss.TaskLoss

Helper class that provides a standard way to create an ABC using inheritance.

starter_learning_rate = 1.0[source]#
has_e[source]#
has_f[source]#
has_v[source]#
has_ae[source]#
has_pf[source]#
has_gf[source]#
start_pref_e = 0.0[source]#
limit_pref_e = 0.0[source]#
start_pref_f = 0.0[source]#
limit_pref_f = 0.0[source]#
start_pref_v = 0.0[source]#
limit_pref_v = 0.0[source]#
start_pref_ae = 0.0[source]#
limit_pref_ae = 0.0[source]#
start_pref_pf = 0.0[source]#
limit_pref_pf = 0.0[source]#
start_pref_gf = 0.0[source]#
limit_pref_gf = 0.0[source]#
relative_f = None[source]#
enable_atom_ener_coeff = False[source]#
numb_generalized_coord = 0[source]#
use_l1_all = False[source]#
inference = False[source]#
use_huber = False[source]#
huber_delta = 0.01[source]#
forward(input_dict, model, label, natoms, learning_rate, mae=False)[source]#

Return loss on energy and force.

Parameters:
input_dictdict[str, torch.Tensor]

Model inputs.

modeltorch.nn.Module

Model to be used to output the predictions.

labeldict[str, torch.Tensor]

Labels.

natomsint

The local atom number.

Returns:
model_pred: dict[str, torch.Tensor]

Model predictions.

loss: torch.Tensor

Loss for model to minimize.

more_loss: dict[str, torch.Tensor]

Other losses for display.

property label_requirement: list[deepmd.utils.data.DataRequirementItem][source]#

Return data label requirements needed for this loss calculation.

serialize() dict[source]#

Serialize the loss module.

Returns:
dict

The serialized loss module

classmethod deserialize(data: dict) deepmd.pt.loss.loss.TaskLoss[source]#

Deserialize the loss module.

Parameters:
datadict

The serialized loss module

Returns:
Loss

The deserialized loss module

class deepmd.pt.loss.ener.EnergyHessianStdLoss(start_pref_h=0.0, limit_pref_h=0.0, **kwargs)[source]#

Bases: EnergyStdLoss

Helper class that provides a standard way to create an ABC using inheritance.

has_h[source]#
start_pref_h = 0.0[source]#
limit_pref_h = 0.0[source]#
forward(input_dict, model, label, natoms, learning_rate, mae=False)[source]#

Return loss on energy and force.

Parameters:
input_dictdict[str, torch.Tensor]

Model inputs.

modeltorch.nn.Module

Model to be used to output the predictions.

labeldict[str, torch.Tensor]

Labels.

natomsint

The local atom number.

Returns:
model_pred: dict[str, torch.Tensor]

Model predictions.

loss: torch.Tensor

Loss for model to minimize.

more_loss: dict[str, torch.Tensor]

Other losses for display.

property label_requirement: list[deepmd.utils.data.DataRequirementItem][source]#

Add hessian label requirement needed for this loss calculation.