deepmd.dpmodel.fitting#
Submodules#
- deepmd.dpmodel.fitting.base_fitting
- deepmd.dpmodel.fitting.dipole_fitting
- deepmd.dpmodel.fitting.dos_fitting
- deepmd.dpmodel.fitting.ener_fitting
- deepmd.dpmodel.fitting.general_fitting
- deepmd.dpmodel.fitting.invar_fitting
- deepmd.dpmodel.fitting.make_base_fitting
- deepmd.dpmodel.fitting.polarizability_fitting
- deepmd.dpmodel.fitting.property_fitting
Classes#
Fitting rotationally equivariant diploe of the system. | |
Fitting the energy (or a rotationally invariant property of dim_out) of the system. The force and the virial can also be trained. | |
Fitting the energy (or a rotationally invariant property of dim_out) of the system. The force and the virial can also be trained. | |
Fitting the energy (or a rotationally invariant property of dim_out) of the system. The force and the virial can also be trained. | |
Fitting rotationally equivariant polarizability of the system. | |
Fitting the rotationally invariant properties of task_dim of the system. |
Functions#
| Make the base class for the fitting. |
Package Contents#
- class deepmd.dpmodel.fitting.DipoleFitting(ntypes: int, dim_descrpt: int, embedding_width: int, neuron: list[int] = [120, 120, 120], resnet_dt: bool = True, numb_fparam: int = 0, numb_aparam: int = 0, rcond: float | None = None, tot_ener_zero: bool = False, trainable: list[bool] | None = None, activation_function: str = 'tanh', precision: str = DEFAULT_PRECISION, layer_name: list[str | None] | None = None, use_aparam_as_mask: bool = False, spin: Any = None, mixed_types: bool = False, exclude_types: list[int] = [], r_differentiable: bool = True, c_differentiable: bool = True, type_map: list[str] | None = None, seed: int | list[int] | None = None)[source]#
Bases:
deepmd.dpmodel.fitting.general_fitting.GeneralFittingFitting rotationally equivariant diploe of the system.
- Parameters:
- ntypes
The number of atom types.
- dim_descrpt
The dimension of the input descriptor.
- embedding_width
int The dimension of rotation matrix, m1.
- neuron
Number of neurons \(N\) in each hidden layer of the fitting net
- resnet_dt
Time-step dt in the resnet construction: \(y = x + dt * \phi (Wx + b)\)
- numb_fparam
Number of frame parameter
- numb_aparam
Number of atomic parameter
- rcond
The condition number for the regression of atomic energy.
- tot_ener_zero
Force the total energy to zero. Useful for the charge fitting.
- trainable
If the weights of fitting net are trainable. Suppose that we have \(N_l\) hidden layers in the fitting net, this list is of length \(N_l + 1\), specifying if the hidden layers and the output layer are trainable.
- activation_function
The activation function \(\boldsymbol{\phi}\) in the embedding net. Supported options are “relu”, “linear”, “tanh”, “sigmoid”, “gelu_tf”, “gelu”, “none”, “softplus”, “relu6”.
- precision
The precision of the embedding net parameters. Supported options are “default”, “float32”, “float64”, “float16”.
- layer_name
list[Optional[str]],optional The name of the each layer. If two layers, either in the same fitting or different fittings, have the same name, they will share the same neural network parameters.
- use_aparam_as_mask: bool, optional
If True, the atomic parameters will be used as a mask that determines the atom is real/virtual. And the aparam will not be used as the atomic parameters for embedding.
- mixed_types
If true, use a uniform fitting net for all atom types, otherwise use different fitting nets for different atom types.
- exclude_types
Atomic contributions of the excluded atom types are set zero.
- r_differentiable
If the variable is differentiated with respect to coordinates of atoms. Only reducible variable are differentiable.
- c_differentiable
If the variable is differentiated with respect to the cell tensor (pbc case). Only reducible variable are differentiable.
- type_map: list[str], Optional
A list of strings. Give the name to each type of atoms.
- embedding_width#
- r_differentiable#
- c_differentiable#
- classmethod deserialize(data: dict) deepmd.dpmodel.fitting.general_fitting.GeneralFitting[source]#
Deserialize the fitting.
- Parameters:
- data
dict The serialized data
- data
- Returns:
BFThe deserialized fitting
- call(descriptor: numpy.ndarray, atype: numpy.ndarray, gr: numpy.ndarray | None = None, g2: numpy.ndarray | None = None, h2: numpy.ndarray | None = None, fparam: numpy.ndarray | None = None, aparam: numpy.ndarray | None = None) dict[str, numpy.ndarray][source]#
Calculate the fitting.
- Parameters:
- descriptor
input descriptor. shape: nf x nloc x nd
- atype
the atom type. shape: nf x nloc
- gr
The rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3
- g2
The rotationally invariant pair-partical representation. shape: nf x nloc x nnei x ng
- h2
The rotationally equivariant pair-partical representation. shape: nf x nloc x nnei x 3
- fparam
The frame parameter. shape: nf x nfp. nfp being numb_fparam
- aparam
The atomic parameter. shape: nf x nloc x nap. nap being numb_aparam
- class deepmd.dpmodel.fitting.DOSFittingNet(ntypes: int, dim_descrpt: int, numb_dos: int = 300, neuron: list[int] = [120, 120, 120], resnet_dt: bool = True, numb_fparam: int = 0, numb_aparam: int = 0, bias_dos: numpy.ndarray | None = None, rcond: float | None = None, trainable: bool | list[bool] = True, activation_function: str = 'tanh', precision: str = DEFAULT_PRECISION, mixed_types: bool = False, exclude_types: list[int] = [], type_map: list[str] | None = None, seed: int | list[int] | None = None)[source]#
Bases:
deepmd.dpmodel.fitting.invar_fitting.InvarFittingFitting the energy (or a rotationally invariant property of dim_out) of the system. The force and the virial can also be trained.
Lets take the energy fitting task as an example. The potential energy \(E\) is a fitting network function of the descriptor \(\mathcal{D}\):
\[E(\mathcal{D}) = \mathcal{L}^{(n)} \circ \mathcal{L}^{(n-1)} \circ \cdots \circ \mathcal{L}^{(1)} \circ \mathcal{L}^{(0)}\]The first \(n\) hidden layers \(\mathcal{L}^{(0)}, \cdots, \mathcal{L}^{(n-1)}\) are given by
\[\mathbf{y}=\mathcal{L}(\mathbf{x};\mathbf{w},\mathbf{b})= \boldsymbol{\phi}(\mathbf{x}^T\mathbf{w}+\mathbf{b})\]where \(\mathbf{x} \in \mathbb{R}^{N_1}\) is the input vector and \(\mathbf{y} \in \mathbb{R}^{N_2}\) is the output vector. \(\mathbf{w} \in \mathbb{R}^{N_1 \times N_2}\) and \(\mathbf{b} \in \mathbb{R}^{N_2}\) are weights and biases, respectively, both of which are trainable if trainable[i] is True. \(\boldsymbol{\phi}\) is the activation function.
The output layer \(\mathcal{L}^{(n)}\) is given by
\[\mathbf{y}=\mathcal{L}^{(n)}(\mathbf{x};\mathbf{w},\mathbf{b})= \mathbf{x}^T\mathbf{w}+\mathbf{b}\]where \(\mathbf{x} \in \mathbb{R}^{N_{n-1}}\) is the input vector and \(\mathbf{y} \in \mathbb{R}\) is the output scalar. \(\mathbf{w} \in \mathbb{R}^{N_{n-1}}\) and \(\mathbf{b} \in \mathbb{R}\) are weights and bias, respectively, both of which are trainable if trainable[n] is True.
- Parameters:
- var_name
The name of the output variable.
- ntypes
The number of atom types.
- dim_descrpt
The dimension of the input descriptor.
- dim_out
The dimension of the output fit property.
- neuron
Number of neurons \(N\) in each hidden layer of the fitting net
- resnet_dt
Time-step dt in the resnet construction: \(y = x + dt * \phi (Wx + b)\)
- numb_fparam
Number of frame parameter
- numb_aparam
Number of atomic parameter
- rcond
The condition number for the regression of atomic energy.
- bias_atom
Bias for each element.
- tot_ener_zero
Force the total energy to zero. Useful for the charge fitting.
- trainable
If the weights of fitting net are trainable. Suppose that we have \(N_l\) hidden layers in the fitting net, this list is of length \(N_l + 1\), specifying if the hidden layers and the output layer are trainable.
- atom_ener
Specifying atomic energy contribution in vacuum. The set_davg_zero key in the descriptor should be set.
- activation_function
The activation function \(\boldsymbol{\phi}\) in the embedding net. Supported options are “relu”, “linear”, “tanh”, “sigmoid”, “gelu_tf”, “gelu”, “none”, “softplus”, “relu6”.
- precision
The precision of the embedding net parameters. Supported options are “default”, “float32”, “float64”, “float16”.
- layer_name
list[Optional[str]],optional The name of the each layer. If two layers, either in the same fitting or different fittings, have the same name, they will share the same neural network parameters.
- use_aparam_as_mask: bool, optional
If True, the atomic parameters will be used as a mask that determines the atom is real/virtual. And the aparam will not be used as the atomic parameters for embedding.
- mixed_types
If false, different atomic types uses different fitting net, otherwise different atom types share the same fitting net.
- exclude_types: list[int]
Atomic contributions of the excluded atom types are set zero.
- type_map: list[str], Optional
A list of strings. Give the name to each type of atoms.
- classmethod deserialize(data: dict) deepmd.dpmodel.fitting.general_fitting.GeneralFitting[source]#
Deserialize the fitting.
- Parameters:
- data
dict The serialized data
- data
- Returns:
BFThe deserialized fitting
- class deepmd.dpmodel.fitting.EnergyFittingNet(ntypes: int, dim_descrpt: int, neuron: list[int] = [120, 120, 120], resnet_dt: bool = True, numb_fparam: int = 0, numb_aparam: int = 0, rcond: float | None = None, tot_ener_zero: bool = False, trainable: list[bool] | None = None, atom_ener: list[float] | None = None, activation_function: str = 'tanh', precision: str = DEFAULT_PRECISION, layer_name: list[str | None] | None = None, use_aparam_as_mask: bool = False, spin: Any = None, mixed_types: bool = False, exclude_types: list[int] = [], type_map: list[str] | None = None, seed: int | list[int] | None = None)[source]#
Bases:
deepmd.dpmodel.fitting.invar_fitting.InvarFittingFitting the energy (or a rotationally invariant property of dim_out) of the system. The force and the virial can also be trained.
Lets take the energy fitting task as an example. The potential energy \(E\) is a fitting network function of the descriptor \(\mathcal{D}\):
\[E(\mathcal{D}) = \mathcal{L}^{(n)} \circ \mathcal{L}^{(n-1)} \circ \cdots \circ \mathcal{L}^{(1)} \circ \mathcal{L}^{(0)}\]The first \(n\) hidden layers \(\mathcal{L}^{(0)}, \cdots, \mathcal{L}^{(n-1)}\) are given by
\[\mathbf{y}=\mathcal{L}(\mathbf{x};\mathbf{w},\mathbf{b})= \boldsymbol{\phi}(\mathbf{x}^T\mathbf{w}+\mathbf{b})\]where \(\mathbf{x} \in \mathbb{R}^{N_1}\) is the input vector and \(\mathbf{y} \in \mathbb{R}^{N_2}\) is the output vector. \(\mathbf{w} \in \mathbb{R}^{N_1 \times N_2}\) and \(\mathbf{b} \in \mathbb{R}^{N_2}\) are weights and biases, respectively, both of which are trainable if trainable[i] is True. \(\boldsymbol{\phi}\) is the activation function.
The output layer \(\mathcal{L}^{(n)}\) is given by
\[\mathbf{y}=\mathcal{L}^{(n)}(\mathbf{x};\mathbf{w},\mathbf{b})= \mathbf{x}^T\mathbf{w}+\mathbf{b}\]where \(\mathbf{x} \in \mathbb{R}^{N_{n-1}}\) is the input vector and \(\mathbf{y} \in \mathbb{R}\) is the output scalar. \(\mathbf{w} \in \mathbb{R}^{N_{n-1}}\) and \(\mathbf{b} \in \mathbb{R}\) are weights and bias, respectively, both of which are trainable if trainable[n] is True.
- Parameters:
- var_name
The name of the output variable.
- ntypes
The number of atom types.
- dim_descrpt
The dimension of the input descriptor.
- dim_out
The dimension of the output fit property.
- neuron
Number of neurons \(N\) in each hidden layer of the fitting net
- resnet_dt
Time-step dt in the resnet construction: \(y = x + dt * \phi (Wx + b)\)
- numb_fparam
Number of frame parameter
- numb_aparam
Number of atomic parameter
- rcond
The condition number for the regression of atomic energy.
- bias_atom
Bias for each element.
- tot_ener_zero
Force the total energy to zero. Useful for the charge fitting.
- trainable
If the weights of fitting net are trainable. Suppose that we have \(N_l\) hidden layers in the fitting net, this list is of length \(N_l + 1\), specifying if the hidden layers and the output layer are trainable.
- atom_ener
Specifying atomic energy contribution in vacuum. The set_davg_zero key in the descriptor should be set.
- activation_function
The activation function \(\boldsymbol{\phi}\) in the embedding net. Supported options are “relu”, “linear”, “tanh”, “sigmoid”, “gelu_tf”, “gelu”, “none”, “softplus”, “relu6”.
- precision
The precision of the embedding net parameters. Supported options are “default”, “float32”, “float64”, “float16”.
- layer_name
list[Optional[str]],optional The name of the each layer. If two layers, either in the same fitting or different fittings, have the same name, they will share the same neural network parameters.
- use_aparam_as_mask: bool, optional
If True, the atomic parameters will be used as a mask that determines the atom is real/virtual. And the aparam will not be used as the atomic parameters for embedding.
- mixed_types
If false, different atomic types uses different fitting net, otherwise different atom types share the same fitting net.
- exclude_types: list[int]
Atomic contributions of the excluded atom types are set zero.
- type_map: list[str], Optional
A list of strings. Give the name to each type of atoms.
- classmethod deserialize(data: dict) deepmd.dpmodel.fitting.general_fitting.GeneralFitting[source]#
Deserialize the fitting.
- Parameters:
- data
dict The serialized data
- data
- Returns:
BFThe deserialized fitting
- class deepmd.dpmodel.fitting.InvarFitting(var_name: str, ntypes: int, dim_descrpt: int, dim_out: int, neuron: list[int] = [120, 120, 120], resnet_dt: bool = True, numb_fparam: int = 0, numb_aparam: int = 0, bias_atom: numpy.ndarray | None = None, rcond: float | None = None, tot_ener_zero: bool = False, trainable: list[bool] | None = None, atom_ener: list[float] | None = None, activation_function: str = 'tanh', precision: str = DEFAULT_PRECISION, layer_name: list[str | None] | None = None, use_aparam_as_mask: bool = False, spin: Any = None, mixed_types: bool = True, exclude_types: list[int] = [], type_map: list[str] | None = None, seed: int | list[int] | None = None)[source]#
Bases:
deepmd.dpmodel.fitting.general_fitting.GeneralFittingFitting the energy (or a rotationally invariant property of dim_out) of the system. The force and the virial can also be trained.
Lets take the energy fitting task as an example. The potential energy \(E\) is a fitting network function of the descriptor \(\mathcal{D}\):
\[E(\mathcal{D}) = \mathcal{L}^{(n)} \circ \mathcal{L}^{(n-1)} \circ \cdots \circ \mathcal{L}^{(1)} \circ \mathcal{L}^{(0)}\]The first \(n\) hidden layers \(\mathcal{L}^{(0)}, \cdots, \mathcal{L}^{(n-1)}\) are given by
\[\mathbf{y}=\mathcal{L}(\mathbf{x};\mathbf{w},\mathbf{b})= \boldsymbol{\phi}(\mathbf{x}^T\mathbf{w}+\mathbf{b})\]where \(\mathbf{x} \in \mathbb{R}^{N_1}\) is the input vector and \(\mathbf{y} \in \mathbb{R}^{N_2}\) is the output vector. \(\mathbf{w} \in \mathbb{R}^{N_1 \times N_2}\) and \(\mathbf{b} \in \mathbb{R}^{N_2}\) are weights and biases, respectively, both of which are trainable if trainable[i] is True. \(\boldsymbol{\phi}\) is the activation function.
The output layer \(\mathcal{L}^{(n)}\) is given by
\[\mathbf{y}=\mathcal{L}^{(n)}(\mathbf{x};\mathbf{w},\mathbf{b})= \mathbf{x}^T\mathbf{w}+\mathbf{b}\]where \(\mathbf{x} \in \mathbb{R}^{N_{n-1}}\) is the input vector and \(\mathbf{y} \in \mathbb{R}\) is the output scalar. \(\mathbf{w} \in \mathbb{R}^{N_{n-1}}\) and \(\mathbf{b} \in \mathbb{R}\) are weights and bias, respectively, both of which are trainable if trainable[n] is True.
- Parameters:
- var_name
The name of the output variable.
- ntypes
The number of atom types.
- dim_descrpt
The dimension of the input descriptor.
- dim_out
The dimension of the output fit property.
- neuron
Number of neurons \(N\) in each hidden layer of the fitting net
- resnet_dt
Time-step dt in the resnet construction: \(y = x + dt * \phi (Wx + b)\)
- numb_fparam
Number of frame parameter
- numb_aparam
Number of atomic parameter
- rcond
The condition number for the regression of atomic energy.
- bias_atom
Bias for each element.
- tot_ener_zero
Force the total energy to zero. Useful for the charge fitting.
- trainable
If the weights of fitting net are trainable. Suppose that we have \(N_l\) hidden layers in the fitting net, this list is of length \(N_l + 1\), specifying if the hidden layers and the output layer are trainable.
- atom_ener
Specifying atomic energy contribution in vacuum. The set_davg_zero key in the descriptor should be set.
- activation_function
The activation function \(\boldsymbol{\phi}\) in the embedding net. Supported options are “relu”, “linear”, “tanh”, “sigmoid”, “gelu_tf”, “gelu”, “none”, “softplus”, “relu6”.
- precision
The precision of the embedding net parameters. Supported options are “default”, “float32”, “float64”, “float16”.
- layer_name
list[Optional[str]],optional The name of the each layer. If two layers, either in the same fitting or different fittings, have the same name, they will share the same neural network parameters.
- use_aparam_as_mask: bool, optional
If True, the atomic parameters will be used as a mask that determines the atom is real/virtual. And the aparam will not be used as the atomic parameters for embedding.
- mixed_types
If false, different atomic types uses different fitting net, otherwise different atom types share the same fitting net.
- exclude_types: list[int]
Atomic contributions of the excluded atom types are set zero.
- type_map: list[str], Optional
A list of strings. Give the name to each type of atoms.
- dim_out#
- atom_ener#
- classmethod deserialize(data: dict) deepmd.dpmodel.fitting.general_fitting.GeneralFitting[source]#
Deserialize the fitting.
- Parameters:
- data
dict The serialized data
- data
- Returns:
BFThe deserialized fitting
- call(descriptor: numpy.ndarray, atype: numpy.ndarray, gr: numpy.ndarray | None = None, g2: numpy.ndarray | None = None, h2: numpy.ndarray | None = None, fparam: numpy.ndarray | None = None, aparam: numpy.ndarray | None = None) dict[str, numpy.ndarray][source]#
Calculate the fitting.
- Parameters:
- descriptor
input descriptor. shape: nf x nloc x nd
- atype
the atom type. shape: nf x nloc
- gr
The rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3
- g2
The rotationally invariant pair-partical representation. shape: nf x nloc x nnei x ng
- h2
The rotationally equivariant pair-partical representation. shape: nf x nloc x nnei x 3
- fparam
The frame parameter. shape: nf x nfp. nfp being numb_fparam
- aparam
The atomic parameter. shape: nf x nloc x nap. nap being numb_aparam
- deepmd.dpmodel.fitting.make_base_fitting(t_tensor, fwd_method_name: str = 'forward')[source]#
Make the base class for the fitting.
- Parameters:
- t_tensor
The type of the tensor. used in the type hint.
- fwd_method_name
Name of the forward method. For dpmodels, it should be “call”. For torch models, it should be “forward”.
- class deepmd.dpmodel.fitting.PolarFitting(ntypes: int, dim_descrpt: int, embedding_width: int, neuron: list[int] = [120, 120, 120], resnet_dt: bool = True, numb_fparam: int = 0, numb_aparam: int = 0, rcond: float | None = None, tot_ener_zero: bool = False, trainable: list[bool] | None = None, activation_function: str = 'tanh', precision: str = DEFAULT_PRECISION, layer_name: list[str | None] | None = None, use_aparam_as_mask: bool = False, spin: Any = None, mixed_types: bool = False, exclude_types: list[int] = [], fit_diag: bool = True, scale: list[float] | None = None, shift_diag: bool = True, type_map: list[str] | None = None, seed: int | list[int] | None = None)[source]#
Bases:
deepmd.dpmodel.fitting.general_fitting.GeneralFittingFitting rotationally equivariant polarizability of the system.
- Parameters:
- ntypes
The number of atom types.
- dim_descrpt
The dimension of the input descriptor.
- embedding_width
int The dimension of rotation matrix, m1.
- neuron
Number of neurons \(N\) in each hidden layer of the fitting net
- resnet_dt
Time-step dt in the resnet construction: \(y = x + dt * \phi (Wx + b)\)
- numb_fparam
Number of frame parameter
- numb_aparam
Number of atomic parameter
- rcond
The condition number for the regression of atomic energy.
- tot_ener_zero
Force the total energy to zero. Useful for the charge fitting.
- trainable
If the weights of fitting net are trainable. Suppose that we have \(N_l\) hidden layers in the fitting net, this list is of length \(N_l + 1\), specifying if the hidden layers and the output layer are trainable.
- activation_function
The activation function \(\boldsymbol{\phi}\) in the embedding net. Supported options are “relu”, “linear”, “tanh”, “sigmoid”, “gelu_tf”, “gelu”, “none”, “softplus”, “relu6”.
- precision
The precision of the embedding net parameters. Supported options are “default”, “float32”, “float64”, “float16”.
- layer_name
list[Optional[str]],optional The name of the each layer. If two layers, either in the same fitting or different fittings, have the same name, they will share the same neural network parameters.
- use_aparam_as_mask: bool, optional
If True, the atomic parameters will be used as a mask that determines the atom is real/virtual. And the aparam will not be used as the atomic parameters for embedding.
- mixed_types
If true, use a uniform fitting net for all atom types, otherwise use different fitting nets for different atom types.
- fit_diagbool
Fit the diagonal part of the rotational invariant polarizability matrix, which will be converted to normal polarizability matrix by contracting with the rotation matrix.
- scale
list[float] The output of the fitting net (polarizability matrix) for type i atom will be scaled by scale[i]
- shift_diagbool
Whether to shift the diagonal part of the polarizability matrix. The shift operation is carried out after scale.
- type_map: list[str], Optional
A list of strings. Give the name to each type of atoms.
- embedding_width#
- fit_diag#
- scale#
- shift_diag#
- constant_matrix#
- classmethod deserialize(data: dict) deepmd.dpmodel.fitting.general_fitting.GeneralFitting[source]#
Deserialize the fitting.
- Parameters:
- data
dict The serialized data
- data
- Returns:
BFThe deserialized fitting
- 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.
- call(descriptor: numpy.ndarray, atype: numpy.ndarray, gr: numpy.ndarray | None = None, g2: numpy.ndarray | None = None, h2: numpy.ndarray | None = None, fparam: numpy.ndarray | None = None, aparam: numpy.ndarray | None = None) dict[str, numpy.ndarray][source]#
Calculate the fitting.
- Parameters:
- descriptor
input descriptor. shape: nf x nloc x nd
- atype
the atom type. shape: nf x nloc
- gr
The rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3
- g2
The rotationally invariant pair-partical representation. shape: nf x nloc x nnei x ng
- h2
The rotationally equivariant pair-partical representation. shape: nf x nloc x nnei x 3
- fparam
The frame parameter. shape: nf x nfp. nfp being numb_fparam
- aparam
The atomic parameter. shape: nf x nloc x nap. nap being numb_aparam
- class deepmd.dpmodel.fitting.PropertyFittingNet(ntypes: int, dim_descrpt: int, task_dim: int = 1, neuron: list[int] = [128, 128, 128], bias_atom_p: numpy.ndarray | None = None, rcond: float | None = None, trainable: bool | list[bool] = True, intensive: bool = False, bias_method: str = 'normal', resnet_dt: bool = True, numb_fparam: int = 0, numb_aparam: int = 0, activation_function: str = 'tanh', precision: str = DEFAULT_PRECISION, mixed_types: bool = True, exclude_types: list[int] = [], type_map: list[str] | None = None, seed: int | None = None)[source]#
Bases:
deepmd.dpmodel.fitting.invar_fitting.InvarFittingFitting the rotationally invariant properties of task_dim of the system.
- Parameters:
- ntypes
The number of atom types.
- dim_descrpt
The dimension of the input descriptor.
- task_dim
The dimension of outputs of fitting net.
- neuron
Number of neurons \(N\) in each hidden layer of the fitting net
- bias_atom_p
Average property per atom for each element.
- rcond
The condition number for the regression of atomic energy.
- trainable
If the weights of fitting net are trainable. Suppose that we have \(N_l\) hidden layers in the fitting net, this list is of length \(N_l + 1\), specifying if the hidden layers and the output layer are trainable.
- intensive
Whether the fitting property is intensive.
- bias_method
The method of applying the bias to each atomic output, user can select ‘normal’ or ‘no_bias’. If ‘normal’ is used, the computed bias will be added to the atomic output. If ‘no_bias’ is used, no bias will be added to the atomic output.
- resnet_dt
Time-step dt in the resnet construction: \(y = x + dt * \phi (Wx + b)\)
- numb_fparam
Number of frame parameter
- numb_aparam
Number of atomic parameter
- activation_function
The activation function \(\boldsymbol{\phi}\) in the embedding net. Supported options are “relu”, “linear”, “tanh”, “sigmoid”, “gelu_tf”, “gelu”, “none”, “softplus”, “relu6”.
- precision
The precision of the embedding net parameters. Supported options are “default”, “float32”, “float64”, “float16”.
- mixed_types
If false, different atomic types uses different fitting net, otherwise different atom types share the same fitting net.
- exclude_types: list[int]
Atomic contributions of the excluded atom types are set zero.
- type_map: list[str], Optional
A list of strings. Give the name to each type of atoms.
- task_dim#
- intensive#
- bias_method#
- classmethod deserialize(data: dict) PropertyFittingNet[source]#
Deserialize the fitting.
- Parameters:
- data
dict The serialized data
- data
- Returns:
BFThe deserialized fitting