deepmd.tf.model.ener
Module Contents
Classes
Energy model. |
- class deepmd.tf.model.ener.EnerModel(descriptor: dict, fitting_net: dict, type_embedding: dict | deepmd.tf.utils.type_embed.TypeEmbedNet | None = None, type_map: List[str] | None = None, data_stat_nbatch: int = 10, data_stat_protect: float = 0.01, use_srtab: str | None = None, smin_alpha: float | None = None, sw_rmin: float | None = None, sw_rmax: float | None = None, srtab_add_bias: bool = True, spin: deepmd.tf.utils.spin.Spin | None = None, data_bias_nsample: int = 10, **kwargs)[source]
Bases:
deepmd.tf.model.model.StandardModel
Energy model.
- Parameters:
- descriptor
Descriptor
- fitting_net
Fitting net
- type_embedding
Type embedding net
- type_map
Mapping atom type to the name (str) of the type. For example type_map[1] gives the name of the type 1.
- data_stat_nbatch
Number of frames used for data statistic
- data_stat_protect
Protect parameter for atomic energy regression
- use_srtab
The table for the short-range pairwise interaction added on top of DP. The table is a text data file with (N_t + 1) * N_t / 2 + 1 columes. The first colume is the distance between atoms. The second to the last columes are energies for pairs of certain types. For example we have two atom types, 0 and 1. The columes from 2nd to 4th are for 0-0, 0-1 and 1-1 correspondingly.
- smin_alpha
The short-range tabulated interaction will be swithed according to the distance of the nearest neighbor. This distance is calculated by softmin. This parameter is the decaying parameter in the softmin. It is only required when use_srtab is provided.
- sw_rmin
The lower boundary of the interpolation between short-range tabulated interaction and DP. It is only required when use_srtab is provided.
- sw_rmin
The upper boundary of the interpolation between short-range tabulated interaction and DP. It is only required when use_srtab is provided.
- srtab_add_biasbool
Whether add energy bias from the statistics of the data to short-range tabulated atomic energy. It only takes effect when use_srtab is provided.
- spin
spin
- data_stat_nsample
The number of training samples in a system to compute and change the energy bias.
- build(coord_, atype_, natoms, box, mesh, input_dict, frz_model=None, ckpt_meta: str | None = None, suffix='', reuse=None)[source]
Build the model.
- Parameters:
- coord_
tf.Tensor
The coordinates of atoms
- atype_
tf.Tensor
The atom types of atoms
- natoms
tf.Tensor
The number of atoms
- box
tf.Tensor
The box vectors
- mesh
tf.Tensor
The mesh vectors
- input_dict
dict
The input dict
- frz_model
str
,optional
The path to the frozen model
- ckpt_meta
str
,optional
The path prefix of the checkpoint and meta files
- suffix
str
,optional
The suffix of the scope
- reusebool or
tf.AUTO_REUSE
,optional
Whether to reuse the variables
- coord_
- Returns:
dict
The output dict
- init_variables(graph: deepmd.tf.env.tf.Graph, graph_def: deepmd.tf.env.tf.GraphDef, model_type: str = 'original_model', suffix: str = '') None [source]
Init the embedding net variables with the given frozen model.
- change_energy_bias(data: deepmd.tf.utils.data_system.DeepmdDataSystem, frozen_model: str, origin_type_map: list, full_type_map: str, bias_adjust_mode: str = 'change-by-statistic') None [source]
Change the energy bias according to the input data and the pretrained model.
- Parameters:
- data
DeepmdDataSystem
The training data.
- frozen_model
str
The path file of frozen model.
- origin_type_map
list
The original type_map in dataset, they are targets to change the energy bias.
- full_type_map
str
The full type_map in pretrained model
- bias_adjust_mode
str
The mode for changing energy bias : [‘change-by-statistic’, ‘set-by-statistic’] ‘change-by-statistic’ : perform predictions on energies of target dataset,
and do least sqaure on the errors to obtain the target shift as bias.
‘set-by-statistic’ : directly use the statistic energy bias in the target dataset.
- data