deepmd.pt.model.task.dipole

Module Contents

Classes

DipoleFittingNet

Construct a dipole fitting net.

Attributes

log

deepmd.pt.model.task.dipole.log[source]
class deepmd.pt.model.task.dipole.DipoleFittingNet(ntypes: int, dim_descrpt: int, embedding_width: int, neuron: List[int] = [128, 128, 128], resnet_dt: bool = True, numb_fparam: int = 0, numb_aparam: int = 0, activation_function: str = 'tanh', precision: str = DEFAULT_PRECISION, mixed_types: bool = True, rcond: float | None = None, seed: int | None = None, exclude_types: List[int] = [], r_differentiable: bool = True, c_differentiable: bool = True, **kwargs)[source]

Bases: deepmd.pt.model.task.fitting.GeneralFitting

Construct a dipole fitting net.

Parameters:
ntypesint

Element count.

dim_descrptint

Embedding width per atom.

embedding_widthint

The dimension of rotation matrix, m1.

neuronList[int]

Number of neurons in each hidden layers of the fitting net.

resnet_dtbool

Using time-step in the ResNet construction.

numb_fparamint

Number of frame parameters.

numb_aparamint

Number of atomic parameters.

activation_functionstr

Activation function.

precisionstr

Numerical precision.

mixed_typesbool

If true, use a uniform fitting net for all atom types, otherwise use different fitting nets for different atom types.

rcondfloat, optional

The condition number for the regression of atomic energy.

seedint, optional

Random seed.

r_differentiable

If the variable is differentiated with respect to coordinates of atoms. Only reduciable variable are differentiable.

c_differentiable

If the variable is differentiated with respect to the cell tensor (pbc case). Only reduciable variable are differentiable.

exclude_types: List[int][source]
_net_out_dim()[source]

Set the FittingNet output dim.

serialize() dict[source]

Serialize the fitting to dict.

classmethod deserialize(data: dict) deepmd.pt.model.task.fitting.GeneralFitting[source]

Deserialize the fitting.

Parameters:
datadict

The serialized data

Returns:
BF

The deserialized fitting

output_def() deepmd.dpmodel.FittingOutputDef[source]

Returns the output def of the fitting net.

compute_output_stats(merged: Callable[[], List[dict]] | List[dict], stat_file_path: deepmd.utils.path.DPPath | None = None)[source]

Compute the output statistics (e.g. energy bias) for the fitting net from packed data.

Parameters:
mergedUnion[Callable[[], List[dict]], List[dict]]
  • List[dict]: A list of data samples from various data systems.

    Each element, merged[i], is a data dictionary containing keys: torch.Tensor originating from the i-th data system.

  • Callable[[], List[dict]]: A lazy function that returns data samples in the above format

    only when needed. Since the sampling process can be slow and memory-intensive, the lazy function helps by only sampling once.

stat_file_pathOptional[DPPath]

The path to the stat file.

forward(descriptor: torch.Tensor, atype: torch.Tensor, gr: torch.Tensor | None = None, g2: torch.Tensor | None = None, h2: torch.Tensor | None = None, fparam: torch.Tensor | None = None, aparam: torch.Tensor | None = None)[source]