deepmd.pt.model.task.fitting#
Attributes#
Classes#
Base fitting provides the interfaces of fitting net. | |
Construct a general fitting net. |
Module Contents#
- class deepmd.pt.model.task.fitting.Fitting[source]#
Bases:
torch.nn.Module
,deepmd.pt.model.task.base_fitting.BaseFitting
Base fitting provides the interfaces of fitting net.
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some separated parameters (e.g. mean and stddev) will be re-calculated across different classes.
- class deepmd.pt.model.task.fitting.GeneralFitting(var_name: str, ntypes: int, dim_descrpt: int, neuron: list[int] = [128, 128, 128], bias_atom_e: torch.Tensor | None = None, 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 | list[int] | None = None, exclude_types: list[int] = [], trainable: bool | list[bool] = True, remove_vaccum_contribution: list[bool] | None = None, type_map: list[str] | None = None, use_aparam_as_mask: bool = False, **kwargs)[source]#
Bases:
Fitting
Construct a general fitting net.
- Parameters:
- var_name
str
The atomic property to fit, ‘energy’, ‘dipole’, and ‘polar’.
- ntypes
int
Element count.
- dim_descrpt
int
Embedding width per atom.
- dim_out
int
The output dimension of the fitting net.
- neuron
list
[int
] Number of neurons in each hidden layers of the fitting net.
- bias_atom_e
torch.Tensor
,optional
Average energy per atom for each element.
- resnet_dtbool
Using time-step in the ResNet construction.
- numb_fparam
int
Number of frame parameters.
- numb_aparam
int
Number of atomic parameters.
- activation_function
str
Activation function.
- precision
str
Numerical precision.
- mixed_typesbool
If true, use a uniform fitting net for all atom types, otherwise use different fitting nets for different atom types.
- rcond
float
,optional
The condition number for the regression of atomic energy.
- seed
int
,optional
Random seed.
- exclude_types: list[int]
Atomic contributions of the excluded atom types are set zero.
- trainable
Union
[list
[bool], bool] If the parameters in the fitting net are trainable. Now this only supports setting all the parameters in the fitting net at one state. When in list[bool], the trainable will be True only if all the boolean parameters are True.
- remove_vaccum_contribution: list[bool], optional
Remove vacuum contribution before the bias is added. The list assigned each type. For mixed_types provide [True], otherwise it should be a list of the same length as ntypes signaling if or not removing the vacuum contribution for the atom types in the list.
- type_map: list[str], Optional
A list of strings. Give the name to each type of atoms.
- use_aparam_as_mask: bool
If True, the aparam will not be used in fitting net for embedding.
- var_name
- change_type_map(type_map: list[str], model_with_new_type_stat=None) None [source]#
Change the type related params to new ones, according to type_map and the original one in the model. If there are new types in type_map, statistics will be updated accordingly to model_with_new_type_stat for these new types.
- classmethod deserialize(data: dict) GeneralFitting [source]#
Deserialize the fitting.
- Parameters:
- data
dict
The serialized data
- data
- Returns:
BF
The deserialized fitting