deepmd.model package

class deepmd.model.DipoleModel(*args, **kwargs)[source]

Bases: TensorModel

Methods

build(coord_, atype_, natoms, box, mesh, ...)

Build the model.

build_descrpt(coord_, atype_, natoms, box, ...)

Build the descriptor part of the model.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

data_stat

get_ntypes

get_out_size

get_rcut

get_sel_type

get_type_map

class deepmd.model.EnerModel(descrpt, fitting, typeebd=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)[source]

Bases: Model

Energy model.

Parameters:
descrpt

Descriptor

fitting

Fitting 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.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

data_stat

get_ntypes

get_rcut

get_type_map

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

natomstf.Tensor

The number of atoms

boxtf.Tensor

The box vectors

meshtf.Tensor

The mesh vectors

input_dictdict

The input dict

frz_modelstr, optional

The path to the frozen model

ckpt_metastr, optional

The path to the checkpoint and meta file

suffixstr, optional

The suffix of the scope

reusebool or tf.AUTO_REUSE, optional

Whether to reuse the variables

Returns:
dict

The output dict

data_stat(data)[source]
get_ntypes()[source]
get_rcut()[source]
get_type_map()[source]
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.

Parameters:
graphtf.Graph

The input frozen model graph

graph_deftf.GraphDef

The input frozen model graph_def

model_typestr

the type of the model

suffixstr

suffix to name scope

model_type = 'ener'
class deepmd.model.GlobalPolarModel(*args, **kwargs)[source]

Bases: TensorModel

Methods

build(coord_, atype_, natoms, box, mesh, ...)

Build the model.

build_descrpt(coord_, atype_, natoms, box, ...)

Build the descriptor part of the model.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

data_stat

get_ntypes

get_out_size

get_rcut

get_sel_type

get_type_map

class deepmd.model.MultiModel(descrpt, fitting_dict, fitting_type_dict, typeebd=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)[source]

Bases: Model

Multi-task model.

Parameters:
descrpt

Descriptor

fitting_dict

Dictionary of fitting nets

fitting_type_dict

Dictionary of types of fitting nets

typeebd

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.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

data_stat

get_ntypes

get_rcut

get_type_map

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

natomstf.Tensor

The number of atoms

boxtf.Tensor

The box vectors

meshtf.Tensor

The mesh vectors

input_dictdict

The input dict

frz_modelstr, optional

The path to the frozen model

ckpt_metastr, optional

The path to the checkpoint and meta file

suffixstr, optional

The suffix of the scope

reusebool or tf.AUTO_REUSE, optional

Whether to reuse the variables

Returns:
dict

The output dict

data_stat(data)[source]
get_ntypes()[source]
get_rcut()[source]
get_type_map()[source]
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.

Parameters:
graphtf.Graph

The input frozen model graph

graph_deftf.GraphDef

The input frozen model graph_def

model_typestr

the type of the model

suffixstr

suffix to name scope

model_type = 'multi_task'
class deepmd.model.PolarModel(*args, **kwargs)[source]

Bases: TensorModel

Methods

build(coord_, atype_, natoms, box, mesh, ...)

Build the model.

build_descrpt(coord_, atype_, natoms, box, ...)

Build the descriptor part of the model.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

data_stat

get_ntypes

get_out_size

get_rcut

get_sel_type

get_type_map

class deepmd.model.WFCModel(*args, **kwargs)[source]

Bases: TensorModel

Methods

build(coord_, atype_, natoms, box, mesh, ...)

Build the model.

build_descrpt(coord_, atype_, natoms, box, ...)

Build the descriptor part of the model.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

data_stat

get_ntypes

get_out_size

get_rcut

get_sel_type

get_type_map

Submodules

deepmd.model.ener module

class deepmd.model.ener.EnerModel(descrpt, fitting, typeebd=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)[source]

Bases: Model

Energy model.

Parameters:
descrpt

Descriptor

fitting

Fitting 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.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

data_stat

get_ntypes

get_rcut

get_type_map

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

natomstf.Tensor

The number of atoms

boxtf.Tensor

The box vectors

meshtf.Tensor

The mesh vectors

input_dictdict

The input dict

frz_modelstr, optional

The path to the frozen model

ckpt_metastr, optional

The path to the checkpoint and meta file

suffixstr, optional

The suffix of the scope

reusebool or tf.AUTO_REUSE, optional

Whether to reuse the variables

Returns:
dict

The output dict

data_stat(data)[source]
get_ntypes()[source]
get_rcut()[source]
get_type_map()[source]
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.

Parameters:
graphtf.Graph

The input frozen model graph

graph_deftf.GraphDef

The input frozen model graph_def

model_typestr

the type of the model

suffixstr

suffix to name scope

model_type = 'ener'

deepmd.model.model module

class deepmd.model.model.Model[source]

Bases: ABC

Methods

build(coord_, atype_, natoms, box, mesh, ...)

Build the model.

build_descrpt(coord_, atype_, natoms, box, ...)

Build the descriptor part of the model.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

abstract build(coord_: Tensor, atype_: Tensor, natoms: Tensor, box: Tensor, mesh: Tensor, input_dict: dict, frz_model: str | None = None, ckpt_meta: str | None = None, suffix: str = '', reuse: bool | Enum | None = None)[source]

Build the model.

Parameters:
coord_tf.Tensor

The coordinates of atoms

atype_tf.Tensor

The atom types of atoms

natomstf.Tensor

The number of atoms

boxtf.Tensor

The box vectors

meshtf.Tensor

The mesh vectors

input_dictdict

The input dict

frz_modelstr, optional

