deepmd.tf.model package
- class deepmd.tf.model.DOSModel(*args, **kwargs)[source]
Bases:
StandardModelDOS 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
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
Get the number of atomic parameters.
Get the number of gridpoints in energy space.
Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
- build(coord_, atype_, natoms, box, mesh, input_dict, frz_model=None, ckpt_meta: Optional[str] = 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
dictThe output dict
- init_variables(graph: Graph, graph_def: GraphDef, model_type: str = 'original_model', suffix: str = '') None[source]
Init the embedding net variables with the given frozen model.
- model_type = 'dos'
- class deepmd.tf.model.DipoleModel(*args, **kwargs)[source]
Bases:
TensorModelMethods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
get_ntypes()Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
get_out_size
get_sel_type
- class deepmd.tf.model.EnerModel(*args, **kwargs)[source]
Bases:
StandardModelEnergy 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.
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
natoms_match
natoms_not_match
- build(coord_, atype_, natoms, box, mesh, input_dict, frz_model=None, ckpt_meta: Optional[str] = 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
dictThe output dict
- change_energy_bias(data: DeepmdDataSystem, frozen_model: str, origin_type_map: list, full_type_map: str, bias_shift: str = 'delta') 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_shift
str The mode for changing energy bias : [‘delta’, ‘statistic’] ‘delta’ : perform predictions on energies of target dataset,
and do least sqaure on the errors to obtain the target shift as bias.
‘statistic’ : directly use the statistic energy bias in the target dataset.
- data
- init_variables(graph: Graph, graph_def: GraphDef, model_type: str = 'original_model', suffix: str = '') None[source]
Init the embedding net variables with the given frozen model.
- model_type = 'ener'
- class deepmd.tf.model.FrozenModel(*args, **kwargs)[source]
Bases:
ModelLoad model from a frozen model, which cannot be trained.
- Parameters
- model_file
str The path to the frozen model
- model_file
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
- build(coord_: Tensor, atype_: Tensor, natoms: Tensor, box: Tensor, mesh: Tensor, input_dict: dict, frz_model: Optional[str] = None, ckpt_meta: Optional[str] = None, suffix: str = '', reuse: Optional[Union[bool, Enum]] = None) dict[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
dictThe output dict
- enable_compression(suffix: str = '') None[source]
Enable compression.
- Parameters
- suffix
str suffix to name scope
- suffix
- class deepmd.tf.model.GlobalPolarModel(*args, **kwargs)[source]
Bases:
TensorModelMethods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
get_ntypes()Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
get_out_size
get_sel_type
- class deepmd.tf.model.LinearEnergyModel(*args, **kwargs)[source]
Bases:
LinearModelLinear energy model make linear combinations of several existing energy models.
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
get_ntypes
- build(coord_: Tensor, atype_: Tensor, natoms: Tensor, box: Tensor, mesh: Tensor, input_dict: dict, frz_model: Optional[str] = None, ckpt_meta: Optional[str] = None, suffix: str = '', reuse: Optional[Union[bool, Enum]] = None) dict[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
dictThe output dict
- model_type = 'ener'
- class deepmd.tf.model.MultiModel(*args, **kwargs)[source]
Bases:
ModelMulti-task model.
- Parameters
- descriptor
Descriptor
- fitting_net_dict
Dictionary of fitting nets
- fitting_type_dict
deprecated argument
- 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.
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
Get the number of atomic parameters.
Get the number of gridpoints in energy space.
Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
- build(coord_, atype_, natoms, box, mesh, input_dict, frz_model=None, ckpt_meta: Optional[str] = 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
dictThe output dict
- enable_mixed_precision(mixed_prec: dict)[source]
Enable mixed precision for the model.
- Parameters
- mixed_prec
dict The mixed precision config
- mixed_prec
- init_variables(graph: Graph, graph_def: GraphDef, model_type: str = 'original_model', suffix: str = '') None[source]
Init the embedding net variables with the given frozen model.
- model_type = 'multi_task'
- class deepmd.tf.model.PairTabModel(*args, **kwargs)[source]
Bases:
ModelPairwise tabulation energy model.
This model can be used to tabulate the pairwise energy between atoms for either short-range or long-range interactions, such as D3, LJ, ZBL, etc. It should not be used alone, but rather as one submodel of a linear (sum) model, such as DP+D3.
Do not put the model on the first model of a linear model, since the linear model fetches the type map from the first model.
At this moment, the model does not smooth the energy at the cutoff radius, so one needs to make sure the energy has been smoothed to zero.
- Parameters
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
- build(coord_: Tensor, atype_: Tensor, natoms: Tensor, box: Tensor, mesh: Tensor, input_dict: dict, frz_model: Optional[str] = None, ckpt_meta: Optional[str] = None, suffix: str = '', reuse: Optional[Union[bool, Enum]] = 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
dictThe output dict
- enable_compression(suffix: str = '') None[source]
Enable compression.
- Parameters
- suffix
str suffix to name scope
- suffix
- init_variables(graph: Graph, graph_def: GraphDef, model_type: str = 'original_model', suffix: str = '') None[source]
Init the embedding net variables with the given frozen model.
- model_type = 'ener'
- class deepmd.tf.model.PairwiseDPRc(*args, **kwargs)[source]
Bases:
ModelPairwise Deep Potential - Range Correction.
Methods
build(coord_, atype_, natoms, box_, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
- build(coord_: Tensor, atype_: Tensor, natoms: Tensor, box_: Tensor, mesh: Tensor, input_dict: dict, frz_model=None, ckpt_meta: Optional[str] = None, suffix: str = '', reuse: Optional[bool] = 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
dictThe output dict
- enable_compression(suffix: str = '') None[source]
Enable compression.
- Parameters
- suffix
str suffix to name scope
- suffix
- get_feed_dict(coord_: Tensor, atype_: Tensor, natoms: Tensor, box: Tensor, mesh: Tensor, **kwargs) Dict[str, Tensor][source]
Generate the feed_dict for current descriptor.
- Parameters
- coord_
tf.Tensor The coordinate of atoms
- atype_
tf.Tensor The type of atoms
- natoms
tf.Tensor The number of atoms. This tensor has the length of Ntypes + 2 natoms[0]: number of local atoms natoms[1]: total number of atoms held by this processor natoms[i]: 2 <= i < Ntypes+2, number of type i atoms
- box
tf.Tensor The box. Can be generated by deepmd.tf.model.make_stat_input
- mesh
tf.Tensor For historical reasons, only the length of the Tensor matters. if size of mesh == 6, pbc is assumed. if size of mesh == 0, no-pbc is assumed.
- aparam
tf.Tensor The parameters of the descriptor
- **kwargs
dict The keyword arguments
- coord_
- Returns
- init_variables(graph: Graph, graph_def: GraphDef, model_type: str = 'original_model', suffix: str = '') None[source]
Init the embedding net variables with the given frozen model.
- model_type = 'ener'
- class deepmd.tf.model.PolarModel(*args, **kwargs)[source]
Bases:
TensorModelMethods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
get_ntypes()Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
get_out_size
get_sel_type
- class deepmd.tf.model.WFCModel(*args, **kwargs)[source]
Bases:
TensorModelMethods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
get_ntypes()Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
get_out_size
get_sel_type
Submodules
deepmd.tf.model.dos module
- class deepmd.tf.model.dos.DOSModel(*args, **kwargs)[source]
Bases:
StandardModelDOS 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
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
Get the number of atomic parameters.
Get the number of gridpoints in energy space.
Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
- build(coord_, atype_, natoms, box, mesh, input_dict, frz_model=None, ckpt_meta: Optional[str] = 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
dictThe output dict
- init_variables(graph: Graph, graph_def: GraphDef, model_type: str = 'original_model', suffix: str = '') None[source]
Init the embedding net variables with the given frozen model.
- model_type = 'dos'
deepmd.tf.model.ener module
- class deepmd.tf.model.ener.EnerModel(*args, **kwargs)[source]
Bases:
StandardModelEnergy 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.
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
natoms_match
natoms_not_match
- build(coord_, atype_, natoms, box, mesh, input_dict, frz_model=None, ckpt_meta: Optional[str] = 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
dictThe output dict
- change_energy_bias(data: DeepmdDataSystem, frozen_model: str, origin_type_map: list, full_type_map: str, bias_shift: str = 'delta') 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_shift
str The mode for changing energy bias : [‘delta’, ‘statistic’] ‘delta’ : perform predictions on energies of target dataset,
and do least sqaure on the errors to obtain the target shift as bias.
‘statistic’ : directly use the statistic energy bias in the target dataset.
- data
- init_variables(graph: Graph, graph_def: GraphDef, model_type: str = 'original_model', suffix: str = '') None[source]
Init the embedding net variables with the given frozen model.
- model_type = 'ener'
deepmd.tf.model.frozen module
- class deepmd.tf.model.frozen.FrozenModel(*args, **kwargs)[source]
Bases:
ModelLoad model from a frozen model, which cannot be trained.
- Parameters
- model_file
str The path to the frozen model
- model_file
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
- build(coord_: Tensor, atype_: Tensor, natoms: Tensor, box: Tensor, mesh: Tensor, input_dict: dict, frz_model: Optional[str] = None, ckpt_meta: Optional[str] = None, suffix: str = '', reuse: Optional[Union[bool, Enum]] = None) dict[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
dictThe output dict
- enable_compression(suffix: str = '') None[source]
Enable compression.
- Parameters
- suffix
str suffix to name scope
- suffix
deepmd.tf.model.linear module
- class deepmd.tf.model.linear.LinearEnergyModel(*args, **kwargs)[source]
Bases:
LinearModelLinear energy model make linear combinations of several existing energy models.
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
get_ntypes
- build(coord_: Tensor, atype_: Tensor, natoms: Tensor, box: Tensor, mesh: Tensor, input_dict: dict, frz_model: Optional[str] = None, ckpt_meta: Optional[str] = None, suffix: str = '', reuse: Optional[Union[bool, Enum]] = None) dict[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
dictThe output dict
- model_type = 'ener'
- class deepmd.tf.model.linear.LinearModel(*args, **kwargs)[source]
Bases:
ModelLinear model make linear combinations of several existing models.
- Parameters
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
get_ntypes
- enable_compression(suffix: str = '') None[source]
Enable compression.
- Parameters
- suffix
str suffix to name scope
- suffix
deepmd.tf.model.model module
- class deepmd.tf.model.model.Model(*args, **kwargs)[source]
Bases:
ABC,PRAbstract base model.
- Parameters
- 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_bias_nsample
The number of training samples in a system to compute and change the energy bias.
- 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
- compress
Compression information for internal use
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
Get the number of atomic parameters.
Get the number of gridpoints in energy space.
Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
- abstract build(coord_: Tensor, atype_: Tensor, natoms: Tensor, box: Tensor, mesh: Tensor, input_dict: dict, frz_model: Optional[str] = None, ckpt_meta: Optional[str] = None, suffix: str = '', reuse: Optional[Union[bool, Enum]] = 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
dictThe output dict
- build_descrpt(coord_: Tensor, atype_: Tensor, natoms: Tensor, box: Tensor, mesh: Tensor, input_dict: dict, frz_model: Optional[str] = None, ckpt_meta: Optional[str] = None, suffix: str = '', reuse: Optional[Union[bool, Enum]] = None)[source]
Build the descriptor part of 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
tf.TensorThe descriptor tensor
- build_type_embedding(ntypes: int, frz_model: Optional[str] = None, ckpt_meta: Optional[str] = None, suffix: str = '', reuse: Optional[Union[bool, Enum]] = None) Tensor[source]
Build the type embedding part of the model.
- Parameters
- Returns
tf.TensorThe type embedding tensor
- change_energy_bias(data: DeepmdDataSystem, frozen_model: str, origin_type_map: list, full_type_map: str, bias_shift: str = 'delta') 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_shift
str The mode for changing energy bias : [‘delta’, ‘statistic’] ‘delta’ : perform predictions on energies of target dataset,
and do least sqaure on the errors to obtain the target shift as bias.
‘statistic’ : directly use the statistic energy bias in the target dataset.
- data
- classmethod deserialize(data: dict, suffix: str = '') Model[source]
Deserialize the model.
There is no suffix in a native DP model, but it is important for the TF backend.
- enable_compression(suffix: str = '')[source]
Enable compression.
- Parameters
- suffix
str suffix to name scope
- suffix
- enable_mixed_precision(mixed_prec: dict)[source]
Enable mixed precision for the model.
- Parameters
- mixed_prec
dict The mixed precision config
- mixed_prec
- get_feed_dict(coord_: Tensor, atype_: Tensor, natoms: Tensor, box: Tensor, mesh: Tensor, **kwargs) Dict[str, Tensor][source]
Generate the feed_dict for current descriptor.
- Parameters
- coord_
tf.Tensor The coordinate of atoms
- atype_
tf.Tensor The type of atoms
- natoms
tf.Tensor The number of atoms. This tensor has the length of Ntypes + 2 natoms[0]: number of local atoms natoms[1]: total number of atoms held by this processor natoms[i]: 2 <= i < Ntypes+2, number of type i atoms
- box
tf.Tensor The box. Can be generated by deepmd.tf.model.make_stat_input
- mesh
tf.Tensor For historical reasons, only the length of the Tensor matters. if size of mesh == 6, pbc is assumed. if size of mesh == 0, no-pbc is assumed.
- **kwargs
dict The additional arguments
- coord_
- Returns
- init_variables(graph: Graph, graph_def: GraphDef, model_type: str = 'original_model', suffix: str = '') None[source]
Init the embedding net variables with the given frozen model.
- serialize(suffix: str = '') dict[source]
Serialize the model.
There is no suffix in a native DP model, but it is important for the TF backend.
- class deepmd.tf.model.model.StandardModel(*args, **kwargs)[source]
Bases:
ModelStandard model, which must contain a descriptor and a fitting.
- Parameters
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
- classmethod deserialize(data: dict, suffix: str = '') Descriptor[source]
Deserialize the model.
There is no suffix in a native DP model, but it is important for the TF backend.
- enable_compression(suffix: str = '')[source]
Enable compression.
- Parameters
- suffix
str suffix to name scope
- suffix
- enable_mixed_precision(mixed_prec: dict)[source]
Enable mixed precision for the model.
- Parameters
- mixed_prec
dict The mixed precision config
- mixed_prec
deepmd.tf.model.model_stat module
Alias for backward compatibility.
- deepmd.tf.model.model_stat.make_stat_input(data, nbatches, merge_sys=True)[source]
Pack data for statistics.
- Parameters
- Returns
- all_stat:
A dictionary of list of list storing data for stat. if merge_sys == False data can be accessed by
all_stat[key][sys_idx][batch_idx][frame_idx]
- else merge_sys == True can be accessed by
all_stat[key][batch_idx][frame_idx]
deepmd.tf.model.multi module
- class deepmd.tf.model.multi.MultiModel(*args, **kwargs)[source]
Bases:
ModelMulti-task model.
- Parameters
- descriptor
Descriptor
- fitting_net_dict
Dictionary of fitting nets
- fitting_type_dict
deprecated argument
- 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.
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
Get the number of atomic parameters.
Get the number of gridpoints in energy space.
Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
- build(coord_, atype_, natoms, box, mesh, input_dict, frz_model=None, ckpt_meta: Optional[str] = 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
dictThe output dict
- enable_mixed_precision(mixed_prec: dict)[source]
Enable mixed precision for the model.
- Parameters
- mixed_prec
dict The mixed precision config
- mixed_prec
- init_variables(graph: Graph, graph_def: GraphDef, model_type: str = 'original_model', suffix: str = '') None[source]
Init the embedding net variables with the given frozen model.
- model_type = 'multi_task'
deepmd.tf.model.pairtab module
- class deepmd.tf.model.pairtab.PairTabModel(*args, **kwargs)[source]
Bases:
ModelPairwise tabulation energy model.
This model can be used to tabulate the pairwise energy between atoms for either short-range or long-range interactions, such as D3, LJ, ZBL, etc. It should not be used alone, but rather as one submodel of a linear (sum) model, such as DP+D3.
Do not put the model on the first model of a linear model, since the linear model fetches the type map from the first model.
At this moment, the model does not smooth the energy at the cutoff radius, so one needs to make sure the energy has been smoothed to zero.
- Parameters
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
- build(coord_: Tensor, atype_: Tensor, natoms: Tensor, box: Tensor, mesh: Tensor, input_dict: dict, frz_model: Optional[str] = None, ckpt_meta: Optional[str] = None, suffix: str = '', reuse: Optional[Union[bool, Enum]] = 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
dictThe output dict
- enable_compression(suffix: str = '') None[source]
Enable compression.
- Parameters
- suffix
str suffix to name scope
- suffix
- init_variables(graph: Graph, graph_def: GraphDef, model_type: str = 'original_model', suffix: str = '') None[source]
Init the embedding net variables with the given frozen model.
- model_type = 'ener'
deepmd.tf.model.pairwise_dprc module
- class deepmd.tf.model.pairwise_dprc.PairwiseDPRc(*args, **kwargs)[source]
Bases:
ModelPairwise Deep Potential - Range Correction.
Methods
build(coord_, atype_, natoms, box_, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
- build(coord_: Tensor, atype_: Tensor, natoms: Tensor, box_: Tensor, mesh: Tensor, input_dict: dict, frz_model=None, ckpt_meta: Optional[str] = None, suffix: str = '', reuse: Optional[bool] = 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
dictThe output dict
- enable_compression(suffix: str = '') None[source]
Enable compression.
- Parameters
- suffix
str suffix to name scope
- suffix
- get_feed_dict(coord_: Tensor, atype_: Tensor, natoms: Tensor, box: Tensor, mesh: Tensor, **kwargs) Dict[str, Tensor][source]
Generate the feed_dict for current descriptor.
- Parameters
- coord_
tf.Tensor The coordinate of atoms
- atype_
tf.Tensor The type of atoms
- natoms
tf.Tensor The number of atoms. This tensor has the length of Ntypes + 2 natoms[0]: number of local atoms natoms[1]: total number of atoms held by this processor natoms[i]: 2 <= i < Ntypes+2, number of type i atoms
- box
tf.Tensor The box. Can be generated by deepmd.tf.model.make_stat_input
- mesh
tf.Tensor For historical reasons, only the length of the Tensor matters. if size of mesh == 6, pbc is assumed. if size of mesh == 0, no-pbc is assumed.
- aparam
tf.Tensor The parameters of the descriptor
- **kwargs
dict The keyword arguments
- coord_
- Returns
- init_variables(graph: Graph, graph_def: GraphDef, model_type: str = 'original_model', suffix: str = '') None[source]
Init the embedding net variables with the given frozen model.
- model_type = 'ener'
deepmd.tf.model.tensor module
- class deepmd.tf.model.tensor.DipoleModel(*args, **kwargs)[source]
Bases:
TensorModelMethods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
get_ntypes()Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
get_out_size
get_sel_type
- class deepmd.tf.model.tensor.GlobalPolarModel(*args, **kwargs)[source]
Bases:
TensorModelMethods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
get_ntypes()Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
get_out_size
get_sel_type
- class deepmd.tf.model.tensor.PolarModel(*args, **kwargs)[source]
Bases:
TensorModelMethods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
get_ntypes()Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
get_out_size
get_sel_type
- class deepmd.tf.model.tensor.TensorModel(*args, **kwargs)[source]
Bases:
StandardModelTensor model.
- Parameters
- tensor_name
Name of the tensor.
- 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
Methods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
get_out_size
get_sel_type
- build(coord_, atype_, natoms, box, mesh, input_dict, frz_model=None, ckpt_meta: Optional[str] = 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
dictThe output dict
- class deepmd.tf.model.tensor.WFCModel(*args, **kwargs)[source]
Bases:
TensorModelMethods
build(coord_, atype_, natoms, box, mesh, ...)Build the model.
build_descrpt(coord_, atype_, natoms, box, ...)Build the descriptor part of the model.
build_type_embedding(ntypes[, frz_model, ...])Build the type embedding part of the model.
change_energy_bias(data, frozen_model, ...)Change the energy bias according to the input data and the pretrained model.
data_stat(data)Data staticis.
deserialize(data[, suffix])Deserialize the model.
enable_compression([suffix])Enable compression.
enable_mixed_precision(mixed_prec)Enable mixed precision for the model.
get_class_by_type(class_type)Get the class by the plugin type.
get_feed_dict(coord_, atype_, natoms, box, ...)Generate the feed_dict for current descriptor.
get_fitting()Get the fitting(s).
get_loss(loss, lr)Get the loss function(s).
get_ntypes()Get the number of types.
get_numb_aparam()Get the number of atomic parameters.
get_numb_dos()Get the number of gridpoints in energy space.
get_numb_fparam()Get the number of frame parameters.
get_plugins()Get all the registered plugins.
get_rcut()Get cutoff radius of the model.
get_type_map()Get the type map.
init_variables(graph, graph_def[, ...])Init the embedding net variables with the given frozen model.
register(key)Register a descriptor plugin.
serialize([suffix])Serialize the model.
update_sel(global_jdata, local_jdata)Update the selection and perform neighbor statistics.
get_out_size
get_sel_type