deepmd.pt.modifier#

Submodules#

Classes#

BaseModifier

Base class for data modifier.

Functions#

get_data_modifier(→ base_modifier.BaseModifier)

Package Contents#

class deepmd.pt.modifier.BaseModifier(use_cache: bool = True)[source]#

Bases: torch.nn.Module, make_base_modifier()

Base class for data modifier.

modifier_type = 'base'#
jitable = True#
use_cache = True#
serialize() dict[source]#

Serialize the modifier.

Returns:
dict

The serialized data

classmethod deserialize(data: dict) BaseModifier[source]#

Deserialize the modifier.

Parameters:
datadict

The serialized data

Returns:
BaseModifier

The deserialized modifier

abstractmethod forward(coord: torch.Tensor, atype: torch.Tensor, box: torch.Tensor | None = None, fparam: torch.Tensor | None = None, aparam: torch.Tensor | None = None, do_atomic_virial: bool = False, charge_spin: torch.Tensor | None = None) dict[str, torch.Tensor][source]#

Compute energy, force, and virial corrections.

modify_data(data: dict[str, deepmd.dpmodel.array_api.Array | float], data_sys: deepmd.utils.data.DeepmdData) None[source]#

Modify data of single frame.

Parameters:
data

Internal data of DeepmdData. Be a dict, has the following keys - coord coordinates (nat, 3) - box simulation box (9,) - atype atom types (nat,) - fparam frame parameter (nfp,) - aparam atom parameter (nat, nap) - find_energy tells if data has energy - find_force tells if data has force - find_virial tells if data has virial - energy energy (1,) - force force (nat, 3) - virial virial (9,)

deepmd.pt.modifier.get_data_modifier(_modifier_params: dict[str, Any]) base_modifier.BaseModifier[source]#