The path to the frozen model

ckpt_metastr, optional

The path to the checkpoint and meta file

suffixstr, optional

The suffix of the scope

reusebool or tf.AUTO_REUSE, optional

Whether to reuse the variables

Returns:
dict

The output dict

build_descrpt(coord_: Tensor, atype_: Tensor, natoms: Tensor, box: Tensor, mesh: Tensor, input_dict: dict, frz_model: str | None = None, ckpt_meta: str | None = None, suffix: str = '', reuse: bool | Enum | None = 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

natomstf.Tensor

The number of atoms

boxtf.Tensor

The box vectors

meshtf.Tensor

The mesh vectors

input_dictdict

The input dict

frz_modelstr, optional

The path to the frozen model

ckpt_metastr, optional

The path to the checkpoint and meta file

suffixstr, optional

The suffix of the scope

reusebool or tf.AUTO_REUSE, optional

Whether to reuse the variables

Returns:
tf.Tensor

The descriptor tensor

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.

Parameters:
graphtf.Graph

The input frozen model graph

graph_deftf.GraphDef

The input frozen model graph_def

model_typestr

the type of the model

suffixstr

suffix to name scope

deepmd.model.model_stat module

deepmd.model.model_stat.make_stat_input(data, nbatches, merge_sys=True)[source]

Pack data for statistics.

Parameters:
data

The data

nbatchesint

The number of batches

merge_sysbool (True)

Merge system data

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.model.model_stat.merge_sys_stat(all_stat)[source]

deepmd.model.multi module

class deepmd.model.multi.MultiModel(descrpt, fitting_dict, fitting_type_dict, typeebd=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)[source]

Bases: Model

Multi-task model.

Parameters:
descrpt

Descriptor

fitting_dict

Dictionary of fitting nets

fitting_type_dict

Dictionary of types of fitting nets

typeebd

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.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

data_stat

get_ntypes

get_rcut

get_type_map

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

natomstf.Tensor

The number of atoms

boxtf.Tensor

The box vectors

meshtf.Tensor

The mesh vectors

input_dictdict

The input dict

frz_modelstr, optional

The path to the frozen model

ckpt_metastr, optional

The path to the checkpoint and meta file

suffixstr, optional

The suffix of the scope

reusebool or tf.AUTO_REUSE, optional

Whether to reuse the variables

Returns:
dict

The output dict

data_stat(data)[source]
get_ntypes()[source]
get_rcut()[source]
get_type_map()[source]
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.

Parameters:
graphtf.Graph

The input frozen model graph

graph_deftf.GraphDef

The input frozen model graph_def

model_typestr

the type of the model

suffixstr

suffix to name scope

model_type = 'multi_task'

deepmd.model.tensor module

class deepmd.model.tensor.DipoleModel(*args, **kwargs)[source]

Bases: TensorModel

Methods

build(coord_, atype_, natoms, box, mesh, ...)

Build the model.

build_descrpt(coord_, atype_, natoms, box, ...)

Build the descriptor part of the model.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

data_stat

get_ntypes

get_out_size

get_rcut

get_sel_type

get_type_map

class deepmd.model.tensor.GlobalPolarModel(*args, **kwargs)[source]

Bases: TensorModel

Methods

build(coord_, atype_, natoms, box, mesh, ...)

Build the model.

build_descrpt(coord_, atype_, natoms, box, ...)

Build the descriptor part of the model.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

data_stat

get_ntypes

get_out_size

get_rcut

get_sel_type

get_type_map

class deepmd.model.tensor.PolarModel(*args, **kwargs)[source]

Bases: TensorModel

Methods

build(coord_, atype_, natoms, box, mesh, ...)

Build the model.

build_descrpt(coord_, atype_, natoms, box, ...)

Build the descriptor part of the model.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

data_stat

get_ntypes

get_out_size

get_rcut

get_sel_type

get_type_map

class deepmd.model.tensor.TensorModel(tensor_name: str, descrpt, fitting, typeebd=None, type_map: List[str] | None = None, data_stat_nbatch: int = 10, data_stat_protect: float = 0.01)[source]

Bases: Model

Tensor model.

Parameters:
tensor_name

Name of the tensor.

descrpt

Descriptor

fitting

Fitting net

typeebd

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.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

data_stat

get_ntypes

get_out_size

get_rcut

get_sel_type

get_type_map

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

natomstf.Tensor

The number of atoms

boxtf.Tensor

The box vectors

meshtf.Tensor

The mesh vectors

input_dictdict

The input dict

frz_modelstr, optional

The path to the frozen model

ckpt_metastr, optional

The path to the checkpoint and meta file

suffixstr, optional

The suffix of the scope

reusebool or tf.AUTO_REUSE, optional

Whether to reuse the variables

Returns:
dict

The output dict

data_stat(data)[source]
get_ntypes()[source]
get_out_size()[source]
get_rcut()[source]
get_sel_type()[source]
get_type_map()[source]
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.

Parameters:
graphtf.Graph

The input frozen model graph

graph_deftf.GraphDef

The input frozen model graph_def

model_typestr

the type of the model

suffixstr

suffix to name scope

class deepmd.model.tensor.WFCModel(*args, **kwargs)[source]

Bases: TensorModel

Methods

build(coord_, atype_, natoms, box, mesh, ...)

Build the model.

build_descrpt(coord_, atype_, natoms, box, ...)

Build the descriptor part of the model.

init_variables(graph, graph_def[, ...])

Init the embedding net variables with the given frozen model.

data_stat

get_ntypes

get_out_size

get_rcut

get_sel_type

get_type_map